怎样在状态栏上添加CEdit控件?????? 怎样在状态栏上添加CEdit控件??????使在CEit控件上可以输入。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 方法一:同意楼上说法方法二:创建CStatusCtrl m_wndStatusCtrl创建CEdit m_wndEdit;wndEdit.SetParent(&wndStatusCtrl);然后调用MoveWindow调整位置 参考int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create }// add edit box in the toolbar CToolBarCtrl &pTool = m_wndToolBar.GetToolBarCtrl(); TBBUTTON tButton; ZeroMemory(&tButton, sizeof(TBBUTTON)); tButton.fsStyle = TBSTYLE_SEP; tButton.idCommand = IDC_EDITBOX; pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton); CRect rcButton; pTool.GetItemRect(pTool.CommandToIndex(IDC_EDITBOX), rcButton); int nWidth = 50; for (int i = 0; i < nWidth / rcButton.Width(); i++) { pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton); } pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton); rcButton.right += nWidth; rcButton.bottom=50; m_Edit.CreateEx(WS_EX_CLIENTEDGE, "EDIT", "5000", WS_VISIBLE | WS_CHILD, rcButton, &pTool, IDC_EDITBOX); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); return 0;} 窗口的显示视口的问题~! 如何把vs2005mfc程序变成vs2010cmfc 关于工具栏下拉按钮弹出窗口的问题 **ActiveX在线录音控件中使用mp3enc.ocx进行格式转的问题** 纯技朮问题,nobody can solve it.以自定义类型做vector的元素,使用时产生error 树控件消息映射的问题! 缩在托盘区的非当前活动窗口的警告框(MessageBox)如何才能显示在用户面前 在对文件访问时发生了不明错误? 运用Kmeans算法解决一个模式识别的问题 在什么地方有mfc类库的电子版啊,要中文的!谁有呢,请告一声! 线程结束出错 我在做系统时,怎么出现死机?
同意楼上说法
方法二:
创建CStatusCtrl m_wndStatusCtrl
创建CEdit m_wndEdit;
wndEdit.SetParent(&wndStatusCtrl);
然后调用MoveWindow调整位置
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// add edit box in the toolbar
CToolBarCtrl &pTool = m_wndToolBar.GetToolBarCtrl();
TBBUTTON tButton;
ZeroMemory(&tButton, sizeof(TBBUTTON));
tButton.fsStyle = TBSTYLE_SEP;
tButton.idCommand = IDC_EDITBOX;
pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton);
CRect rcButton;
pTool.GetItemRect(pTool.CommandToIndex(IDC_EDITBOX), rcButton);
int nWidth = 50;
for (int i = 0; i < nWidth / rcButton.Width(); i++)
{
pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton);
}
pTool.InsertButton(pTool.CommandToIndex(ID_LIGHT), &tButton);
rcButton.right += nWidth;
rcButton.bottom=50;
m_Edit.CreateEx(WS_EX_CLIENTEDGE, "EDIT", "5000", WS_VISIBLE | WS_CHILD, rcButton, &pTool, IDC_EDITBOX);
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
} // TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar); return 0;
}