2
A
回答
5
的
Font
屬性是一個環境屬性。環境屬性是一個控制屬性,如果未設置,則從父控件中檢索。例如,缺省情況下,Button
將與其父母Form
具有相同的BackColor
。有關環境屬性的更多信息,請參閱AmbientProperties
類或Control
類概述。
換句話說,它聽起來像它的行爲完全符合記錄。如果您希望它使用比窗體的字體字體其他,請明確設置該屬性。
4
我遇到了同樣的問題,我在窗體上有一個默認的字體,但我想DataGridView
有不同的字體。
你可以通過放置一個Load事件來改變字體。
private void Form1_Load(object sender, System.EventArgs e)
{
// set to your font you want.
this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 15);
}
或地方GroupBox
內的DataGridView
並設置GroupBox
到我想要的字體 - 此修復程序是醜陋的,但它的工作原理。
相關問題
- 1. Windows窗體(C#):DataGridView的System.IndexOutOfRangeException
- 2. WPF DataGrid與Windows窗體DataGridView
- 3. 在Windows窗體刷新DataGridView
- 4. C#DataGridView和Windows窗體
- 5. Windows窗體DataGridView滾動
- 6. 爲什麼我的windows窗體關閉?
- 7. 使用C#的Windows窗體中的DataGridView
- 8. 爲什麼windows窗體沒有關閉
- 9. windows使用什麼字體作爲contextmenu?
- 10. Windows窗體中的DataGridView中的UserControl
- 11. Windows窗體 - 驗證DataGridView的輸入
- 12. 動態綁定Windows窗體中的DataGridView
- 13. Windows窗體:DataGridView中的額外列
- 14. 不排序的Windows窗體DataGridView
- 15. 什麼是Windows窗體的基類?
- 16. 爲什麼Windows LookAndFeel使字體太小?
- 17. Windows窗體/ DatagridView屏幕閃爍
- 18. Windows窗體DataGridView自動調整
- 19. Windows窗體:DataGridView綁定問題
- 20. Windows窗體DataGridView快速加載
- 21. 爲什麼DataGridView沒有屬性? (C#Windows窗體,微軟Visual Studio 2008)
- 22. 在Windows窗體中的字體繼承
- 23. Windows窗體的字體問題2
- 24. C++ windows窗體中的字體渲染
- 25. 爲什麼在Windows窗體中的C++應用程序
- 26. Windows窗體 - 從父窗體
- 27. Windows窗體 - 在主窗體
- 28. 爲什麼VB6.0窗體顯示爲C#窗體?
- 29. 轉換Windows窗體到Windows Metro窗體
- 30. 瞭解Windows窗體應用程序窗體字段的工具
我確實設置了所有DefaultCellStyle屬性,但仍然使用表單的字體。 – Rookian 2012-01-16 17:31:43
@Rookian:鑑於這是您第一次提到DefaultCellStyle,現在應該用一個簡短但完整的示例更新您的文章,解釋您爲什麼認爲應該使用不同的字體。 – 2012-01-16 17:33:45
現在,它的工作原理!我犯了一個小錯誤。謝謝你的解釋。 – Rookian 2012-01-16 18:10:07