...disable font smoothing/anti-aliasing?

Author: Andy

Category: VCL

{THIS IS THE FUNCTION I NEEDED AND THEREFORE USED }
{CONVERSELY, BY REMOVING 'NON' OFF THE lfQuality  }
{IT CAN BE MADE INTO ENABLEFONTSMOOTHING          }

procedure TForm1.DisableFontSmoothing(LabelName: TLabel);
var
  
tagLOGFONT: TLogFont;
begin
  
GetObject(LabelName.Font.Handle, SizeOf(TLogFont), @tagLOGFONT);
  tagLOGFONT.lfQuality  := NONANTIALIASED_QUALITY;
  LabelName.Font.Handle := CreateFontIndirect(tagLOGFONT);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  
DisableFontSmoothing(Label2);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base