我在ColEnter事件中写:
procedure TForm1.DBGridEh1ColEnter(Sender: TObject);
begin
ShowMessage('Row = ' + IntToStr(DBGridEh1.Row) + ' Col = ' +
IntToStr(DBGridEh1.Col) + ' ' +
IntToStr(DBGridEh1.CellRect(DBGridEh1.Row,DBGridEh1.Col).Left));
end;不管用,那位检查一下,帮忙给个解决办法,谢谢!
procedure TForm1.DBGridEh1ColEnter(Sender: TObject);
begin
ShowMessage('Row = ' + IntToStr(DBGridEh1.Row) + ' Col = ' +
IntToStr(DBGridEh1.Col) + ' ' +
IntToStr(DBGridEh1.CellRect(DBGridEh1.Row,DBGridEh1.Col).Left));
end;不管用,那位检查一下,帮忙给个解决办法,谢谢!
解决方案 »
- delphi中aliasname属性
- DBChart组件中怎样控制表示的记录个数?
- businesskinform组伯集中的bsskinmainmenubar组件问题
- 用OLEDB把excel中的数据导入数据库的问题
- 谁有EAN-13条码字体,死活找不到..
- 技术经理需要做哪些事?
- 如何让DBGRID多选删除后多选状态消失,或者变为只选中一条信息。50分。
- win2000怎么关机
- 一个关于BLOB字段通过OLECONTAINER读取和显示的问题(急)
- delphi2010 怎么实现通用的修改图片尺寸方法
- TBlobField;如何定义
- 如何对Database Desktop类型的表中的字段进行求和? 在线等待
我是想取该坐标,在该坐标下方弹出一个面板DBGridEh1.CellRect(DBGridEh1.Row,DBGridEh1.Col).Left得不到正确的单元格坐标,很多单元格都为Left = 0
StringGrid1.CellRect(StringGrid1.Col,StringGrid1.Row).Top这是用于StringGrid1的,也可以用于DBGridEh1,
看看
http://expert.csdn.net/Expert/topic/1986/1986064.xml?temp=.1791498
我照你的测了一下,代码如下:
procedure TForm1.DBGridEh1ColEnter(Sender: TObject);
var
pLT: TPoint;
pRB: TPoint;
rRect: TRect;
begin
rRect := DBGridEh1.CellRect(DBGridEh1.row,DBGridEh1.col);
pLT := DBGridEh1.ClientToScreen(Point(rRect.Left, rRect.Top));
pRB := DBGridEh1.ClientToScreen(Point(rRect.Right, rRect.Bottom)); Panel1.Left := pLT.X;
Panel1.Top := pRB.Y;
end;Panel1的位置也不知道是按什么规律在动,到处瞎蹦
拜托哪位测一下,我想让Panel1以单元格Left为左边届,贴着单元格下边显示tanqth(青蛙) :我的方法和你给出贴子中得分那位兄弟的一样
var
pLT: TPoint;
pRB: TPoint;
rRect: TRect;
begin
rRect := DBGridEh1.CellRect(DBGridEh1.col, DBGridEh1.row); //反了 pLT := DBGridEh1.ClientToParent(rRect.TopLeft); //用ClientToParent
pRB := DBGridEh1.ClientToParent(rRect.BottomRight); //用法见帮助 Panel1.Left := pLT.X;
Panel1.Top := pRB.Y; Panel1.Caption := 'Left = ' + IntToStr(pLT.X) + ' Bottom = ' + IntToStr(pRB.Y);end;
begin
showmessage(inttostr(dbgrideh1.Row));
showmessage(inttostr(dbgrideh1.SelectedIndex));
end;