procedure AngleTextOut(CV: TCanvas; const sText: String; x, y, angle:integer;color:TColor);
var
LogFont: TLogFont;
MyFont,SaveFont: TFont;
begin
SaveFont := TFont.Create;
SaveFont.Assign(CV.Font);
MyFont:= SaveFont;
MyFont.Style := [fsBold];
MyFont.Name := 'Times New Roman';
GetObject(MyFont.Handle, sizeof(TLogFont), @LogFont);
with LogFont do
begin
lfEscapement := angle *10;
lfPitchAndFamily := FIXED_PITCH or FF_DONTCARE;
lfQuality := PROOF_QUALITY;
lfHeight:=30;
//lfStrikeOut := 1;
end; {with}
CV.Font.Handle := CreateFontIndirect(LogFont);
CV.Font.Color := color;
SetBkMode(CV.Handle, TRANSPARENT);
CV.TextOut(x, y, sText);
CV.Font.Assign(SaveFont);
SaveFont.Free;
end;
调用时:
AngleTextOut(Canvas,'LAN EXPLORER',14, 229, 90,clRed);