以下是我摘抄的﹕
type
  TMyGrid = class(TCustomDBGrid)
  protected
    property OnDrawColumnCell;
    procedure DrawColumnCell(const Rect: TRect; DataCol: Integer;Column: TColumn; State: TGridDrawState); override;
  end;問﹕那我該如何調用(在界面上用此繼承控件)﹐最好有簡短實例源碼
初學者不勝感激并附上分。

解决方案 »

  1.   

    ...
    var mygrid:tmygrid;
    ...TForm1.Create(...)
    begin
      ...
      mygrid:=tmygrid.Create;
      mygrid.Parent:=self;
      ...
    end;TForm1.Destroy(...)
    begin
      ...
      mygrid.Free;
      ...
    end;
      

  2.   

    用控件向导做,然后便宜注册安装,就能在控件面板上看到并可使用了....
    产生代码例下:
    unit MyGrid;interfaceuses
      SysUtils, Classes, Controls, Grids;
    type
      TMyGrid = class(TCustomDBGrid)
      private
        { Private declarations }
        
      protected
        property OnDrawColumnCell;
        procedure DrawColumnCell(const Rect: TRect; DataCol: Integer;Column: TColumn; State: TGridDrawState); override;    { Protected declarations }
      public
        { Public declarations }
      published
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Samples', [TMyGrid]);
    end;end.