FloodFill用法記述_delphi

來源:互聯網
上載者:User

函數說明如下:

{x,y:當前座標
Color:針對該色彩執行填充事件
FillStyle:fsBorder(從當前位置開始填充,直到遇到Color),fsSurFace(當前底色和color相同時填充) } procedure TCanvas.FloodFill(X, Y: Integer; Color: TColor; FillStyle: TFillStyle);
 


範例程式碼

procedure TForm15.btn1Click(Sender: TObject);const  Points1: array[0..2] of TPoint =    ((X:0; Y:0), (X:100; Y:100), (X:15; Y:50));  Points2: array[0..2] of TPoint =    ((X:0; Y:200), (X:100; Y:300), (X:50; Y:350));begin  self.Repaint;    Canvas.Pen.Color := clred;  canvas.Brush.Color:=clred;  Canvas.Polygon(Points1);  canvas.Brush.Color:=clgreen;  Canvas.FloodFill(0,0,clred,fsSurface);  Canvas.Pen.Color := clred;  Canvas.Polygon(Points2);  canvas.Brush.Color:=clgreen;  Canvas.FloodFill(50,250,clred,fsBorder);end;procedure TForm15.btn2Click(Sender: TObject);const  Points3: array[0..3] of TPoint =    ((X:0; Y:0), (X:100; Y:100), (X:15; Y:50), (X:0; Y:0));  Points4: array[0..3] of TPoint =    ((X:0; Y:200), (X:100; Y:300), (X:50; Y:350), (X:0; Y:200));begin  self.Repaint;  Canvas.Pen.Color := clred;  Canvas.Pen.Width := 2;  Canvas.Polyline(Points3);  canvas.Brush.Color:=clgreen;  Canvas.FloodFill(0,0,clred,fsSurface);  Canvas.Pen.Color := clred;  Canvas.Polyline(Points4);  canvas.Brush.Color:=clgreen;  Canvas.FloodFill(50,280,clred,fsBorder);end;


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.