wpf中有MergedGradientBrush吗?
假设我有两把刷子。
一个是从暗到亮的线性渐变画笔
一种是从深色到浅色的放射状画笔。
如何合并画笔,以便在应用它们时可以同时应用两者。
EG 检查这个:
1) http://www.codeproject.com/KB/vista/WindowsVistaRenderer/ VistaRenderer4.gif
2) http://www.codeproject.com/KB/vista/WindowsVistaRenderer/ VistaRenderer5.gif
我如何(在 WPF/XAML 中)将两者合并为一个渐变,然后引用它? (这是 Menendez 先生来自 Codeproject 的图片)
Suppose I had two brushes.
One that was a linear gradient brush that was from Dark to light
One was a radial brush that went from Dark to light.
How could I merge the brushes so that when I apply them, I can apply both at once.
EG Check this:
1) http://www.codeproject.com/KB/vista/WindowsVistaRenderer/VistaRenderer4.gif
2) http://www.codeproject.com/KB/vista/WindowsVistaRenderer/VistaRenderer5.gif
How could I (In WPF/XAML) merge both into one gradient and then refer to that?
(This is Mr. Menendez's Images from Codeproject)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之,没有办法将两个不同的渐变画笔“合并”为一个。但是,有一些解决方法可以帮助您完成工作。例如,您可以创建两个重叠的
Border
元素(使用Grid
),一个使用线性画笔,另一个使用渐变画笔。然后,您可以将画笔中每种颜色的 Alpha 分量设置为 50% 透明度。通过这种方式,画笔将被渲染在另一个之上,但两者都会显示得同样好。Short answer, there is no way to "merge" two different gradient brushes into one. However, there are workarounds that will get the job done for you. You could, for example, create two overlaid
Border
elements (using aGrid
), one with the linear brush and the other with the gradient brush. You could then set the alpha component of each of the colors in the brushes to 50% transparency. In that manner, the brushes would be rendered one on top of the other, but both would show up equally well.