目的:遮擋下面的窗體
最近在做一個(gè)大屏展示視頻圖片的項目,功能并不復雜,半天的工作量吧,一開(kāi)始同事采用的Unity3D進(jìn)行開(kāi)發(fā),但是里面要播放4K視頻,Unity 的短板就是視頻的播放了,今晚就要交付了,我一早就來(lái)公司,決定用WPF重新開(kāi)發(fā)一版,各項功能都好了,唯獨頂部總是顯示一條白色的邊,已經(jīng)設置WindowStyle為None了也沒(méi)用,幸得網(wǎng)上大神提供的資料,終于解決了這個(gè)小問(wèn)題。
XAML內容如下:
<Window x:Class="WPF_VideoPlayer.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPF_VideoPlayer" mc:Ignorable="d" Title="MainWindow" Height="350" Width="2880" Loaded="Window_Loaded" WindowChrome.WindowChrome="{DynamicResource WindowChromeKey}" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize" WindowState="Maximized" Topmost="True" Background="Black">
<Window.Resources> <WindowChrome x:Key="WindowChromeKey"> <WindowChrome.ResizeBorderThickness> <Thickness>0</Thickness> </WindowChrome.ResizeBorderThickness> </WindowChrome> </Window.Resources>
<Grid> </Grid></Window><Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" WindowStyle="None"> <Window.Background> <SolidColorBrush Opacity="0.5" Color="White"/> </Window.Background> <Grid> <Button Width="200" Height="50">button</Button> </Grid></Window>項目XAML:
<Window x:Class="WpfApp5.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp5" mc:Ignorable="d" Title="MainWindow" Height="1080" Width="1920" WindowChrome.WindowChrome="{DynamicResource WindowChromeKey}" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize" WindowState="Maximized" Topmost="True" > <Window.Resources> <WindowChrome x:Key="WindowChromeKey"> <WindowChrome.ResizeBorderThickness> <Thickness>0</Thickness> </WindowChrome.ResizeBorderThickness> </WindowChrome> </Window.Resources> <Window.Background> <SolidColorBrush Opacity="0" Color="White"/> </Window.Background> <!--<Grid ShowGridLines="True">--> <Grid > <Grid.RowDefinitions> <RowDefinition Height="50"></RowDefinition> <RowDefinition Height="395"></RowDefinition> <RowDefinition Height="402"></RowDefinition> <RowDefinition Height="186"></RowDefinition> <RowDefinition Height="49"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="540"/> <ColumnDefinition Width="398"/> <ColumnDefinition Width="508"/> <ColumnDefinition Width="833"/> </Grid.ColumnDefinitions> <Button Grid.Row="1" Grid.Column="0" Name="btn1" Content="實(shí) 時(shí) 圖 像" VerticalContentAlignment="Center" FontSize="40" FontFamily="Microsoft YaHei UI" Foreground="White" Background="#0850a0" Opacity="1"/> <Button Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Name="btn2" Content="截 取 圖 像" Foreground="White" VerticalContentAlignment="Center" FontSize="40" FontFamily="Microsoft YaHei UI" Background="#0850a0" Opacity="1"/> <Button Grid.Row="1" Grid.Column="3" Grid.RowSpan="2" Name="btn3" Background="#0850a0" Opacity="1"/> <Button Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Name="btn4" Background="#0850a0" Opacity="1"/> <Button Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="4" Name="btn5" Background="#0850a0" Opacity="1"/> </Grid></Window>
聯(lián)系客服