using System;
using System.Windows;
using System.Windows.Interop; // WindowInteropHelper
namespace WindowsApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : System.Windows.Window
{
public Window1()
{
try
{
InitializeComponent();
this.SourceInitialized += new EventHandler(Window1_SourceInitialized);
}
catch(Exception exp)
{
string str = exp.Message;
}
}
void Window1_SourceInitialized(object sender, EventArgs e)
{
WindowInteropHelper helper = new WindowInteropHelper(this);
IntPtr ptr = helper.Handle;
}
//private void ClickBtn(object sender, EventArgs e)
//{
//}
}
}
using System.Windows;
using System.Windows.Interop; // WindowInteropHelper
namespace WindowsApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : System.Windows.Window
{
public Window1()
{
try
{
InitializeComponent();
this.SourceInitialized += new EventHandler(Window1_SourceInitialized);
}
catch(Exception exp)
{
string str = exp.Message;
}
}
void Window1_SourceInitialized(object sender, EventArgs e)
{
WindowInteropHelper helper = new WindowInteropHelper(this);
IntPtr ptr = helper.Handle;
}
//private void ClickBtn(object sender, EventArgs e)
//{
//}
}
}
本文介绍了一个使用WPF框架创建窗口应用的示例代码,展示了如何初始化窗口及处理源初始化事件。
998

被折叠的 条评论
为什么被折叠?



