为什么我自绘的ComboBox没在Edit部分显示呢?

guxue365 2014-03-29 08:06:29

如图所示,选中某一个图案后在Edit没有显示,请问是什么原因?
DrawItem部分代码如下:
CRect rc = lpDrawItemStruct->rcItem;
CDC dc;

if (!dc.Attach(lpDrawItemStruct->hDC))
{
return;
}

Graphics g(dc.m_hDC);

Pen pen(Color(255,0,0),1);
if (lpDrawItemStruct->itemState & ODS_FOCUS)
{
g.DrawRectangle(&pen,rc.left,rc.top,rc.Width(),rc.Height());
}

if (lpDrawItemStruct->itemID == -1)
return;

HatchBrush hbr((HatchStyle)GetItemData(lpDrawItemStruct->itemID),Color(0,0,0),Color(255,255,255));

g.FillRectangle(&hbr,rc.left,rc.top,rc.Width(),rc.Height());

dc.Detach();
...全文
78 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
向立天 2014-03-29
  • 打赏
  • 举报
回复
如果你不需要输入文字可以考虑使用droplist模式
schlafenhamster 2014-03-29
  • 打赏
  • 举报
回复
在edit窗口的句柄中画
guxue365 2014-03-29
  • 打赏
  • 举报
回复
那就是说DrawItem都是在listbox中画,如果想画到Edit中呢?
schlafenhamster 2014-03-29
  • 打赏
  • 举报
回复
Edit是另一个窗口,与listbox 不在一起.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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