VS2008,GDIPlus初步 | 您所在的位置:网站首页 › newhomeimage/step6.png › VS2008,GDIPlus初步 |
//shutdown GDI+ Gdiplus::GdiplusShutdown(gdiplusToken); step5.在void CAboutDlg::OnPaint()举个GDI+绘制的例子 void CAboutDlg::OnPaint(){ CPaintDC dc(this); // device context for painting Graphics graphics(dc.GetSafeHdc()); //Graphics graphics(dc.m_hDC);也可以 CRect rect; GetDlgItem(IDC_STATIC_FRAME)->GetWindowRect(&rect); //IDC_STATIC_FRAME是个picture控件,visible=false ScreenToClient(&rect); //Brush Gdiplus::LinearGradientBrush lingrbrush(Gdiplus::Rect(rect.left, rect.top, rect.Width(), rect.Height()), // 绘制区域 Color(250, 248,242,240), // 第一种颜色 Color(250, 255,255,255), // 第二种颜色 (Gdiplus::REAL)(270)); // 渐变色的角度 graphics.FillRectangle(&lingrbrush, Gdiplus::Rect(rect.left,rect.top,rect.Width(),rect.Height() ) ); Gdiplus::Pen pen(Color(255,145,155,156)); Gdiplus::Pen penshade(Color(100,145,155,156)); graphics.DrawRectangle(&pen,Gdiplus::Rect(rect.left,rect.top,rect.Width(),rect.Height())); graphics.DrawRectangle(&penshade,Gdiplus::Rect(rect.left,rect.top,rect.Width()+1,rect.Height()+1)); // 不为绘图消息调用 CDialog::OnPaint()} |
CopyRight 2018-2019 实验室设备网 版权所有 |