procedure TForm1.Button1Click(Sender: TObject);
begin
  Randomize;
  Canvas.Polygon([
Point(Random(ClientWidth), Random(ClientHeight)),
Point(Random(ClientWidth), Random(ClientHeight)),
Point(Random(ClientWidth), Random(ClientHeight)),
Point(Random(ClientWidth), Random(ClientHeight)),
Point(Random(ClientWidth), Random(ClientHeight)),
Point(Random(ClientWidth), Random(ClientHeight))]);
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Canvas.Brush.Color := RGB(Random(256), Random(256), Random(256));
  Canvas.FloodFill(X, Y, clBlack, fsBorder);
//也可以用  ExtFloodFill(Canvas.Handle, X, Y, clBlack, FLOODFILLBORDER);
end;