Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
Delphi 6 Personal
Re: DrawShadowText in Delphi (commctrl.h/ComCtl32.dll)
3. Apr 2006, 16:35
Ich naochmal
Delphi-Quellcode:
implementation
{$R *.dfm}
function DrawShadowText(hdc: HDC; pszText: LPCWSTR; cch: UINT;
const pRect: PRect; dwFlags: DWORD; crText: COLORREF;
crShadow: COLORREF; ixOffset: Integer;
iyOffset: Integer): Integer; stdcall ; external 'ComCtl32.dll ';
function _DrawShadowText(ACanvas: TCanvas; x,y: Integer; AText: LPCWSTR;
TextColor, ShadowColor: TColor; ShadowSpaceX, ShadowSpaceY: Integer): Integer;
var TextRect: TRect;
begin
TextRect := Rect(x, y, x + ACanvas.TextWidth(AText),
y + ACanvas.TextHeight(AText));
Result := DrawShadowText(ACanvas.Handle, AText, length(AText), @TextRect, 0,
COLORREF(TextColor), COLORREF(ShadowColor),
ShadowSpaceX, ShadowSpaceY);
end ;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Font.Name := 'MS Sans Serif ';
Canvas.Font.Size := 8;
Canvas.Font.Style := [];
_DrawShadowText(Canvas, 10,25, 'Hallo, ich bin ein Text mit Schatten. ',
clBtnText, clGray, 3, 3);
Canvas.Font.Name := 'Arial ';
Canvas.Font.Size := 14;
Canvas.Font.Style := [fsBold];
_DrawShadowText(Canvas, 10, 50, 'Ich auch ! ', clRed, clBlue, 5, 2);
Canvas.Font.Name := 'Arial ';
Canvas.Font.Size := 10;
Canvas.Font.Style := [];
_DrawShadowText(Canvas, 10, 80, 'Na und ich erst ! ', clBlue, clBlack, 2, 2);
end ;
Angehängte Grafiken
Angehängte Dateien