2007년 4월 8일 일요일

GDI+ paint with gradient brush

void CGdiplusDemoView::OnDraw(CDC* pDC)
{
    Graphics g(pDC->m_hDC);

    LinearGradientBrush linearBrush(Point(50, 100), Point(250, 200), Color(255, 255 , 0, 0), Color(255, 0, 0, 255));
    g.FillRectangle(&linearBrush, 50, 100, 200, 100);

    GraphicsPath path;
    path.AddEllipse(300, 100, 200, 100);

    int count = 1;
    PathGradientBrush pathBrush(&path);
    pathBrush.SetCenterColor(Color(255, 255, 0, 0));
    pathBrush.SetSurroundColors(&Color(255, 255, 255, 0), &count);

    g.FillEllipse(&pathBrush, 300, 100, 200, 100);
}


댓글 없음: