ButtonBase.UseCompatibleTextRendering 屬性

定義

取得或設定值,決定要使用 Graphics 類別 (GDI+GDI+) 還是 TextRenderer 類別 (GDIGDI) 來呈現文字。Gets or sets a value that determines whether to use the Graphics class (GDI+GDI+) or the TextRenderer class (GDIGDI) to render text.

public:
 property bool UseCompatibleTextRendering { bool get(); void set(bool value); };
public bool UseCompatibleTextRendering { get; set; }
member this.UseCompatibleTextRendering : bool with get, set
Public Property UseCompatibleTextRendering As Boolean

屬性值

Boolean

true 如果 Graphics 應該使用類別來執行文字轉譯,以相容于1.0 和1.1 版。true if the Graphics class should be used to perform text rendering for compatibility with versions 1.0 and 1.1. 的 .NET Framework;否則為 falseof the .NET Framework; otherwise, false. 預設為 falseThe default is false.

備註

UseCompatibleTextRendering屬性的目的是要提供 Windows Forms 控制項之間的視覺化相容性,這些控制項使用 TextRenderer 類別以及 .NET Framework 1.0.NET Framework 1.0 .NET Framework 1.1.NET Framework 1.1 使用類別執行自訂文字轉譯的應用程式來呈現文字 GraphicsThe UseCompatibleTextRendering property is intended to provide visual compatibility between Windows Forms controls that render text using the TextRenderer class and .NET Framework 1.0.NET Framework 1.0 and .NET Framework 1.1.NET Framework 1.1 applications that perform custom text rendering using the Graphics class. 在大部分情況下,如果您的應用程式不是從 .NET Framework 1.0.NET Framework 1.0 或升級 .NET Framework 1.1.NET Framework 1.1 ,建議您將 UseCompatibleTextRendering 設定為預設值 falseIn most cases, if your application is not being upgraded from .NET Framework 1.0.NET Framework 1.0 or .NET Framework 1.1.NET Framework 1.1, it is recommended that you leave UseCompatibleTextRendering set to the default value of false.

GDIGDI 基礎 TextRenderer 類別是在中引進, .NET Framework 2.0.NET Framework 2.0 以改善效能、讓文字外觀更好,以及改善國際字型的支援。The GDIGDI based TextRenderer class was introduced in the .NET Framework 2.0.NET Framework 2.0 to improve performance, make text look better, and improve support for international fonts. 在舊版的中 .NET Framework.NET Framework ,會 GDI+GDI+ Graphics 使用型類別來執行所有文字轉譯。In earlier versions of the .NET Framework.NET Framework, the GDI+GDI+ based Graphics class was used to perform all text rendering. GDIGDI 以不同的方式計算字元間距和換行 GDI+GDI+calculates character spacing and word wrapping differently from GDI+GDI+. 在使用類別來呈現文字的 Windows Forms 應用程式中 Graphics ,這可能會導致使用的控制項文字與 TextRenderer 應用程式中的其他文字不同。In a Windows Forms application that uses the Graphics class to render text, this could cause the text for controls that use TextRenderer to appear different from the other text in the application. 若要解決此不相容問題,您可以將 UseCompatibleTextRendering 特定控制項的屬性設定為 trueTo resolve this incompatibility, you can set the UseCompatibleTextRendering property to true for a specific control. 若要 UseCompatibleTextRenderingtrue 應用程式中所有支援的控制項設定為,請 Application.SetCompatibleTextRenderingDefault 使用的參數呼叫方法 trueTo set UseCompatibleTextRendering to true for all supported controls in the application, call the Application.SetCompatibleTextRenderingDefault method with a parameter of true.

適用於

另請參閱