c# - Inverting color depending on the background windows and desktop -


i have transparent wpf window ( windowstyle="none" ) black label. need make label change color dynamically, depending on background of content below window (other windows, desktop), visible , contrast.

how can implemented? need make screenshot , read color values there or there way wpf tools?

will more difficult if label has gradient?

i don't suppose it's option make text of label have contrasting outline around letters?

you can sort of drop shadow type effect uses contrasting color make (for example), black text have white border.

<page   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">   <grid background="black">       <textblock text="this text" fontsize="24" margin="30" foreground="black" fontweight="bold">       <textblock.effect>         <dropshadoweffect shadowdepth="0" opacity="1" blurradius="4" color="white"/>       </textblock.effect>     </textblock>   </grid> </page> 

the drop shadow isn't defined, visible. code's not pretty, works. maybe else has better idea how work using built in effect or something.

<page   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">   <grid background="black">       <textblock text="this text" fontweight="bold" fontsize="24" margin="28,30" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="32,30" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="30,28" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="30,32" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="28,28" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="32,32" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="32,28" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="28,32" foreground="white" />     <textblock text="this text" fontweight="bold" fontsize="24" margin="30" foreground="black"></textblock>   </grid> </page> 

edit

msdn has info on creating outlined text using wpfs ability convert text geometries, or creating formatted text.


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -