2005. október 16., vasárnap

How to draw disabled (greyed-out) text on a TCanvas


Problem/Question/Abstract:

Is there any way I can set some flags for Canvas.TextOut or something similar to draw text in disabled mode, or do I need to do this by writing my own routine?

Answer:

procedure DrawDisabledCaption(aCanvas: TCanvas; X, Y: Integer; aCaption: string);
var
  oldcolor: TColor;
begin
  { ... }
  with aCanvas do
  begin
    oldcolor := font.color;
    font.color := clBtnHighlight;
    TextOut(X, Y, aCaption);
    font.color := clBtnShadow;
    TextOut(X + 1, Y + 1, aCaption);
  end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése