如何在StringGrid中做出下拉框?

lyq81404 2003-09-14 10:32:43
如何在StringGrid中做出下拉框?
...全文
119 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
domustdo 2003-10-15
  • 打赏
  • 举报
回复
在StringGrid的cell中嵌入ComboBox
void __fastcall TForm1::FormCreate(TObject *Sender)
{
...
pComboEditor = new TComboBox(this);
pComboEditor->Parent = this;
pComboEditor->Visible = false;
pComboEditor->Style = csDropDownList;
pComboEditor->OnChange = ComboEditorChange;
...
}

void __fastcall TForm1::PlaceComboEditor(void)
{
TRect Rect = StringGrid1->CellRect(StringGrid1->Col,StringGrid1->Row);
pComboEditor->Top = StringGrid1->Top;
pComboEditor->Left = StringGrid1->Left;
pComboEditor->Text = EmptyStr;
pComboEditor->Top = pComboEditor->Top + Rect.Top +
StringGrid1->GridLineWidth;
pComboEditor->Left = pComboEditor->Left +
Rect.Left + StringGrid1->GridLineWidth+1;
pComboEditor->Height = (Rect.Bottom - Rect.Top) + 1;
pComboEditor->Width = (Rect.Right - Rect.Left) + 0;
pComboEditor->Visible = true;
pComboEditor->SetFocus();
}
ljianq 2003-10-13
  • 打赏
  • 举报
回复
使用TMS的控件方便,在http://www.51delphi.com/有下载。
chnlog 2003-10-12
  • 打赏
  • 举报
回复
到www.ffsoft.net/index.htm上去看看
czxwm 2003-10-12
  • 打赏
  • 举报
回复
关注

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧