任何一控件(不要是stringgrid).SetFocus;
搞定!!
如果报错加一个时钟以延时!!
搞定!!
如果报错加一个时钟以延时!!
解决方案 »
- 极有难度问题,这种功能怎么实践?
- fastreport小问题,关于传参数问题
- 如何得到从显的分辨率?
- 谁有DELPHI中对USB口进行操作的那个usb.pas文件?
- 各位大哥,用API什么函数可以判断现在是在WINDWOS界面中还是在我自已的程序界面中
- 请各位高手帮帮忙!
- 我在51job上看了,Java招聘大概维持在delphi的10倍左右, c系列大概维持在delphi的5倍左右!
- 为什么dbgrid标题不能显示汉字??
- 100分求助文件上传问题,在线等待
- 怎么把一个VCL 删除掉,我装了 flatstyle_D5 现在要装 flatstyle 2000 怎么把原来那个去掉?
- 请发给我一个DELPHI5开发环境的启动程序给我吧!
- Query增加问题?
………………
………………
stringgrid.cells[i,j]:='';
………………
………………
stringgrid.cells[i,j]:='';
stringgrid.Row=其它行
不行,你的方法我试了,还是解决不了,那一单元格的内容还是不能清空
而且照你的方法去做了,还是不能清空那个单元格的内容
麻烦大家试试好吗?
procedure TForm1.StringGrid1Click(Sender: TObject);
var
row,col:Integer;
begin
row:=stringGrid1.row;
col:=stringgrid1.col;
if (row=2) and (col=3) then
stringGrid1.Options:=stringGrid1.Options-[goEditing]
else stringGrid1.Options:=stringGrid1.Options+[goEditing];
end;
for I := 0 to stringgrid.ColCount do
for j:= 0 to stringgrid.rowcount do
stringgrid.cells[i,j]:= ''
procedure TForm1.BitBtn1Click(Sender: TObject);
var
myRect: TGridRect;
begin
if StringGrid1.Col<StringGrid1.ColCount-1 then
begin
myRect.Left := StringGrid1.col+1;
myRect.Top := StringGrid1.row;
myRect.Right := StringGrid1.col+1;
myRect.Bottom := StringGrid1.Row;
end
else
if StringGrid1.Row<StringGrid1.RowCount-1 then
begin
myRect.Left := 1;
myRect.Top := StringGrid1.row+1;
myRect.Right := 1;
myRect.Bottom := StringGrid1.Row+1;
end;
if (StringGrid1.Row<StringGrid1.RowCount-1) or (StringGrid1.Col<StringGrid1.ColCount-1) then
begin
StringGrid1.Selection := myRect;
Application.MessageBox(PCHAR('当前行:'+IntToStr(StringGrid1.Row)+'当前列:'+IntToStr(StringGrid1.Col)),'提示',MB_OK);
end;
end;
stringgrid.setfocus := false;
for I := 0 to stringgrid.ColCount-1 do
for j:= 0 to stringgrid.rowcount-1 do
stringgrid.cells[i,j]:= ''
var i,j:integer;
begin
for I := 0 to stringgrid.ColCount do
for j:= 0 to stringgrid.rowcount do
stringgrid.cells[i,j]:= ''
end;
这个是用一个按钮来。
procedure TForm1.BitBtn1Click(Sender: TObject);
var i,j:integer;
begin
//stringgrid.setfocus := false;
for I := 0 to stringgrid.ColCount do
for j:= 0 to stringgrid.rowcount do
stringgrid.cells[i,j]:= ''
end;
问题已经解决
是zhuoyuesky(卓越) 兄给了我启示,我在selectcell事件中有公共变量没释放,不过还是要谢谢大家
都有分的!!