标签:
1 设置窗体的最大化,而且无边框
1 <Style x:Key="WindowsStyle" TargetType="Window"> 2 <Setter Property="Height" Value="1024"></Setter> 3 <Setter Property="Width" Value="1280"></Setter> 4 <Setter Property="WindowStyle" Value="None"></Setter> 5 <Setter Property="WindowState" Value="Maximized"></Setter> 6 </Style>
2 设置按钮的透明,无边框
1 <Style x:Key="ButtonStyle" TargetType="Button"> 2 <Setter Property="Background" Value="Transparent"></Setter> 3 <Setter Property="BorderBrush" Value="Transparent"></Setter> 4 </Style>
3, 添加样式
1 <Window x:Class="ZhiHeng.IntelligentExpress.WpfUI.Views.MainForm" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Title="MainForm" Style="{StaticResource WindowsStyle}" > 5 <Canvas> 6 7 <Button Canvas.Left="121" Name="btnReturnShipment" Canvas.Top="887" Height="108" Width="86" Style="{StaticResource ButtonStyle}" /> 8 </Canvas> 9 10 </Window>
4 设置程序的启动项
首先在appliaction.xmal文件中修改StartupURL为Startup=‘AppLicationStart‘(AppLicationStart为事件名称,可随便定义)
然后在cs 文件中定义事件
1 private void AppLicationStart(object sender, StartupEventArgs e) 2 { 3 //加入自己的逻辑 4 MainForm main = new MainForm(); 5 main.Show(); 6 }
5 获得用户控件所在的窗体
1 Window win= Window.GetWindow(this);
标签:
原文地址:http://www.cnblogs.com/ztb123/p/4565108.html