The
VC form is drawn onncpaint (UINT message, WPARAM WPARAM, LPARAM LPARAM) for non-client areas.
void Cskinandlangdlg::onncpaint (UINT message, WPARAM WPARAM, LPARAM LPARAM) {HDC WINDOWDC =:: GETWINDOWDC (m_hwnd
);
Gets the entire form rectangle RECT windowrect;
GetWindowRect (&windowrect);
Offsetrect (&windowrect,-windowrect.left,-windowrect.top);
Gets the client area rectangle and excludes from WINDOWDC//RECT clientrect;
GetClientRect (&clientrect);
Offsetrect (&clientrect, borderLeftWidth, bordertopheight);
Excludecliprect (WINDOWDC, Clientrect.left, Clientrect.top, Clientrect.right, Clientrect.bottom);
Form width and height//int width, height;
width = windowrect.right;
More Highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/vc///height = Windowrect.bottom;
Fill background//Bitmap bmp (width, height);
graphics* g = graphics::fromimage (&bmp);
SolidBrush SBR (Color (255,120,120,120));
G->fillrectangle (&sbr, 0, 0, width, height);
Image *pimage = NULL; Skinapp.loadpng (1, (void*&) pimage);
G->drawimage (pimage, 0, 0);
int x_ctrbox = width-ctrboxwidth-5;
int y_ctrbox = 0;
Pen Pen (Color (255,128,128,128), 1);
G->drawrectangle (&pen, X_ctrbox, Y_ctrbox, Ctrboxwidth, ctrboxheight); Minimize the button//pen.
SetWidth (2); G->drawline (&pen, X_ctrbox + 3, Y_ctrbox + CTRBOXHEIGHT/2,//X_ctrbox + CTRBOXWIDTH/3-3, Y_ctrbox
+ CTRBOXHEIGHT/2); Maximize button//G->drawline (&pen,//X_ctrbox + Ctrboxwidth + 3,//Y_ctrbox + 5,//Ctrboxwid
TH/3-6,//CTRBOXWIDTH/3-6); Close button//G->drawline (&pen,//X_ctrbox + CTRBOXWIDTH/3 * 2 + 3,//Y_ctrbox + 3,//X_
Ctrbox + CtrBoxWidth-3,//Y_ctrbox + CtrBoxHeight-3); G->drawline (&pen,//X_ctrbox + CtrBoxWidth-3,//Y_ctrbox + 3,//X_ctrbox + CTRBOXWI
DTH/3 * 2 + 3,//Y_ctrbox + CtrBoxHeight-3);
Graphics G2 (WINDOWDC);
SolidBrush SBR (Color (255,120,120,120)); Left border G2.
FillRectangle (&SBR, 0, Bordertopheight, borderLeftWidth, Windowrect.bottom); The right border G2. FillRectangle (&SBR, Windowrect.right-borderleftwidth, Bordertopheight, Windowrect.right-borderleftwidth,
Windowrect.bottom); The bottom border is G2.
FillRectangle (&SBR, 0, Windowrect.bottom-borderleftwidth, Windowrect.right, Windowrect.bottom);
Image *pimage = NULL;
Cdefaultskinapp::loadpng (1, (void*&) pimage);
Image *pimg = Pimage->getthumbnailimage (windowrect.right, bordertopheight, NULL, NULL);
TRACE (_t ("windowrect.right =%d\n"), windowrect.right); G2.
DrawImage (pimg, 0, 0, pimg->getwidth (), Pimg->getheight ());
Delete pimg;
:: ReleaseDC (M_hwnd, WINDOWDC); }