Learn more about GDI + [45]: text output-text rendering quality

Source: Internet
Author: User
In this example:


Code File:
Unit unit1; interfaceuses windows, messages, extensions, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) combox1: tcombobox; Procedure formpaint (Sender: tobject); Procedure formcreate (Sender: tobject); Procedure combobox1change (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi, typinfo; Procedure tform1.formcreate (Sender: tobject); var I: integer; begin for I: = 0 to 5 do combobox1.items. add (getenumname (typeinfo (ttextrenderinghint), I); combobox1.itemindex: = 0; end; procedure merge (Sender: tobject); var G: tgpgraphics; B: tgpbrush; Font: tgpfont; begin G: = tgpgraphics. create (canvas. handle); B: = tgpsolidbrush. create (aclred); Font: = tgpfont. create ('arial black ', 150); G. settextrenderinghint (ttextrenderinghint (combobox1.itemindex); G. drawstring ('@',-1, Font, makepoint (0.0,-40.0), B); font. free; B. free; G. free; end; Procedure tform1.combobox1change (Sender: tobject); begin repaint; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 212 clientwidth = 221 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = pow.topcenter oncreate = formcreate onpaint = formpaint pixelsperinch = 96 textheight = 13 object combobox1: tcombobox left = 8 Top = 3 width = 207 Height = 21 itemheight = 13 taborder = 0 text = 'combox1' onchange = combobox1change endend

  

Text rendering quality mode:

Delphi Microsoft Description
Textrenderinghintsystemdefault Systemdefault When a prompt is displayed by default, use the bitmap of each character to draw characters. The text will be drawn using any font trim settings selected by the user for the system.
Textrenderinghintsinglebitperpixelgridfit Singlebitperpixelgridfit Draw characters using the symbolic bitmap of each character. The prompt is used to improve the appearance of Characters in the trunk and curved sections.
Textrenderinghintsinglebitperpixel Singlebitperpixel Draw characters using the symbolic bitmap of each character. Do not use the prompt.
Textrenderinghintantialiasgridfit Antialiasgridfit When prompted, draw characters using the de-sawtooth effect symbol bitmap of each character. Because of
Antialias, the quality will be greatly improved, but it will also increase the performance cost.
Textrenderinghintantialias Antialias When no prompt is displayed, draw the characters using the de-sawtooth effect symbol bitmap of each character. Because of
Antialias, the quality will be improved. Because the message is disabled, the width difference of the trunk may be obvious.
Textrenderinghintcleartypegridfit Cleartypegridfit Use the flag cleartype for each character when prompted
Bitmap to draw characters. This is the highest quality setting. Use cleartype
Font function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.