Polygon window
Wenyi
When you are tired of the rectangular window, do you want to change your shape of your window? It is very simple to do.
Generate a CRGN object and call int CWnd :: setWindowRgn (HRGN HRGN, BOOL BREDRAW);
The specific method will be described below:
In the window of the window (window must be WS_POPUP style, the other I didn't tried) The following code will create a triangular window.
INT CTW :: OnCreate (LPCreateStruct LpCreatestruct) {if (CWnd :: OnCreate (lpcreateStructure) == -1) Return -1; POINT PT [3]; PT [0] .x = 100; Pt [0] .y = 20; Pt [1] .x = 0; Pt [1]. Y = 150; PT [2] .x = 180; PT [2]. Y = 150; M_Rgn.createPolygonRGN (PT, 3, WINDING); SetWindowRgn (m_RGN, 1); // Todo: add your specialized code code here return 0;}
CWnd :: getWindowRGN (...) will tell you whether the polygon is a separate rectangle via the return value. Note that the RGN coordinates are zero coordinates with a rectangle of the original window rather than the screen coordinates as zero coordinates. You can use crgn :: combinergn (...) to form a plurality of RGNs to form their own shape.