VC form non-client area drawing

Source: Internet
Author: User

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); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.