BOOL CToolsDlg::OnInitDialog()
{
CToolBar m_wndToolBar;
m_wndToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_BORDER_BOTTOM);
m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);}为什么加不上啊??
是CDialog程序!!!!
{
CToolBar m_wndToolBar;
m_wndToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_BORDER_BOTTOM);
m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);}为什么加不上啊??
是CDialog程序!!!!
解决方案 »
- [急切求助]如何实现异步非阻塞Socket通信(TCP)?
- vc中用serialport类实现串口通信时,连续的发送多次命令后,再次发送数据失败 急!!!!!!!!!!!
- COM高手请进,编译器报这个错误是怎么回事?
- 关于HWND的一个小问题
- 有谁用过电力宽带?就是用USB接口电力猫的那种
- ADO不支持98吗?
- 如何另开一个线程进行socket监听
- 谁做过发送邮件的软件?
- 各位大哥帮帮忙啊!!请问在Win 2000 和WinXP 下调用关机的函数是什么?(在线等待)
- 请问一个ODBC访问数据库的问题!
- 100分求解!!如何将位图存到odbc数据库(ASSECC或sql server)中请个位大侠指点!!小第深表感谢!!
- 如何读取PDF文档
对话框目录中的《在Dialog中使用Menu和Toolbar》
首先在:OnInitDialog中加上:
if (!m_wndToolBar.Create( this ) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1) )
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY );怎么还是不显示!!!!!!!!!!!!!????????????????????????!!!!!!!!!!!!!!!!!!
但还是有点不明白啊!·!m_wndToolBar.CreateEx( this,TBSTYLE_FLAT , WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS,CRect(0,0,0,0));
m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST, 0);这里RepositionBars()是什么意思??
AFX_IDW_CONTROLBAR_FIRST有是什么?在msdn里都没找到啊!谢谢
--------Called to reposition and resize control bars in the client area of a window.
m_pImageList = new CImageList;
SetupImages(m_pImageList);TBBUTTON tb;m_ToolBar = new CToolBarCtrl;
m_ToolBar->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|TBSTYLE_FLAT,
CRect(0,0,0,0), this, 0);m_ToolBar->SetImageList(m_pImageList);
tb.iBitmap = 0;
tb.iString = NULL;
tb.fsState = TBSTATE_ENABLED;
tb.fsStyle = TBSTYLE_BUTTON;
tb.idCommand = ID_HELP_ABOUT;m_ToolBar->AddButtons(1, &tb);
tb.iBitmap = 1;
tb.idCommand = ID_BOLD;
m_ToolBar->AddButtons(1, &tb);
tb.iBitmap = 2;
tb.idCommand = ID_DRAWING;
m_ToolBar->AddButtons(1, &tb);TBBUTTON tb1;
tb1.fsStyle = TBSTYLE_SEP;
m_ToolBar->AddButtons(1, &tb1);tb.iBitmap = 3;
tb.idCommand = ID_STRIKEOUT;
tb.iString = NULL;
m_ToolBar->AddButtons(1, &tb);
AFX_IDW_CONTROLBAR_FIRST 代表的数字为 0
AFX_IDW_CONTROLBAR_LAST 代表数字为 0xffff
你可以试试
RepositionBars(0,0xffff,NULL)也可以的
另外,在对话框中创建工具栏时应该用CreateEx()