[英]Transparent colors wpf
I have some Label control that sits on some image , and i want to give that control back ground Background="LightGray" but i also want it to be Transparent . 我有一些Label控件位于某个图像上,我想让控件返回地面Background =“LightGray”,但我也希望它是透明的。
of course i can do Background="Transperent" but then i want to have something like green + Transperent . 当然我可以做背景=“Transperent”,但后来我想要像绿色+ Transperent这样的东西。
Any idea how i do that ? 知道我是怎么做到的吗?
Thanks 谢谢
A Background property takes Brush instance. Background属性采用Brush实例。 If you analyze the Brush object you can see the first 2 byte is for the Alpha-transparency and the rest is RGB colors. 如果分析Brush对象,则可以看到前2个字节用于Alpha透明度,其余为RGB颜色。 Here if you change 'FF' (255) to '7F'(127) you get half opaque so adjust that value and get your desired one. 如果你将'FF'(255)更改为'7F'(127),你会得到半透明,所以调整该值并得到你想要的值。 I would recommend to use Expression Blend for this kind of editing. 我建议使用Expression Blend进行这种编辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.