dropdownshowtitles=true
dropdownsizing=true
dropdownwidth=-1
例:当前表中只有部门代码无部门名称列,需与部门表建立关联,当点击单元格时以部门代码、部门名称两列下拉列表形式显示。
重载grideh的OnDBGridEh1DrawColumnCell事件void __fastcall TFrmMain::OnDBGridEh1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumnEh *Column,
Gridseh::TGridDrawState State)
{
TDataSet *pDS
pDS = this->DBGridEh1->DataSource->DataSet
if( pDS->Active &&pDS->RecordCount >0 )
{
if( pDS->RecNo %2 == 0 &&!State.Contains( Gridseh:: gdSelected) )
{
((TDBGrid*)Sender)->Canvas->Brush->Color = RGB(228,241,226)//定义背景颜色
((TDBGrid*)Sender)->Canvas->Font->Color = RGB(0,0,255)//字体颜色
((TDBGrid*)Sender)->Canvas->Font->Style = TFontStyles()<<fsBold
}
((TDBGridEh*)Sender)->DefaultDrawColumnCell(Rect, DataCol, Column, State)
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)