前段時間在研究winform如何繪制半透明的窗體,要達到預期的效果很是麻煩,用WPF就簡單多了
先來看看效果:
實現
windows1.xaml
<Window x:Class="JStore.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> <Grid> <Border CornerRadius="0,0,0,0" Background="White" BorderBrush="Gray" BorderThickness="1" Margin="10,10,10,10"> <Border.Effect> <DropShadowEffect Color="Gray" BlurRadius="10" ShadowDepth="0" Opacity="0.8" /> </Border.Effect> </Border> </Grid> </Window>