在StringGrid中直接操作
------------------------
增加一个Memo1
设置Visible := False;
在操作StringGrid数据时,判断一下是否是锁定的列, 不进行操作。
否则显示Memo1,并把StringGrid.Cells中的数据传给Memo1.Text。
------------
with StringGrid do
Begin
Place := CellRect(Col,Row);
Memo1.Text := Cells[Col,Row];
end;
Memo1.Left := Place.Left;
Memo1.Top := Place.Top;
Memo1.Width := Place.Right - Place.Left;
Memo1.Height := Place.Bottom - Place.Top;
Memo1.Show;
------------------------
增加一个Memo1
设置Visible := False;
在操作StringGrid数据时,判断一下是否是锁定的列, 不进行操作。
否则显示Memo1,并把StringGrid.Cells中的数据传给Memo1.Text。
------------
with StringGrid do
Begin
Place := CellRect(Col,Row);
Memo1.Text := Cells[Col,Row];
end;
Memo1.Left := Place.Left;
Memo1.Top := Place.Top;
Memo1.Width := Place.Right - Place.Left;
Memo1.Height := Place.Bottom - Place.Top;
Memo1.Show;
stringgrid实现很容易
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
if acol=1 then //第一列只读
StringGrid1.Options := StringGrid1.Options-[goEditing]
else
StringGrid1.Options := StringGrid1.Options+[goEditing];
end;