unit Unit1;
interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, StdCtrls;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure FormCreate(Sender: TObject);
private{ Private declarations }public{ Public declarations }end;
const
cell_x = 2;
cell_y = 2;
var
Form1: TForm1;
CheckBox1: TCheckBox;
implementation{$R *.DFM}procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
r:trect;
beginif(cell_x>=StringGrid1.LeftCol) and
(cell_x<=StringGrid1.LeftCol+StringGrid1.VisibleColCount) and
(cell_y>=StringGrid1.TopRow) and
(cell_x<=StringGrid1.TopRow+StringGrid1.VisibleRowCount) then
CheckBox1.Visible:=trueelse
CheckBox1.Visible:=false;
if (acol=cell_x) and (arow=cell_y) thenbegin
r:=stringgrid1.CellRect(cell_x,cell_y);
r.Left:=r.left+stringgrid1.left+2;
r.right:=r.right+stringgrid1.left+2;
r.top:=r.top+stringgrid1.top+2;
r.bottom:=r.bottom+stringgrid1.top+2;
CheckBox1.BoundsRect:=r;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
CheckBox1:=TCheckBox.Create(form1);
CheckBox1.parent:=form1;
CheckBox1.Caption:='proba';
end;
end.
Статья CheckBox в StringGrid раздела Компоненты и Классы TStringGrid и TDrawGrid может быть полезна для разработчиков на Delphi и FreePascal.
Комментарии и вопросы
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.