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)建漸變畫刷 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+漸變畫刷 |
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) }; //直接畫線 for (int i = 0; i < 4; i++) { graphics.DrawLine(&Pen(Color::Blue, 3), points[i], points[i + 1]); } //利用基數(shù)樣條畫線 graphics.DrawCurve(&Pen(Color::Red, 3), points, 5); } |
![]() 圖4 GDI+基數(shù)樣條 |