
16.07.2011, 19:53
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TGraphicControl1 = class(TGraphicControl)
private
FNum: Integer;
procedure SetNum(const Value: Integer);
protected
procedure Paint; override;
public
property Num: Integer read FNum write SetNum;
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TGraphicControl1 }
procedure TGraphicControl1.Paint;
begin
Canvas.Brush.Color:=clWhite;
Canvas.FillRect(ClientRect);
Canvas.Font.Size:=14;
Canvas.Font.Color:=clBlack;
Canvas.TextOut(10, 10, IntToStr(FNum));
end;
procedure TGraphicControl1.SetNum(const Value: Integer);
begin
if Value<>FNum then
begin
FNum:=Value;
Invalidate;
end;
end;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
with TGraphicControl1.Create(Self) do
begin
Parent:=Self;
Left:=100;
Top:=100;
Width:=100;
Height:=100;
Num:=$10000;
end;
end;
end.
__________________
Пишу программы за еду.
__________________
|