(1)控制一个单元格是否允许编辑(或者说文字选中),可以设置Grid的Options的dgEditing属性;如果该属性为False,那么用户只能选中该单元格而无法选中里面的内容,也无法进行编辑。
(2)Grid有个EditorMode属性很好用,当用户单击单元格的时候设置该属性为True,可以自动进入编辑状态。
例子:
procedure Tfrm_MB_template.DBG1CellClick(Column: TColumnEh);
begin
if Column.ReadOnly then
begin
DBG1.Options:=DBG1.Options-[dgEditing];
DBG1.EditorMode:=False;
end
else begin
DBG1.Options:=DBG1.Options+[dgEditing];
DBG1.EditorMode:=True;
end;
end;
本文来自博客园,作者:del88,转载请注明原文链接:https://www.cnblogs.com/del88/p/3704100.html
浙公网安备 33010602011771号