Label.UseCompatibleTextRendering Label.UseCompatibleTextRendering Label.UseCompatibleTextRendering Label.UseCompatibleTextRendering Property

定義

取得或設定值,決定要使用 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

屬性值

trueGraphics如果類別應該用來執行與版本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和執行自訂文字轉譯的應用程式(使用Graphics類別。The 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.

中引進TextRenderer.NET Framework 2.0.NET Framework 2.0以為基礎的類別,以改善效能、讓文字外觀更好,並改善國際字型的支援。GDIGDIThe 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+. 在使用Graphics類別呈現文字的 Windows Forms 應用程式中,這可能會導致使用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您可以true將特定控制項的屬性設定為。To resolve this incompatibility, you can set the UseCompatibleTextRendering property to true for a specific control. 若要UseCompatibleTextRenderingtrue應用程式中所有支援之控制項的設為Application.SetCompatibleTextRenderingDefault ,請使用的參數true來呼叫方法。To set UseCompatibleTextRendering to true for all supported controls in the application, call the Application.SetCompatibleTextRenderingDefault method with a parameter of true.

適用於

另請參閱