這篇文章來自是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.ContextMenu = new ContextMenu ();
8. 如何獲取“我的文檔”等一些系統文件夾路徑?(How to get the path for "My Documents " and other system folders?