Ticket #2724: _WinAPI_CreatePen.txt

File _WinAPI_CreatePen.txt, 2.4 KB (added by mLipok, 11 years ago)
Line 
1###User Defined Function###
2_WinAPI_CreatePen
3
4###Description###
5Creates a logical pen that has the specified style, width, and color
6
7###Syntax###
8#include <WinAPI.au3>
9_WinAPI_CreatePen ( $iPenStyle, $iWidth, $iColor )
10
11
12###Parameters###
13@@ParamTable@@
14$iPenStyle
15        Specifies the pen style. It can be any one of the following values.
16        $PS_SOLID (0) - The pen is solid.
17        $PS_DASH (1) - The pen is dashed. This style is valid only when the pen width is one or less in device units.
18        $PS_DOT (2) - The pen is dotted. This style is valid only when the pen width is one or less in device units.
19        $PS_DASHDOT (3) - The pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units.
20        $PS_DASHDOTDOT (4) - The pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units.
21        $PS_NULL (5) - The pen is invisible.
22        $PS_INSIDEFRAME (6) - The pen is solid. When this pen is used in any GDI drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.
23        $PS_USERSTYLE (7) -
24        $PS_ALTERNATE (8) -
25$iWidth
26        Specifies the width of the pen, in logical units.
27$iColor
28        Specifies the color of the pen (BGR)
29@@End@@
30
31###ReturnValue###
32@@ReturnTable@@
33Success:        HPEN Value that identifies a logical pen
34Failure:        0
35@@End@@
36
37
38###Remarks###
39The pen can subsequently be selected into a device context and used to draw lines and curves.
40After an application creates a logical pen, it can select that pen into a device context by calling the <a href="_WinAPI_SelectObject.htm">_WinAPI_SelectObject()</a> function. After a pen is selected into a device context, it can be used to draw lines and curves.
41If the value specified by the $iWidth parameter is zero, a line drawn with the created pen always is a single pixel wide regardless of the current transformation.
42If the value specified by $iWidth is greater than 1, the $iPenStyle parameter must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME.
43When you no longer need the pen, call the DeleteObject function to delete it.
44
45
46###Related###
47_WinAPI_DeleteObject, _WinAPI_DrawLine, _WinAPI_GetBkMode, _WinAPI_LineTo, _WinAPI_MoveTo, _WinAPI_SelectObject, _WinAPI_SetBkMode
48
49
50###See Also###
51@@MsdnLink@@ CreatePen
52
53
54###Example###
55@@IncludeExample@@