Thema: Delphi Auf ColSizing reagieren?

Einzelnen Beitrag anzeigen

Benutzerbild von Jens Schumann
Jens Schumann

Registriert seit: 27. Apr 2003
Ort: Bad Honnef
1.644 Beiträge
 
Delphi 2009 Professional
 
#2

Re: Auf ColSizing reagieren?

  Alt 21. Dez 2005, 18:58
Hallo
evt. hilft es die Methode MouseUp zu überschreiben
Delphi-Quellcode:
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.
I come from outer space to save the human race
  Mit Zitat antworten Zitat