DrawMode

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 parts of the DrawMode property syntax are described in the following table.

Part Description
object An object expression that evaluates to an object.
number An integer that specifies appearance, as described in Settings.

Settings

The settings for number are described in the following table.

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.