随笔分类 -  Winform

C#批量操作控件
摘要:foreach (Control control inthis.groupBox2.Controls) { if(control is TextBox) { if(control.Name !="text_JSBS") { control.Text ="0.00"; } } }以上代码是批量 修改 groupbox2里面的TextBox值 阅读全文
posted @ 2012-04-07 23:06 魔_君 阅读(674) 评论(0) 推荐(0)
常用C#加密解密方法
摘要:1、方法一(不可逆加密)publicstringEncryptPassword(stringPasswordString,stringPasswordFormat){stringencryptPassword=null;if(PasswordFormat="SHA1"){encryptPassword=FormsAuthortication.HashPasswordForStoringInConfigFile(PasswordString,"SHA1");}elseif(PasswordFormat="MD5"){encryptPas 阅读全文
posted @ 2012-03-28 16:51 魔_君 阅读(435) 评论(0) 推荐(0)
C# winform动态添加控件实例
摘要:代码很简单!如下,相信大家都看得懂的!它的属性防就像在VS里面编写的属性一样的赋值上去就行了! private void button1_Click(object sender, EventArgs e) { CheckBox cb = new CheckBox(); cb.Parent = this; cb.Text = "动态添加控件"; }代码短小精悍! 阅读全文
posted @ 2012-03-28 16:17 魔_君 阅读(1318) 评论(1) 推荐(0)
窗体淡入淡出效果2
摘要:using System.Runtime.InteropServices;public class Win32 { public const Int32 AW_HOR_POSITIVE = 0x00000001; // 从左到右打开窗口 public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 从右到左打开窗口 public const Int32 AW_VER_POSITIVE = 0x00000004; // 从上到下打开窗口 public const Int32 AW_VER_NEGATIVE = 0x00000008; // 从下到上打开窗 阅读全文
posted @ 2012-03-28 10:15 魔_君 阅读(224) 评论(0) 推荐(0)
关闭主窗口,启动另一个窗口
摘要://按钮启动第二个窗口 private void button1_Click(object sender, EventArgs e) { //另起一个线程启动第二个窗口 new Thread(showF2).Start(); this.Close(); } //启动第二个窗口的方法 void showF2() { Form2 f2 = new Form2(); //这句很重要,不能用f2.Show(); Application.Run(f2); }转自:http://www.cnblogs.com/ghypnus/archive/2012/03/25/2416541.html 阅读全文
posted @ 2012-03-25 16:04 魔_君 阅读(177) 评论(0) 推荐(0)
C#窗体渐变特效
摘要:打开程序后,窗体由透明到不透明逐渐显示出来。实现方法:1. 添加一个Timer控件(此例中命名为:fadeTimer),然后在其Tick事件中添加FadeTimer_Tick中的相关代码即可,简单吧,呵呵。在该窗体类的构造函数里面添加如下代码: 1 private bool showing = true; 2 public LoginForm() 3 { 4 InitializeComponent(); 5 6 //窗体显示特效 7 Opacity = 0.0; //窗体透明度为0 8 fadeTimer.Start(); //计时开始 9 }复制代码2. Tick事件:添加... 阅读全文
posted @ 2012-03-23 21:47 魔_君 阅读(386) 评论(0) 推荐(0)