.Net编程的多个小技巧
VS.Net IDE
如何改变region的颜色 字串4
通过工具 à 选项 à 环境 à 字体和颜色 à 可折叠文本设置
字串9
WinForm 字串7
1.如何使winForm不显示标题栏? 字串5
通过设置form的Text属性为空字符串,设置ControlBox属性为false
form1.Text = string. Empty; 字串1
form1.ControlBox = false;
字串2
2.使winform的窗体使用XP的风格 字串5
3.如何禁止form在工具栏显示
设置form的ShowInTaskbar属性为false即可
4.如何使程序打开默认的邮件程序并带有一些参数让用户开始写邮件 字串4
1)如果是web程序:
字串4
some text 字串4
2) 对于windows程序,需要使用System.Diagnostics.Process类
Process process = new Process();
process.StartInfo.FileName = "mailto:email@address1.com,email@address2.com?subject=Hello&cc=email@address3.com
&bcc=email@address4.com&body=Happy New Year" ; 字串4
process.Start();
如何创建类似msn提示窗口
字串8
需要获得通过Screen.GetWorkingArea(this).Width(Height)属性获得屏幕的大小,然后使用一个timer根据时间改变窗口的位置 字串3
Button控件 字串5
1.如何设置form的默认button(即在form上按下回车时触发的button)
可以设置form的AcceptButton属性:form1.AcceptButton = button1; 字串2
2. 如何设置form的取消button(即在用户按下Esc键时触发的button) 字串5
可以设置form的CancelButton属性:form1.CancelButton = buttonC;
字串7
3. 如何通过程序触发一个button的Click事件 字串2
Button1.PerformClick 字串5
Combo Box 字串3
1.如何使用可选字体填充Combo Box
comboBox1.Items.AddRange (FontFamily.Families);
TextBox
字串4
如何禁用TextBox的默认上下文菜单(右键菜单)
字串5
textBox1.ContextMenu = new ContextMenu(); 字串7
如何在TextBox获得焦点的时候,将焦点放在textBox文字的 字串4
textBox1.SelectionStart = textBox1.Text.Length;