Floodfill为什么不填充?
Floodfill为什么不填充?
一个试验程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
const
n=5;
p:array[0..n] of tpoint=
((x:10),(y:10),(x:100),(y:100),(x:100),(y:50));
var i:integer;
begin
with form1.Image1.Canvas do
begin
//画一红色封闭三角形:
pen.Color:=clred;
moveto(p[0].X,p[1].y); //到起点
for i:=1 to 3 do //画2条边
lineto(p[2*i].x,p[2*i+1].y);
lineto(p[0].X,p[1].y); //再画一边回起点
//填充
floodfill(50,40,clred,fsBorder);
end;
end;
end.
[解决办法]
http://blog.csdn.net/simonhehe/article/details/8721797