Как передвинуть колонку в TDBGrid?
Falk0ner, вс, 06/07/2008 - 15:34.
type
THackAccess = class(TCustomGrid);
{
THackAccess Is needed because TCustomGrid.MoveColumn is
protected and you can't access it directly.
}
// In the implementation-Section:
procedure MoveDBGridColumns(DBGrid: TDBGrid; FromColumn, ToColumn: Integer);
begin
THackAccess(DBGrid).MoveColumn(FromColumn, ToColumn);
end;
{Example}
procedure TForm1.Button1Click(Sender: TObject);
begin
MoveDBGridColumns(DBGrid1, 1, 2)
end;
THackAccess = class(TCustomGrid);
{
THackAccess Is needed because TCustomGrid.MoveColumn is
protected and you can't access it directly.
}
// In the implementation-Section:
procedure MoveDBGridColumns(DBGrid: TDBGrid; FromColumn, ToColumn: Integer);
begin
THackAccess(DBGrid).MoveColumn(FromColumn, ToColumn);
end;
{Example}
procedure TForm1.Button1Click(Sender: TObject);
begin
MoveDBGridColumns(DBGrid1, 1, 2)
end;
Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php
Отправить комментарий