1, Static HPEN HPEN1, HPEN2, HPEN3;
HPEN1 = CREATEPEN (PS_SOLID, 1, 0); HPEN2 = Createpen (ps_solid, 3, RGB (255, 0, 0)); HPEN3 = Createpen (ps_dot, 0, 0);
SelectObject (HDC, HPEN2);
Delete the brush: During WM_DESTROY, delete the brush:
DeleteObject (HPEN1); 2, new brush and select the device handle SelectObject (HDC, Createpen (PS_DASH, 0, RGB (255, 0, 0)))); The brush handle, so you can use this handle to remove the brush-established brush DeleteObject (SelectObject (HDC, GetStockObject (Black_pen));
3, the principle is above HPEN = SELECTOBJECT (HDC, Createpen (ps_dash, 0, RGB (255, 0, 0))); deleteObject (SELECTOBJECT (HPEN));
Other: If there is a handle of a brush, you can get the value of each member of the LOGPEN structure by calling getObject:
GetObject (HPEN, SIZEOF (Logpen), (LPVOID) & logpen;
If you need the brush handle of the device content, you can:
HPEN = GetCurrentObject (HDC, OBJ_PEN);