These methods deal with drawing graphics within the device context of a window. See GetWindowDC, GetDC, and GetButtonDC for information on how to retrieve a device context.
>>-aDialogControl~CreateBrush(--color--+-----------------+--)-->< +-,brushSpecifier-+
The CreateBrush method creates a color brush or a bitmap brush. It returns the handle to a brush object. To remove the brush, use DeleteObject. The brush is used to fill rectangles.
The arguments are:
The color number. For a list of color numbers, refer to Definition of Terms.
The name of a bitmap file or one of the following keywords to create a hatched brush:
A 45-degree upward, left-to-right hatch
A horizontal and vertical crosshatch
A 45-degree crosshatch
A 45-degree downward, left-to-right hatch
A horizontal hatch
A vertical hatch
If CreateBrush is sent to a dialog object (subclass of ResDialog), brushSpecifier can also be an integer resource ID for a bitmap stored in the DLL that also stores the resource.
If this argument is omitted, a solid brush with the specified color is created.
+-1-----+ >>-aDialogControl~CreatePen(--+-------+--,--+----------------------+--,--> +-width-+ | +-SOLID------+ | +-"--+-DASH-------+--"-+ +-DOT--------+ +-DASHDOT----+ +-DASHDOTDOT-+ +-NULL-------+ +-0-----+ >--+-------+--)--------------------------------------------------------->< +-color-+
The CreatePen method creates a pen in the specified color and style. It returns the handle to a pen object. To remove the pen, use DeleteObject.
The arguments are:
The width of the lines that the pen will draw. If omitted, 1 is used as default.
One of the keywords listed in the syntax diagram. Values other than SOLID or NULL have no effect on pens with a width greater than 1. SOLID is the default.
The color number of the pen. If omitted, 0 is used as default. For a list of color numbers, refer to Definition of Terms.
The following example creates a dotted pen object with a width of 1:
hPen = MyDialog~CreatePen(1, "DOT", 13)
>>-aDialogControl~ObjectToDC(--dc--,--obj--)-------------------><
The ObjectToDC method loads a graphic object, namely a pen or a brush, into a device context. Subsequent lines, rectangles, and arcs are drawn using the pen and brush.
The arguments are:
The device context.
The object: a pen or a brush.
The handle of the previous active pen or brush. It can be used to restore the previous environment.
The following example activates a pen for drawing:
dc = MyBaseDialog~GetDC hpen = MyDialog~CreatePen(2, "SOLID", 4) MyDialog~ObjectToDC(dc,hpen) ... /* do lines, rectangles, ... */ MyDialog~deleteObject(hpen)
>>-aDialogControl~DeleteObject(--obj--)------------------------><
The DeleteObject method deletes a graphic object, namely a pen or a brush. See CreatePen and CreateBrush for information on how to get the handle of a pen or brush.
The only argument is:
The handle of a pen or brush.