[lazarus]OnResize event and refreshing a form
Radek Brecka
llazarus at seznam.cz
Tue Oct 14 02:54:50 EDT 2003
Hi,
I have a problem with refreshing a Form area. I create a form and a panel. I want to the panel resizes according to the form. So I override OnResize event on the form, but it doesn't work correctly. The form's area doesn't refresh correctly. There are some lines. Do I something badly.
Thanks Radek
There is a example:
unit fForm;
{$mode objfpc}
{$H+}
interface
uses
Classes, Forms, Buttons, cListbox, StdCtrls, Controls, extctrls;
type
TFormExample = class(TForm)
private
{ Private Declarations }
protected
{ Protected Declarations }
public
Button1 : TButton;
pnMain: TPanel;
constructor Create(AOwner: TComponent); override;
procedure FormDestroy(Sender : TObject);
procedure Button1Click(Sender : TObject);
procedure FormResize(Sender: TObject);
end;
var
FormExample : TFormExample;
implementation
constructor TFormExample.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Caption := 'Hello';
Width := 200;
Height := 150;
Left := 200;
Top := 200;
OnDestroy := @FormDestroy;
pnMain := TPanel.Create(Self);
pnMain.Parent := Self;
{
pnMain.Align := alClient;
pnMain.Anchors := [akLeft,akTop, akRight, akBottom];
}
OnResize := @FormResize;
button1 := TButton.Create(Self);
With button1 do
begin
OnClick := @Button1Click;
Parent := pnMain;
width := 80;
height := 32;
left := 25;
top := 25;
caption := 'OK';
{Show;}
end;
end;
procedure TFormExample.FormDestroy(Sender : TObject);
begin
inherited;
end;
procedure TFormExample.Button1Click(Sender : TObject);
begin
Application.MessageBox('Hi', 'Caption', 1);
end;
procedure TFormExample.FormResize(Sender: TObject);
begin
pnMain.Width := ClientWidth - 1;
pnMain.Height := ClientHeight - 1;
Repaint;
end;
end.
____________________________________________________________
Více než 1.500 kvalitních ojetých vozů on-line. http://ad2.seznam.cz/redir.cgi?instance=62694%26url=http://www.auto-plus.cz
More information about the Lazarus
mailing list