procedure TfrmuMulCond.sgCondSelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var R:TRect;
begin
.
.
.
R:=sgCond.CellRect(ACol,ARow);
sgCond.SetFocus ; sgCond.DefaultRowHeight:=cbxGX.Height; if ACol=COL_MATH then
begin
cbxGX.Left:=sgCond.Left+R.Left+1;
cbxGX.Top:=sgCond.Top+R.Top+1;
cbxGX.Width:=R.Right-R.Left;
cbxGX.Visible :=True;
cbxGX.Items.Clear ;
end;
end;
请问为什么在进行一系列操作(如点击,上下移动[move]各行位置)后,会出现combobox框的位置与stringgrid的cell位置不在一个位置上,combobox经常在cell的下面一点点,看起来很不好看!!!哪位知道是什么原因导致的???
ARow: Integer; var CanSelect: Boolean);
var R:TRect;
begin
.
.
.
R:=sgCond.CellRect(ACol,ARow);
sgCond.SetFocus ; sgCond.DefaultRowHeight:=cbxGX.Height; if ACol=COL_MATH then
begin
cbxGX.Left:=sgCond.Left+R.Left+1;
cbxGX.Top:=sgCond.Top+R.Top+1;
cbxGX.Width:=R.Right-R.Left;
cbxGX.Visible :=True;
cbxGX.Items.Clear ;
end;
end;
请问为什么在进行一系列操作(如点击,上下移动[move]各行位置)后,会出现combobox框的位置与stringgrid的cell位置不在一个位置上,combobox经常在cell的下面一点点,看起来很不好看!!!哪位知道是什么原因导致的???
解决方案 »
- delphi2007安装后出现F1027 unit not found:'system.pas' or equvalents
- 如何在公共文件中实现子文件的功能
- 问一个简单的问题
- 急!!!做项目时遇到一个问题,请高手帮助!
- application.run(主程序执行时,都运行些什么事件,active,show,create....)它们的顺序?
- 一个bde数据库问题!高手们赶紧进来!
- ★★请问turbo pascal 7.0中的清屏命令是什么?就像QB中的CLS命令。
- DataBase在NT Service程序怎么用?要多少分我给多少分!
- 高手请进,怎样用delphi连接access数据库!
- 如何用程序删除memo中的内容?
- adoquery中如何调用参数
- EASY,100分,在线等!!!
sgCond.DefaultRowHeight:=cbxGX.Height; ->cbxGX.Height := StringGrid1.DefaultRowHeight;就沒事了!!
procedure TForm1.FormCreate(Sender: TObject);
begin
stringgrid1.defaultrowheight:=combobox2.Height;
combobox2.Visible:=false;
end;procedure TForm1.ComboBox2Exit(Sender: TObject);
begin
stringgrid1.cells[stringgrid1.col,stringgrid1.row]:=combobox2.items[combobox2.itemindex];
combobox2.Visible:=false;
stringgrid1.setfocus;end;procedure TForm1.ComboBox2Change(Sender: TObject);
begin
stringgrid1.cells[stringgrid1.col,stringgrid1.row]:=combobox2.items[combobox2.itemindex];
combobox2.Visible:=false;
stringgrid1.setfocus;end;procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var
R:TRect;
Num:integer;
begin
if (acol<>2) then
canselect:=false
else
if acol=5 then
begin
r:=stringgrid1.cellrect(acol,arow);
r.left:=r.left+stringgrid1.left;
r.right:=r.right+stringgrid1.left;
r.top:=r.top+stringgrid1.top;
r.bottom:=r.bottom+stringgrid1.top;
combobox2.left:=r.left+1;
combobox2.top:=r.top+1;
combobox2.width:=(r.right+1)-r.left;
combobox2.height:=(r.bottom+1)-r.top;
combobox2.Visible:=true;
combobox2.setfocus;canselect:=true;
end;
end;