Hello, im trying to create working TPaintBox without lazarus help, i.e. in plain text, but it doesnt work for me no matter what i try
Im trying it like that:
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Dialogs, ExtCtrls, Menus, Graphics;
type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
PaintBox1 := TPaintBox.Create(Self);
PaintBox1.Parent := Form1;
PaintBox1.Visible := true;
PaintBox1.Align := alClient;
PaintBox1.Canvas.Pen.color := clBlack;
PaintBox1.Canvas.FillRect(20,20,40,40);
end;
end.
It gives me an empty form without black rectangle which is supposed to be here, what i am doing wrong? I googled hard, but no luck.