利用TCanvas把字畫到螢幕上

 1,877 total views,  3 views today

每次都會忘記怎麼寫,直接寫在這當筆記好了

[delphi]procedure TForm1.btn1Click(Sender: TObject);
var
mycanvas: TCanvas;
SourceDC: HDC;
begin
mycanvas := TCanvas.Create;
try
SourceDC := CreateDC(‘DISPLAY’, ”, ”, nil);
mycanvas.Handle := SourceDC;
mycanvas.font.Size := 50;
mycanvas.font.Color := clRed;
mycanvas.TextOut(250, 150, ‘XX-999車輛即將靠站’);
finally
mycanvas.Free
end;
DeleteDC(SourceDC);
end;[/delphi]

發表迴響

%d 位部落客按了讚: