zoukankan      html  css  js  c++  java
  • Delphi 重写控件的一个例子。

    unit DBGridEx;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Grids, DBGrids;
     
    type
      TMyInplaceEdit = class(TInplaceEdit)
      published
        property Color;
      end;
     
      TMyDBGrid = class(TDBGrid)
      protected
        function CreateEditor: TInplaceEdit; override;
      end;
     
    procedure Register;
     
    implementation
     
    procedure Register;
    begin
      RegisterComponents('Standard', [TMyDBGrid]);
    end;
     
    function TMyDBGrid.CreateEditor: TInplaceEdit;
    var
       aEdit: TMyInplaceEdit;
    begin
      aEdit := TMyInplaceEdit.Create(Self);
      aEdit.Color := clGreen;  //单元格设置成绿色
      Result := aEdit;
    end;
     
    end.
  • 相关阅读:
    OD 实验(十三)
    第一个 Windows 界面程序
    C 语言
    C 语言
    OD 实验(十二)
    PowerShell 常用命令
    OD 实验(十一)
    OD 实验(十)
    redis
    memcached缓存系统
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/3273430.html
Copyright © 2011-2022 走看看