窗口開啟居中
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;
}
<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;
}
相关文章推荐
- java实例化对象的过程
- 日期获取方式
- 图片预加载问题
- win8 &win10系统下Guest 帐号本地主机登录
- Windows Server 2008 R2 实现通过WEB方式修改域账号密码
- Glide 入门到精通之四——图片缩放和调整大小
- webservice的使用
- 用URL来操作Hadoop
- 怎么将多张图片合成一个PDF文件
- idea+maven+jetty+jfinal环境搭建
- skcatSgnisueueuQtnemelpmI.232
- 关于set想说的(二)之Set Demo
- 解决Fiddler "creation of the root certificate was not successful”的问题
- 跟着Google学Android —— 1.4 跳转吧!界面!
- 专治Xcode升级后插件失效的问题
- delphi 操作 TWebBrowser 实现自动填表(JQuery脚本与 OleVariant 方法)
- 2016网易笔试-查询互为好友
- windows下配置非安装版的MySQL5.6
- 【编辑器】【Sublime Text】使用笔记
- C++保留的关键字