根據網課,想在按鈕下方引入字,但是并沒有,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
uj5u.com熱心網友回復:
將所有"..."替換為_T("...")uj5u.com熱心網友回復:
http://blog.163.com/ygb_wmj/blog/static/21506504120133110525973/uj5u.com熱心網友回復:
例子:
m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT , WS_CHILD | WS_VISIBLE |
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);
uj5u.com熱心網友回復:
{// have to be inside 'for' !!! if text under imgm_wndToolBar1.SetSizes(CSize(40,40),CSize(16,15));
這句必須在 for 內
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/109609.html
標籤:界面
上一篇:誰有pDF增效工具軟體
下一篇:windows列印超長 圖片
