Disable font smoothing (Anti-aliased font)

Please support our Pascal and Delphi advertiser: Programming Forums
Mar 18th, 2006
Views: 5,303
AddThis Social Bookmark Button
This code disables font smoothing for a TLabel component. Can easily be converted for other VCL controls.

Loren Soth
delphi Syntax
  1. procedure TForm1.DisableFontSmoothing(LabelName: TLabel);
  2. var
  3. tagLOGFONT: TLogFont;
  4. begin
  5. GetObject(LabelName.Font.Handle, SizeOf(TLogFont), @tagLOGFONT);
  6. tagLOGFONT.lfQuality := NONANTIALIASED_QUALITY;
  7. LabelName.Font.Handle := CreateFontIndirect(tagLOGFONT);
  8. end;
  9.  
  10. //Example Use for Label2
  11. procedure TForm1.Button1Click(Sender: TObject);
  12. begin
  13. DisableFontSmoothing(Label2);
  14. end;

Only community members can submit or comment on code snippets. You must register or log in to contribute.

Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:49 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC