控件开发问题(100分)

  • 主题发起人 主题发起人 szhhp
  • 开始时间 开始时间
S

szhhp

Unregistered / Unconfirmed
GUEST, unregistred user!
我正在学习VCL 下面是简单的继承TCustomDBGrid建立的TCustomDBGrid1(学习实验用)

unit CustomDBGrid1;

interface

uses
Windows, Messages, SysUtils, Classes, Controls, Grids, DBGrids;

type
TCustomDBGrid1 = class(TCustomDBGrid) //其实下面的代码和TDBGIRD一样,只是改了类名
public
property Canvas;
property SelectedRows;
published
property Align;
property Anchors;
property BiDiMode;
property BorderStyle;
property Color;
property Columns stored False; //StoreColumns;
property Constraints;
property Ctl3D;
property DataSource;
property DefaultDrawing;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FixedColor;
property Font;
property ImeMode;
property ImeName;
property Options;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabOrder;
property TabStop;
property TitleFont;
property Visible;
property OnCellClick;
property OnColEnter;
property OnColExit;
property OnColumnMoved;
property OnDrawDataCell; { obsolete }
property OnDrawColumnCell;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEditButtonClick;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
property OnTitleClick;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('ggggg', [TCustomDBGrid1]);
end;

end.

问题来了,标准的DBGRID在设计时双击它可以弹出一窗口,用来编辑列,
可以上继承的这个,安装后使用,设计时双击却不能弹出窗口,而是转到
代码编辑区的ONCELLCLICK事件的编辑处,为什么?谢谢!
 
覆盖了dbclick方法么?
 
to xieha:
能更具体点吗?
 
这是因为Delphi为TDBGrid注册了组件编辑器,你可对控件点右键看到它的菜单项。
由于你从TCustomDBGrid中派生,故无法使用TDBGrid注册的组件编辑器。
 
to yygw:
非常感谢你的回答。
 
少了RegisterComponentEditor
 
后退
顶部