我使用WPF(c#)窗體與背景圖像(背景圖像刷)。使窗體半透明,以查看窗體的背景圖像
我要讓所有的UI元素(按鈕,標題,文本框)...所以他們不完全覆蓋的圖像,
但背景圖像仍然可見(不變成半透明半透明)
我想我們可以做到這一點,而不必設置UI元素的所有不透明值。
我使用WPF(c#)窗體與背景圖像(背景圖像刷)。使窗體半透明,以查看窗體的背景圖像
我要讓所有的UI元素(按鈕,標題,文本框)...所以他們不完全覆蓋的圖像,
但背景圖像仍然可見(不變成半透明半透明)
我想我們可以做到這一點,而不必設置UI元素的所有不透明值。
也許這可以幫助
<Window.Resources>
<Style x:Key="transparentControls" TargetType="Button">
<Setter Property="Opacity" Value="0.1"/>
<Setter Property="Background" Value="Green"/>
</Style>
</Window.Resources>
<Grid>
<Grid.Background>
<ImageBrush ImageSource="MyImage.jpg"/>
</Grid.Background>
<Button Height="24" Width="100" Style="{StaticResource transparentControls}" VerticalAlignment="Top" Content="Hey"/>
<Button Height="24" Width="100" Style="{StaticResource transparentControls}" Content="There"/>
<Button Height="24" Width="100" Style="{StaticResource transparentControls}" VerticalAlignment="Bottom" Content="Click Me"/>
</Grid>
非常感謝你,我會嘗試它 – mtrcol
謝謝你的幫助,我看到 – mtrcol