简体   繁体   English

在Delphi 7中在画布上绘制圆扇形的渐变

[英]Drawing gradient of sector of circle on canvas in Delphi 7

I drawing a circular progress control in Delphi 7 and I have a problem. 我在Delphi 7中绘制了一个圆形进度控件,但遇到了问题。 How I should draw sector of the circle with gradient of two colors (one color starts and another ends)? 我应该如何用两种颜色(一种颜色开始而另一种结束)的渐变绘制圆的扇形? I use the pie function for draw a circle sector. 我使用pie函数绘制一个圆形扇区。

Do you have any ideas? 你有什么想法?

Thanks, Serge. 谢谢,谢尔格。

Just as a starting point (the approach is not universal): you could take a ready-made gradiented circle image and draw a sector with TCanvas.Pie over it. 只是作为一个起点(这种方法并不通用):您可以拍摄现成的渐变圆形图像,并使用TCanvas.Pie在其上绘制一个扇区。

The sector should be centered the same as the circle, of course, and its color is supposed to be the same as the background color, so effectively you will be hiding part of the circle, leaving a gradiented sector visible. 当然,扇形的中心应该与圆相同,并且其颜色应该与背景颜色相同,因此有效地,您将隐藏圆的一部分,使渐变的扇形可见。

Of course, it will not work out for an arbitrary background... 当然,在任意背景下都无法解决问题...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM