DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Pascal and Delphi (http://www.daniweb.com/forums/forum124.html)
-   -   Code Snippet: Disable font smoothing (Anti-aliased font) (http://www.daniweb.com/forums/thread216709.html)

Lord Soth Mar 18th, 2006 6:40 am
Disable font smoothing (Anti-aliased font)
 
This code disables font smoothing for a TLabel component. Can easily be converted for other VCL controls.

Loren Soth

  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;

All times are GMT -4. The time now is 4:19 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC