DrawMode Property

       

Returns or sets a value that determines the appearance of output from graphics method or the appearance of a Shape or Line control.

Syntax

object.DrawMode [= number]

The DrawMode property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Number An integer that specifies appearance, as described in Settings.

Settings

The settings for number are:

Constant Setting Description
VbBlackness 1 Blackness.
VbNotMergePen 2 Not Merge Pen — Inverse of setting 15 (Merge Pen).
VbMaskNotPen 3 Mask Not Pen — Combination of the colors common to the background color and the inverse of the pen.
VbNotCopyPen 4 Not Copy Pen — Inverse of setting 13 (Copy Pen).
VbMaskPenNot 5 Mask Pen Not — Combination of the colors common to both the pen and the inverse of the display.
VbInvert 6 Invert — Inverse of the display color.
VbXorPen 7 Xor Pen — Combination of the colors in the pen and in the display color, but not in both.
VbNotMaskPen 8 Not Mask Pen — Inverse of setting 9 (Mask Pen).
VbMaskPen 9 Mask Pen — Combination of the colors common to both the pen and the display.
VbNotXorPen 10 Not Xor Pen — Inverse of setting 7 (Xor Pen).
VbNop 11 Nop — No operation — output remains unchanged. In effect, this setting turns drawing off.
VbMergeNotPen 12 Merge Not Pen — Combination of the display color and the inverse of the pen color.
VbCopyPen 13 Copy Pen (Default) — Color specified by the ForeColor property.
VbMergePenNot 14 Merge Pen Not — Combination of the pen color and the inverse of the display color.
VbMergePen 15 Merge Pen — Combination of the pen color and the display color.
VbWhiteness 16 Whiteness.

Remarks

Use this property to produce visual effects with Shape or Line controls or when drawing with the graphics methods. Visual Basic compares each pixel in the draw pattern to the corresponding pixel in the existing background and then applies bit-wise operations. For example, setting 7 (Xor Pen) uses the Xor operator to combine a draw pattern pixel with a background pixel.

The exact effect of a DrawMode setting depends on the way the color of a line drawn at run time combines with colors already on the screen. Settings 1, 6, 7, 11, 13, and 16 yield the most predictable results.