简体   繁体   中英

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 .

of course i can do Background="Transperent" but then i want to have something like green + Transperent .

Any idea how i do that ?

Thanks

You're looking for the Opacity property of your brush. That should give you the semi-transparency you're looking for.

A Background property takes Brush instance. If you analyze the Brush object you can see the first 2 byte is for the Alpha-transparency and the rest is RGB colors. Here if you change 'FF' (255) to '7F'(127) you get half opaque so adjust that value and get your desired one. I would recommend to use Expression Blend for this kind of editing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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