See Also Example
Applies To
Form, line
Description
Determines the appearance of output from graphics methods
Usage
{ [form.][control.]|Printer.}DrawMode[ = mode ]
Setting
The DrawMode property settings are:
Setting Description
1 Black Pen .
2 Inverse of setting 15 (Merge Pen)NotMergePen.
3 Combination of the colors common to the background color and the inverse of the penMask Not Pen.
4 Inverse of setting 13 (Copy Pen)NotCopyPen.
5 Combination of the colors common to both the pen and the inverse of the displayMaskPenNot.
6 Inverse of the display colorInvert.
7 Combination of the colors in the pen and in the display color, but not in bothXorPen.
8 Inverse of setting 9 (Mask Pen)NotMaskPen.
9 Combination of the colors common to both the pen and the displayMaskPen.
10 Inverse of setting 7 (Xor Pen)NotXorPen.
11 No operationoutput remains unchanged. In effect, this setting turns drawing offNop.
12 Combination of the display color and the inverse of the pen colorMergeNotPen.
13 (Default) Color specified by the ForeColor propertyCopyPen.
14 Combination of the pen color and the inverse of the display colorMergePenNot.
15 Combination of the pen color and the display colorMergePen.
16 White Pen.
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 it 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 perhaps the most predictable results.
Data Type
Integer (Enumerated)
Help:
DrawStyle Property
DrawWidth Property
FillColor Property
FillStyle Property
Programmer's Guide:
Chapter 15, "Creating Graphics for Applications"
The example enables drawing on a form by dragging the mouse pointer. Each mouse click sets a different draw mode. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Load
DrawWidth = 10 ' Set DrawWidth.
End Sub
Sub Form_Click ()
Static M As Integer ' Current DrawMode setting.
ForeColor = QBColor(Int(Rnd * 15)) ' Choose a color.
M = ((M + 1) Mod 16) + 1 ' Keep DrawMode 16 or less.
DrawMode = M ' Set DrawMode.
End Sub
Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button Then ' While the button is pressed,
PSet (X, Y) ' draw a big point.
End If
End Sub