| void CGdiexampleDlg::OnGradientBrush() { // TODO: Add your command handler code here CClientDC dc(this); CRect rect; GetClientRect(&rect); //創(chuàng )建Graphics對象 Graphics graphics(dc); //創(chuàng )建漸變畫(huà)刷 LinearGradientBrush lgb(Point(0, 0), Point(rect.right, rect.bottom), Color::Blue, Color::Green); //填充 graphics.FillRectangle(&lgb, 0, 0, rect.right, rect.bottom); } |
![]() 圖3 GDI+漸變畫(huà)刷 |
| void CGdiexampleDlg::OnCardinalSpline() { // TODO: Add your command handler code here CClientDC dc(this); //創(chuàng )建Graphics對象 Graphics graphics(dc); Point points[] = { Point(0, 0), Point(100, 200), Point(200, 0), Point(300, 200), Point(400, 00) }; //直接畫(huà)線(xiàn) for (int i = 0; i < 4; i++) { graphics.DrawLine(&Pen(Color::Blue, 3), points[i], points[i + 1]); } //利用基數樣條畫(huà)線(xiàn) graphics.DrawCurve(&Pen(Color::Red, 3), points, 5); } |
![]() 圖4 GDI+基數樣條 |
聯(lián)系客服