1.delphiä¸canvaså¨åª
2.delphiç»å¾
delphiä¸canvaså¨åª
æ¯ä¸ä¸ªçªä½ä¸èåä¹ä¸çæ´ä¸ªçªä½é½æ¯canvasï¼ç»å¸ï¼ãunit Unit1;interface
uses
Windows,画布画图李兴华android源码 Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{ $R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
canvas.LineTo(0,);
canvas.LineTo(,);
canvas.LineTo(,0);
end;
end.
delphiç»å¾
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Canvas.MoveTo(,);
Form1.Canvas.LineTo(,);//ä»(,)ç»çº¿å°(,)
Form1.Canvas.Ellipse(, , , );//ç»å
Form1.Canvas.Pixels[,] := clRed;//æ(,)ç¹æ¾ç¤ºçº¢è²
Form1.Canvas.TextOut(,,'åæå');
end;
å¦å¤çDelphiä¸å ³äºCanvas.TextOutçä¸ç¹èµæ
Canvas.Font.Color:=clblue;//åä½é¢è²
//Canvas.Brush.Color:=clred;//åºè²
Canvas.Brush.Style := bsClear;//éæ
canvas.textout(0,0,'avalokita');
æ两个 TImage
procedure TfrmMain.FormCreate(Sender: TObject);
begin
Image1.Canvas.Brush.Color := clBlack;
Image1.Canvas.FillRect(Image1.ClientRect);
Image1.Canvas.Font.Color := clRed;
Image1.Canvas.Font.Name := 'Times New Roman';
Image1.Canvas.Font.Size := ;
Image1.Canvas.TextOut(9, , 'Delphi');
end;
// 水平转
procedure TfrmMain.Button1Click(Sender: TObject);
var
i: integer;
begin
for i := 1 to Image1.Width do
BitBlt(Image2.Canvas.Handle, i, 0, 1, Image2.Height,
Image1.Canvas.Handle, Image1.Width - i, 0, SRCCOPY);
Image2.Refresh;
end;
// åç´è½¬
procedure TfrmMain.Button2Click(Sender: TObject);
var
i: integer;
begin
for i := 1 to Image1.Height do
BitBlt(Image2.Canvas.Handle, 0, i, Image2.Width, 1,
Image1.Canvas.Handle, 0, Image1.Height - i, SRCCOPY);
Image2.Refresh;
end;
ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼
1.å ·æCANVASå±æ§çæ§ä»¶:
TBitmap,TComboBox,TDBComboBox,TDBGrid,TDBListBox,TDirectoryListBox,
TDrawGrid,TFileListBox,TForm,THeaderControl,TImage,TListBox,TOutline,
TPaintBox,TPrinter,TStatusBar,TStringGridç,
2.CANVASå±æ§åå½ä»¤:ç¯å¹ æé,çç¥åæ°åæ ¼å¼è¯´æ,å ·ä½è¯·åèæåç¨åºåDELPHI帮å©æ件:
canvas.rectangle():ç»ç©å½¢pen.color:å®ä¹ç»ç¬é¢è²
roundrect():ç»åè§ç©å½¢pen.width:å®ä¹ç»ç¬å®½åº¦
arc():ç»å¼§çº¿(ä¸å¡«å ) brush.color:å®ä¹å¡«å é¢è²
chord():ç»å¼§çº¿(å¡«å ) textout():å¨åºå®ä½ç½®è¾åºå符串
pie:ç»æå½¢ textwidth:åå符串é«åº¦
polygon():ç»å¤è¾¹å½¢å¡«å textheight:åå符串宽度
polyline():å¤ç¹èæº(ä¸å¡«å )font.color:æå®åä½é¢è²
Pixels():æå®åºå®è±¡ç´ ç¹é¢è²å¼font.size:æå®åä½å¤§å°
moveto():ææç»çº¿èµ·ç¹ Ellipse():ç»åææ¤å
lineto():ææç»çº¿ç»ç¹
3.使ç¨CANVAS注æäºé¡¹:å½çªå£è¿è¡éç»æ¶,ç»å¸ä¸çå¾åå°æ¶å¤±,æ¯å¦å½çªå£è¿è¡æå°ååéæ°æ¢å¤æ¶ï¼å°±ä¼å¼èµ·ç»å¸ä¸å¾åçæ¶å¤±ï¼å¦å¤å½ååè¿è¡ç¨åºæ¶ï¼çªå£ä¹æ¯å±äºéæ°ç»å¶ï¼æ以å¦æå¨ç»å¶çªå£ä¹åå¨ç»å¸ä¸ç»å¾ï¼å¼¹åºçªå£åå°ä¸è½æ¾ç¤ºåºå¾åï¼æ¯å¦å¨TForm1.FormCreate()äºä»¶ä¸è¿è¡ç»å¸ç»å¾æä½å°æ¯å¾å³çï¼ä½å¯ä»¥å¨æ¤äºä»¶ä¸è¿è¡ç»å¸æä½çåå¤å·¥ä½ï¼æ¯å¦è®¾ç½®ç»ç¬çé¢è²å宽度çã
procedure TForm1.SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if Sender is Tspeedbutton then
begin
statusbar1.canvas.Brush.Color:=clwhite;
statusbar1.canvas.fillRect(statusbar1.Canvas.ClipRect);//æ¸ ç©ºç»å¸
statusbar1.Panels[0].Style:=psOwnerDraw;
statusbar1.Canvas.font.Color:=clred;//åä½é¢è²
statusbar1.Canvas.Brush.Color:=clblue;//åºè²
statusbar1.Canvas.brush.style:=bsclear; //éæ
statusbar1.Canvas.TextOut(0,5,'This is sample'); //å®ä½x,yåæ è½´åè¾å ¥æå
end;
end;
Canvas.Brush.Style:=bsclear å¯ä»¥å»æåä½çèæ¯