您的位置:首页 > 其它

窗口開啟居中

2016-03-23 11:07 295 查看
第一種方法:在xaml中設定

<Window x:Class="WpfApplication1.Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Title="測試窗口開啟位置" Height="400" Width="800" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">

第二種方法:在Window_Loaded中設定

private void Window_Loaded(object sender, RoutedEventArgs e)

{

this.Width = 1024.00;

this.Height = 728.00;

//this.Left = 600;

this.Top=0;

WindowStartupLocation = WindowStartupLocation.CenterScreen;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: