触发TDBGrid Columns调整大小事件的位置 [英] Where the TDBGrid Columns resize event was triggered

查看:94
本文介绍了触发TDBGrid Columns调整大小事件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TDBGrid组件。我需要在调整网格的列大小时捕获触发的事件。

I have a TDBGrid component. I need to catch the event triggered when I'm resizing a column of the grid.

推荐答案

您需要创建TDBGrid的后代并自己实现该事件。像这样:

you need to create a descendent of TDBGrid and implement the event by yourself. Something like this:

unit MyDBGrid;

interface

type
  TMyDBGrid = class(TDBGrid)
  private
    FOnColResize: TNotifyEvent;
  protected
    procedure ColWidthsChanged; override;
  public
  published
    property OnColResize: TNotifyEvent read FOnColResize write FOnColResize;
  end;

implementation

{ TMyDBGrid }

procedure TMyDBGrid.ColWidthsChanged;
begin
  inherited;
  if (Datalink.Active or (Columns.State = csCustomized)) and
    AcquireLayoutLock and Assigned(FOnColResize) then
    FOnColResize(Self);
end;

end.

这应该可行,我现在没有时间对其进行测试。

this should work, I don't have time now to test it.

这篇关于触发TDBGrid Columns调整大小事件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆