问大家:如何获得你所点几的DBGrid的单元阁的位置,我要在哪个位置上+个控件,我要我所点机单元个的Left,Top ,Width,Height(200分)

P

pzoon

Unregistered / Unconfirmed
GUEST, unregistred user!
问大家:如何获得你所点几的DBGrid的单元阁的位置,我要在哪个位置上+个控件,我要我所点机单元个的Left,Top ,Width,Height
都急死我了,我看了好久的帮助就是没有,但是我看到别人的程序里能加的呀
那位大哥告诉我怎么写,谢谢
 
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
if(State.Contains(gdSelected))
{
Top=Rect.Top;
Left=Rect.Left;
Height=Rect.Height();
Width=Rect.Width();
}
}
 
谢谢你,根据你的提示问题已经解决,谢谢,代码如下:
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
if(State.Contains(gdSelected))
{
if(DBGrid1->SelectedField->DataType == ftDateTime)
{
dt1->Left = Rect.Left+ DBGrid1->Left+ 2;
dt1->Top = Rect.Top+ DBGrid1->Top+2;
dt1->Width = Rect.Right - Rect.Left;
dt1->Height = Rect.Bottom - Rect.Top;
dt1->Visible = True;
}
}
else
{
dt1->Visible = false;
}
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部