WPF学习之启动窗体设置
来源:互联网 发布:报纸数据库 编辑:程序博客网 时间:2024/05/22 01:53
WPF与传统的windows页面程序类似,但也有一些区别:
启动页:
方法一:
在App.xaml文件中修改StartupUri的值。
方法二:在App.xaml.cs 后台代码中声明Main()方法、
[STAThread]
static void Main()
{
Window2 win = new Window2();
Application app = new Application();
app.Run(win);
}
方法三:
[STAThread]
static void Main()
{
Window2 win = new Window2();
Application app = new Application();
app.MainWindow = win; win.Show();
app.Run();
}
方法四:
[STAThread]
static void Main()
{
Application app = new Application();
app.StartupUri = new Uri("Window2.xaml", UriKind.Relative);
app.Run();
}
在窗体window1.xaml中:
<Window x:Class="Demo_1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window with button" Height="300" Width="300">
<Button Name="button" Click="button_Click">click me</Button>
</Window>
其中:x:Class="Demo_1.Window1"指明了要与后台代码相关联的类,button的事件用特性语法注明了单击事件。
- WPF学习之启动窗体设置
- WPF学习之启动窗体设置
- wpf中窗体设置
- WPF之自定义窗体
- WPF之自定义窗体
- WPF之自定义窗体
- WPF之窗体追踪
- 设置WPF窗体全屏显示:
- WPF 设置类库项目为启动项,设置窗体跟随。
- WPF学习之【事件,命令和设置】
- c#设置启动窗体
- WPF 动态更改启动窗体startupUri
- 在winform程序中启动wpf窗体
- 在winform程序中启动wpf窗体
- wpf设置窗体边框为无边框
- WPF设置Dialog的父窗体方法
- WPF中设置窗体不平铺背景图
- WPF Application启动界面设置
- php获取正确的当前时间
- hdu 1086 You can Solve a Geometry Problem too 线段相交
- 非天然的链接的分析
- Easy Binary Compatible Interfaces Across Compilers in C++
- STL概述
- WPF学习之启动窗体设置
- ORACLE 触发器实现主键自动填充
- POJ 3259 Wormholes
- 黑马程序员—java—IO流
- 实现JavaBean和json之间的相互转换
- android自定义布局中的平滑移动
- Ubuntu 13.04 – Install Jetty 9
- poj 2226 Muddy Fields(二分图)
- Exception:线程间操作无效: 从不是创建控件的线程访问它 解决方案