DBGRID左边的Indicator(指示条)怎样变宽?

ybjcl 2005-06-17 04:20:19
DBGRID左边的Indicator(指示条)怎样变宽?
...全文
128 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
47522341 2005-06-18
  • 打赏
  • 举报
回复
dbgrid控件没有实现对这个属性操作的借口和函数;
楼主真的需要的话可以自己另外从TDBGrid类中自己继承一个控件;从新实现对该属性的赋值;
unit LXDBGrid;

interface

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

type
TLXDBGrid = class(tdbgrid)
private
{ Private declarations }
protected
procedure SetColumnAttributes; override;
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponent('Test',[TADBGrid]);
end;

{ TLXDBGrid }

procedure TLXDBGrid.SetColumnAttributes;
begin
inherited;
if (dgIndicator in Options) then
ColWidths[0] := 200;
end;

end.
lovend 2005-06-17
  • 打赏
  • 举报
回复
帮你顶
47522341 2005-06-17
  • 打赏
  • 举报
回复
const
IndicatorWidth = 11;

procedure TCustomDBGrid.SetColumnAttributes;
var
I: Integer;
begin
for I := 0 to FColumns.Count-1 do
with FColumns[I] do
begin
TabStops[I + FIndicatorOffset] := Showing and not ReadOnly and DataLink.Active and
Assigned(Field) and not (Field.FieldKind = fkCalculated) and not ReadOnlyField(Field);
ColWidths[I + FIndicatorOffset] := Width;
end;
if (dgIndicator in Options) then
ColWidths[0] := IndicatorWidth;
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧