WPF:没有渐变的RadialGradientBrush?
我想在另一个圆圈中画一些圆圈,如下所示:
alt text http ://img38.imageshack.us/img38/6379/circles.png
有没有办法告诉 RadialGradientBrush 不要使用渐变而只使用固定颜色,这样我就可以实现这一点?感谢您的任何提示!
(我想这可以使用 DrawingBrush 轻松完成,我只是想知道这是否也可以使用 RadialGradientBrush 完成)
I want to draw some circles in another circle like this:
alt text http://img38.imageshack.us/img38/6379/circles.png
Is there a way to tell a RadialGradientBrush not to use gradients but just fixed colors, so I can achieve this? Thanks for any hint!
(I guess this could be easily done using a DrawingBrush, I'm just wondering whether this could also be done using a RadialGradientBrush)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您真的非常想这样做,您可以按照您想要的偏移量重复您想要的颜色。
例如:
这样,它将从 0 到 0.25 填充黑色到黑色,从 0.25 到 0.75 填充红色到红色,从 0.75 到 1.0 填充鲑鱼到鲑鱼。
由于偏移匹配,因此没有“空间”供渐变混合。
If you really, really want to do this, you can repeat the colors that you want at the offsets that you want.
For example:
That way, it will fill Black to Black from 0 to 0.25, Red to Red from 0.25 to 0.75, and Salmon to Salmon from 0.75 to 1.0.
Since the offsets match, there is no "room" for the Gradient to blend.
如果您尝试制作绝对尺寸的“靶心”,请考虑在网格中叠加椭圆,而不是尝试使用画笔。
由于它们都在同一个网格中(默认情况下列和行都是 0,但您可以设置它们),并且将它们的水平和垂直对齐设置为拉伸,因此它们只会重叠。当然,一定要把最大的放在第一位。
If you are trying to make a "bullseye" of absolute sizes, consider overlaying Ellipses in a grid instead of trying to use a brush.
Since they are all in the same grid (column and row are both 0 by default, but you could set them), and have their horizontal and vertical alignments set to stretch, they will simply overlap. Be sure to put the biggest one first, of course.