摘要: 以前对WinForm窗体显示和窗体间传值了解不是很清楚最近做了一些WinForm开发,把用到的相关知识整理如下A.WinForm中窗体显示显示窗体可以有以下2种方法:Form.ShowDialog方法 (窗体显示为模式窗体)Form.Show方法 (窗体显示为无模式窗体) 2者具体区别如下:1.在调用Form.Show方法后,Show方法后面的代码会立即执行2.在调用Form.ShowDialog方法后,直到关闭对话框后,才执行此方法后面的代码3.当窗体显示为模式窗体时,单击“关闭”按钮会隐藏窗体,并将DialogResult属性设置为DialogResult.Cancel 与无模式窗体不同. 阅读全文
posted @ 2011-10-31 10:39 心_远 阅读(212) 评论(0) 推荐(0) 编辑
摘要: public MainFm(HttpClient httpClient) { InitializeComponent(); Init_GlobalSetting.sskID = SmsClass.Get123(); Sunisoft.IrisSkin.SkinEngine skin = new Sunisoft.IrisSkin.SkinEngine(); skin.SkinFile = System.Environment.CurrentDirectory + "\\s... 阅读全文
posted @ 2011-10-28 14:18 心_远 阅读(309) 评论(0) 推荐(0) 编辑
摘要: string str = @"C:\Program Files\Internet Explorer\IEXPLORE.EXE"; System.Diagnostics.Process.Start(str, Init_GlobalSetting.wwwAddress + "MessageSend2.asp"); 阅读全文
posted @ 2011-10-27 15:08 心_远 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 让你的窗体有打开和关闭的时候淡入淡出。很酷的Style,是不是有点像Windows Vista。protected override void OnClosing(System.ComponentModel.CancelEventArgs e){ while (Opacity > 0.5f) { Opacity -= 0.05f; System.Windows.Forms.Application.DoEvents(); Thread.Sleep(75); } base.OnClosing(e);} 阅读全文
posted @ 2011-10-27 11:43 心_远 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 我将通过本文向大家介绍添加"窗口关闭的提示"的恰当做法。在程序运行时,可以通过点击右上角的红叉,关闭一个窗体;也可以通过调用窗体的Close()方法关闭窗体。如果想在窗体关闭前向用户提供一个提示框,防止重要信息未被保存就关闭,大家会怎么做呢?很多人会想到在调用Close前加入信息框代码。但这个做法是不完美的,因为Close方法是被调用的,你不知道Close在会何处调用,而且你不可能到处都写信息框语句。正确的做法却不是调用Close之前,而是调用Close"之后"正确的做法是处理Form的FormClosing事件:public delegate void 阅读全文
posted @ 2011-10-27 11:34 心_远 阅读(714) 评论(0) 推荐(0) 编辑
摘要: ///<summary> /// 添加启动项到注册表 ///</summary> void RegAdd() { string FullPathFile = Application.ExecutablePath; //获取带全路径的本程序 Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true).SetValue("Fast2011", FullPathFil... 阅读全文
posted @ 2011-10-25 18:10 心_远 阅读(244) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Windows.Forms;using Zone;using System.Diagnostics;using System.Reflection;using System.Runtime.InteropServices;namespace SmsSend{ static class Program { private const int WS_SHOWNORMAL = 1; [DllImport("User32.dll")] ... 阅读全文
posted @ 2011-10-25 18:03 心_远 阅读(322) 评论(0) 推荐(0) 编辑
摘要: static class Program{internal static ApplicationContext context = new ApplicationContext(new Form1());///<summary>/// 应用程序的主入口点。///</summary>[STAThread]static void Main(){Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); 这句要注释掉,否则会出错Application.Run 阅读全文
posted @ 2011-10-25 17:55 心_远 阅读(637) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Windows.Forms;using System.Diagnostics;//引入Process 类using System.Reflection;//引入Assemblyusing System.Runtime.InteropServices; //需要获取句柄,激活前一实例using System.Threading;//需要用到mutexnamespace fasta2011{ static class Program { /// <sum... 阅读全文
posted @ 2011-10-25 17:48 心_远 阅读(175) 评论(0) 推荐(0) 编辑