摘要:创建 Windows 窗体的实例时,收到一个 system.threading.ThreadStateException 异常
阅读全文
文章分类 - WinForm_C#
摘要:Application.Run(new Form1())窗口Form1.Hide的问题
阅读全文
摘要:C#中如何发送组合键,以及判断发送的是否为组合键。
阅读全文
摘要:发布日期: 2006-06-30 | 更新日期: 2006-07-04 作者:郑佐 适用于: Windows 操作系统 .NET Framework 1.x,2.0运行时环境 .NET Windows开发 摘要:本文阐述了在基于.NET平台的应用程序开发中如何实现唯一应用程序运行实例,对几种实现方式进行分析测试比较,从而寻找一种合适的处理方式。单击此处才查看本文的示例代码。 内容索引 概述...
阅读全文
摘要:注:API函数GetForegroundWindow用来获得前台窗口的句柄,这里的“前台窗口”是指前台应用程序的活动窗口 类ForegroundWindow继承了框架提供的IWin32Window接口,并定义了一个静态的IWin32Window属性Instance,用来获得前台窗口的句柄。 public class ForegroundWindow : IWin32Window { priv...
阅读全文
摘要:OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = System.Windows.Forms.Application.StartupPath ; // ofd.Filter = "Microsoft Excel files (*.xls)|*.xls|CSV files (*.csv)|*.csv|All ...
阅读全文
摘要:首先我们有2个Windows Form,主窗体叫Form1,子窗体叫ChildForm。在主窗体中加入一Menu,用来实例化子窗体,我们在Form1.cs中写入下代码: private static ChildForm childForm; //静态变量,保存唯一实例 private void menuItem2_Click(object sender, System.EventArgs e) {...
阅读全文