C++ 中的渐变填充自定义绘图建造者XE
我借助下面的代码在 C++ Builder XE 中绘制了自定义绘图,但现在我想用渐变填充颜色填充它。
PaintBox1->Canvas->Pen->Color = RGB (187, 187, 187);
PaintBox1->Canvas->MoveTo(0, 8);
PaintBox1->Canvas->LineTo(10, 0);
PaintBox1->Canvas->LineTo(10, 5);
PaintBox1->Canvas->LineTo(21, 5);
PaintBox1->Canvas->MoveTo(0, 8);
PaintBox1->Canvas->LineTo(10, 15);
PaintBox1->Canvas->LineTo(10, 10);
PaintBox1->Canvas->LineTo(21, 10);
PaintBox1->Canvas->LineTo(21, 5);
I have drawn a custom drawing in C++ Builder XE with the help of the code below, but now I want to fill it with gradientfill color.
PaintBox1->Canvas->Pen->Color = RGB (187, 187, 187);
PaintBox1->Canvas->MoveTo(0, 8);
PaintBox1->Canvas->LineTo(10, 0);
PaintBox1->Canvas->LineTo(10, 5);
PaintBox1->Canvas->LineTo(21, 5);
PaintBox1->Canvas->MoveTo(0, 8);
PaintBox1->Canvas->LineTo(10, 15);
PaintBox1->Canvas->LineTo(10, 10);
PaintBox1->Canvas->LineTo(21, 10);
PaintBox1->Canvas->LineTo(21, 5);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用带有剪切区域的 GradientFillCanvas 可能是最简单的。请参阅以下链接:
http://docwiki.embarcadero.com/VCL/en/GraphUtil。 GradientFillCanvas
http://www.delphigroups.info/2/12/324143.html
所以你会这样做:
It would probably be easiest to use GradientFillCanvas with a clipping region. See the folowing links:
http://docwiki.embarcadero.com/VCL/en/GraphUtil.GradientFillCanvas
http://www.delphigroups.info/2/12/324143.html
So you would do something like: