根据网课,想在按钮下方引入字,但是并没有,setButtonText函数使用没有问题,位置大家就不要查了,我觉得可能是size部分的问题,但是我不清楚怎么调试,也或许有其他问题,、。谢谢各位大佬
相关代码如下
if (!m_wndToolBar.CreateEx(this, TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP // 主工具栏 zhang flat-->list
| 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
}
this->SetMenu(&m_ImageMainMenu);
m_wndStatusBar.SetPaneInfo(4,IDC_STATUSBAR,SBT_NOBORDERS,38);
// 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);
//the next program from bcuZhang
m_wndToolBar.SetButtonText(0, "打开");
m_wndToolBar.SetButtonText(1, "关闭"); m_wndToolBar.SetButtonText(3, "处理"); m_wndToolBar.SetButtonText(5, "浏览");
m_wndToolBar.SetButtonText(6, "停止浏览");
m_wndToolBar.SetButtonText(7, "向上");
m_wndToolBar.SetButtonText(8, "向下");
m_wndToolBar.SetButtonText(9, "向左");
m_wndToolBar.SetButtonText(10, "向右");
m_wndToolBar.SetButtonText(11, "锁定");
m_wndToolBar.SetButtonText(12, "时间");
m_wndToolBar.SetButtonText(13, "网格"); m_wndToolBar.SetButtonText(15, "加工");
m_wndToolBar.SetButtonText(16, "停止"); m_wndToolBar.SetButtonText(18, "p动");
m_wndToolBar.SetButtonText(19, "f动");
m_wndToolBar.SetButtonText(20, "粉");
m_wndToolBar.SetButtonText(21, "停粉"); m_wndToolBar.SetButtonText(23, "抽");
m_wndToolBar.SetButtonText(24, "停抽"); m_wndToolBar.SetButtonText(26, "关于"); CRect rect;
m_wndToolBar.GetItemRect(0, rect);
m_wndToolBar.SetSizes(rect.Size(), CSize(22, 16)); //the program from bcuZhang end
相关代码如下
if (!m_wndToolBar.CreateEx(this, TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP // 主工具栏 zhang flat-->list
| 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
}
this->SetMenu(&m_ImageMainMenu);
m_wndStatusBar.SetPaneInfo(4,IDC_STATUSBAR,SBT_NOBORDERS,38);
// 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);
//the next program from bcuZhang
m_wndToolBar.SetButtonText(0, "打开");
m_wndToolBar.SetButtonText(1, "关闭"); m_wndToolBar.SetButtonText(3, "处理"); m_wndToolBar.SetButtonText(5, "浏览");
m_wndToolBar.SetButtonText(6, "停止浏览");
m_wndToolBar.SetButtonText(7, "向上");
m_wndToolBar.SetButtonText(8, "向下");
m_wndToolBar.SetButtonText(9, "向左");
m_wndToolBar.SetButtonText(10, "向右");
m_wndToolBar.SetButtonText(11, "锁定");
m_wndToolBar.SetButtonText(12, "时间");
m_wndToolBar.SetButtonText(13, "网格"); m_wndToolBar.SetButtonText(15, "加工");
m_wndToolBar.SetButtonText(16, "停止"); m_wndToolBar.SetButtonText(18, "p动");
m_wndToolBar.SetButtonText(19, "f动");
m_wndToolBar.SetButtonText(20, "粉");
m_wndToolBar.SetButtonText(21, "停粉"); m_wndToolBar.SetButtonText(23, "抽");
m_wndToolBar.SetButtonText(24, "停抽"); m_wndToolBar.SetButtonText(26, "关于"); CRect rect;
m_wndToolBar.GetItemRect(0, rect);
m_wndToolBar.SetSizes(rect.Size(), CSize(22, 16)); //the program from bcuZhang end
解决方案 »
- redui大神,临走前我还想说句心里话,国内的项目这么有技术含量,怎么真正的高手都跑国外去了?
- VC++ 6.0编写的邮件收发系统
- 关于overlapped,发现个很奇怪的问题
- 用odatabase连接数据库
- 用vc实现siemens s7系列plc通信
- 高分请教黑白位图的膨胀处理算法
- 关于WinSock API的疑惑:select()、send()、recv()究竟该怎么用?
- 神呀!救救我吧!!--菜鸟级问题!!
- 如果你是环保注意者,你爱环保,并且愿意作出努力,请进。
- 请问:怎样在局域网上得到一台NT主机的进入口令
- vs2012开发的读写智能设备程序,在其他PC机上读写不了。
- 谁有pDF增效工具软件
CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// if text at right
// m_wndToolBar1.ModifyStyle(0,TBSTYLE_LIST);
// set bmp
m_bmToolbar.LoadBitmap(IDB_COLOR);
m_wndToolBar1.SetBitmap((HBITMAP)m_bmToolbar);
// cmd ID
UINT IDArray[]={ID_BT_1,ID_SEPARATOR,ID_BT_2,ID_SEPARATOR,
ID_BT_3,ID_SEPARATOR,ID_BT_4,ID_SEPARATOR,
ID_BT_5,ID_SEPARATOR,ID_BT_6,ID_SEPARATOR,
ID_BT_7,ID_SEPARATOR,ID_BT_8,ID_SEPARATOR,ID_BT_9};
int nIDCount = sizeof(IDArray)/sizeof(UINT);
m_wndToolBar1.SetButtons(IDArray,nIDCount);
for(int jj=0;jj<nIDCount;jj++)
{// have to be inside 'for' !!! if text under img
m_wndToolBar1.SetSizes(CSize(40,40),CSize(16,15));
if (m_wndToolBar1.GetButtonStyle(jj) == TBBS_SEPARATOR) continue;
m_wndToolBar1.SetButtonText(jj,"测试");
}
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
m_wndToolBar1.SetSizes(CSize(40,40),CSize(16,15));
这句必须在 for 内