如何使用Linear Gradient创建文本?

时间:2013-11-03 22:13:59

标签: c++ winapi

创建LinearGradientBrush

LinearGradientBrush linGrBrush(
        Point(0, 10),
        Point(200, 10),
        Color(255, 255, 0, 0),   
        Color(255, 0, 0, 255)
);

如何使用此渐变绘制文本?

1 个答案:

答案 0 :(得分:1)

LinearGradientBrush *linGrBrush=new LinearGradientBrush(
        Point(0, 10),
        Point(200, 10),
        Color(255, 255, 0, 0),   
        Color(255, 0, 0, 255));

    Graphics *graphics=new Graphics(hdc);
     PointF drawPoint = PointF(150.0F,150.0F);
     SolidBrush* myBrush = new SolidBrush(Color::Black);
    graphics->DrawString(L"Test text",strlen("Test text"),fn,drawPoint,linGrBrush);