In my class, we are learning how to create graphics and such, and our first project is to make a basic house. (Triangle roof, rectangular base, door, and window) Though because of some problems with the networking and the computers themselves, our computers cannot run, which means I can't try out FillRect or FloodFill.
I've prepared a little bit of code using them, and I would like someone to check it for me, and if it is incorrect, provide me with an example is possible.
Thank you.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, 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
Form1.Canvas.pen.Color:= clFuchsia;
Form1.Canvas.Polygon([Point(400,200),Point(400,300),Point(300,300), Point(300,200)]);
Form1.Canvas.MoveTo(400,200);
Form1.Canvas.LineTo(350,150);
Form1.Canvas.LineTo(300,200);
Form1.Canvas.Moveto(0,300);
Form1.Canvas.LineTo(Form1.width,300);
Form1.Canvas.Pen.Color:= clFuchsia;
Form1.Canvas.FloodFill(0,301, clFuchsia, bsSolid);
Form1.Canvas.FillRect(Rect(0,300,Form1.Width,300));
FillRect(Rect(1,1, Form1.Width, Form1.Height));
end;
end.