В процессе социологического опроса, проведенного в корпорации "Мелкий-Мягкий", выяснено, что: 99% сотрудников корпорации любят все большое и негибкое.
{
The user can move rows and columns of a StringGrid with the mouse.
Can it also be done by code?
In the help for TCustomGrid you can see the methods MoveColumn and MoveRow,
but they are hidden in TStringGrid.
We can make them accessible again by subclassing TStringGrid and
declaring these methods as public:
}type
TStringGridHack = class(TStringGrid)
publicprocedure MoveColumn(FromIndex, ToIndex: Longint);
procedure MoveRow(FromIndex, ToIndex: Longint);
end;
{
The implementation of these methods simply consists of invoking the
corresponding method of the ancestor:
}procedure TStringGridHack.MoveColumn(FromIndex, ToIndex: Integer);
begininherited;
end;
procedure TStringGridHack.MoveRow(FromIndex, ToIndex: Integer);
begininherited;
end;
// Example, Beispiel: procedure TForm1.Button1Click(Sender: TObject);
begin
TStringGridHack(StringGrid1).MoveColumn(1, 3);
end;
Статья Перетащить колонки и строки в StringGrid раздела Компоненты и Классы TStringGrid и TDrawGrid может быть полезна для разработчиков на Delphi и FreePascal.
Комментарии и вопросы
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.