Spread Windows Forms 15.0
Spread Windows Forms 15.0 Product Documentation / Developer's Guide / Customizing the Sheet Appearance / Text Rendering with GDI
In This Topic
    Text Rendering with GDI
    In This Topic

    You can use GDI (instead of GDI+) for drawing text in Visual Studio 2005 by using the special FarPoint.Win.TextRenderer DLL and adding it to the references in a project. If you use the text renderer feature in your project for text drawing that is GDI-based rather than GDI+-based, in version 2.0 of the .NET Framework, then you must distribute the FarPoint.Win.TextRenderer.dll file. Only users who are using Visual Studio 2005 can benefit from this file, as that environment is required to target version 2.0 of the .NET Framework.

    The FarPoint.Win.TextRenderer.dll is a thin wrapper for the new System.Windows.Forms TextRenderer class in .NET 2.0. The Spread component tries to locate the FarPoint.Win.TextRenderer assembly if it can find the framework System.Windows.Forms.TextRenderer class in the System.Windows.Forms assembly (that is, if Spread is running under .NET 2.0). If it can, Spread loads the FarPoint TextRenderer and uses reflection to make dynamic calls into it to do the text drawing with System.Windows.Forms.TextRenderer instead of System.Drawing.Graphics.DrawString. Spread uses dynamic calls through reflection so that the FarPoint Spread assembly is not dependent on the FarPoint.Win.TextRenderer assembly; if the FarPoint assembly is not found, or if the System.Windows.Forms.TextRenderer class is not found in the System.Windows.Forms assembly, then Spread uses Graphics.DrawString to draw text as it has always done. For more information about how the new TextRenderer class in .NET 2.0 differs from the way the Graphics object draws text, in particular how TextRenderer uses GDI drawing APIs in Windows instead of GDI+ APIs in the .NET framework, refer to the .NET framework documentation about using TextRenderer class.

    Spread can use GDI+ drawing while other text drawing in the application uses GDI with the new TextRenderer class; Spread can use the new TextRenderer class for GDI drawing while other text drawing in the application uses GDI+. The differences are very small (a few pixels in the spacing and alignment) and not very noticeable.

    This DLL must be installed to the directory where the application’s executable file resides (the bin folder) on systems where GDI drawing in the Spread is preferred. The file may be installed to the GAC to ensure that all Spread controls in all applications that use version 2.0 of the .NET Framework will use the TextRenderer for text drawing. The file can be installed to the bin folder on an application-by-application basis, and the Framework will find it there.

    For more information on GDI-based text drawing, refer to the web site, spwin-celltypecustomize.

    For more information in the Microsoft .NET Framework documentation, refer to Microsoft .NET TextRenderer Class.

    See Also