cod*_*rix 4 .net vb.net wpf wpf-controls
我有一个带有白色背景图像的按钮.我的按钮位于工具栏上,其颜色为蓝色.当按钮位于工具栏上时,按钮看起来是白色的,但我希望它看起来像蓝色,因为工具栏的背景颜色是蓝色.
我应该如何在WPF中实现这一点..请告诉我.
您确定要使用图像吗?如果图像只是纯色,那么将按钮的背景设置为白色并调整其不透明度可能会更好.喜欢:
<Button Background="White" Opacity="0.5" />
Run Code Online (Sandbox Code Playgroud)
其中Opacity可以是0到1之间的任何值.
编辑:我不确定你的意思是"阴影".您是否知道可以将Button的背景设置为渐变?你想要改变我确定的颜色,但它看起来像这样:
<Button>
<Button.Background>
<LinearGradientBrush>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush>
<Button.Background>
</Button>
Run Code Online (Sandbox Code Playgroud)