unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, StdCtrls;
type
TJsStringGrid =
class(TStringGrid)
private
FOnSizing: TNotifyEvent;
protected
procedure ColSizing;
virtual;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
override;
published
property OnSizing : TNotifyEvent
read FOnSizing
write FOnSizing;
end;
TForm1 =
class(TForm)
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FGrid : TJsStringGrid;
procedure Sizing(Sender : TObject);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Sizing(Sender: TObject);
begin
Label1.Caption:=IntToStr(StrToInt(Label1.Caption)+1);
end;
{ TJsStringGrid }
procedure TForm1.FormCreate(Sender: TObject);
begin
FGrid:=TJsStringGrid.Create(Self);
FGrid.Top:=20;
FGrid.Left:=20;
FGrid.Options:=FGrid.Options + [goColSizing];
FGrid.OnSizing:=Sizing;
FGrid.Parent:=Self;
end;
{ TJsStringGrid }
procedure TJsStringGrid.ColSizing;
begin
If (Assigned(FOnSizing))
and (FGridState=gsColSizing)
then
FOnSizing(Self);
end;
procedure TJsStringGrid.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
begin
ColSizing;
inherited MouseUp(Button,Shift,X,Y);
end;
end.