您的位置:首页 > 其它

NET开发中的一些小技巧

2006-11-20 12:53 330 查看
这篇文章来自是Mukund Pujari的《Some Cool Tips for .NET》。

1. 如何创建一个可改变大小没有标题栏的窗体?(How to create a form with resizing borders and no title bar?)

form1.Text = string. Empty;

form1.ControlBox = false;

2. 如何在.NET的Windows窗体上启用XP主题集?(How to use XP Themes with Windows Forms using the .NET?)

确认你的控件中FlatStyle属性已经修改为System,再修改Main方法。

static void Main()

{

Application.EnableVisualStyles();

Application.DoEvents();

Application. Run(new Form1());

}

3. 如何为一个窗体设置一个默认按钮?(How to set the default button for a form?)

form1.AcceptButton = button1;

4. 如何为一个窗体设置一个取消按钮?(How to set the Cancel button for a form?)

form1.CancelButton = button1;

5. 如何阻止一个窗体标题显示在任务栏上?(How to prevent a form from being shown in the taskbar?)

设置窗体的ShowIntaskbar属性为False

6. 如何用现有可用字体绑定到ComboBox控件?(How to fill a ComboBox with the available fonts?)

comboBox1.Items.AddRange (FontFamily.Families);

7. 如何禁止TextBox控件默认的邮件菜单?(How to disable the default ContextMenu of a TextBox?)

textBox1.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: