我想制作一个带有填充颜色的箭头 所以我创建了一个grahics路径并调用绘制填充
Brush *brush=new SolidBrush(Color::Blue);
Pen *myPen1 = new Pen(Color::Red, 2);
GraphicsPath *cappath=new GraphicsPath;
cappath->AddLine(-5,0,5,0);
cappath->AddLine(-5,0,0,5);
cappath->AddLine(0,5,5,0);
graphics.FillPath(brush,cappath);
CustomLineCap path(NULL,cappath);
myPen1->SetCustomEndCap(&path);
但是它会在原点附近创建一条蓝色路径。如何在帽子中填充蓝色
答案 0 :(得分:0)
GDI只能正确填充封闭的凸多边形
我不知道GDI +
黑色是您当前的代码,绿色是封闭的凸多边形
cappath->AddLine( 5,0,-5,0);
cappath->AddLine(-5,0, 0,5);
cappath->AddLine( 0,5, 5,0);
如果它不起作用,请尝试找到如何将路径添加到路径而不是行
[注释]