Home > Software engineering >  Questions about MFC engineering CToolBar cannot display Chinese characters
Questions about MFC engineering CToolBar cannot display Chinese characters

Time:10-04

According to online classes, want to introduce words at the bottom of the button, but no, setButtonText function USES no problem, where you don't look up, I think may be the size of the problem, but I don't know how to debug, may also have other problems,,, thank you,
The code below
 if (! M_wndToolBar. CreateEx (this, TBSTYLE_LIST WS_CHILD | WS_VISIBLE | CBRS_TOP//main toolbar zhang flat - & gt; A list 
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) | |
! M_wndToolBar. LoadToolBar (IDR_MAINFRAME))
{
TRACE0 (" Failed to create the toolbar \ n ");
return -1;//fail to create
}
This - & gt; SetMenu (& amp; 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 (& amp; M_wndToolBar);
//the next program from bcuZhang
M_wndToolBar. SetButtonText (0, "open");
M_wndToolBar. SetButtonText (1, "closed");

M_wndToolBar. SetButtonText (3, "processing");

M_wndToolBar. SetButtonText (5, "browse");
M_wndToolBar. SetButtonText (6, "stop reading");
M_wndToolBar. SetButtonText (7, "up");
M_wndToolBar. SetButtonText (8, "down");
M_wndToolBar. SetButtonText (9, "left");
M_wndToolBar. SetButtonText (10, "right");
M_wndToolBar. SetButtonText (11, "lock");
M_wndToolBar. SetButtonText (12, "time");
M_wndToolBar. SetButtonText (13, "grid");

M_wndToolBar. SetButtonText (15, "processing");
M_wndToolBar. SetButtonText (16, "stop");

M_wndToolBar. SetButtonText (18, "p");
M_wndToolBar. SetButtonText (19, "f");
M_wndToolBar. SetButtonText (20, "powder");
M_wndToolBar. SetButtonText (21, "stop powder");

M_wndToolBar. SetButtonText (23, "smoke");
M_wndToolBar. SetButtonText (24, "stop smoking");

M_wndToolBar. SetButtonText (26, "on");

CRect the rect.
M_wndToolBar. GetItemRect (0, the rect);
M_wndToolBar. SetSizes (the rect. The Size (), CSize (22, 16));

//the program from bcuZhang end

CodePudding user response:

All "... "Is replaced by the _T ( "... ")

CodePudding user response:

http://blog.163.com/ygb_wmj/blog/static/21506504120133110525973/

CodePudding user response:

Example:
 
M_wndToolBar1. CreateEx (this, TBSTYLE_FLAT WS_CHILD | WS_VISIBLE |
CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
//if the text at right
//m_wndToolBar1 ModifyStyle (0, TBSTYLE_LIST);
//set the 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{//have to be inside the 'for'!!! If the text under img
M_wndToolBar1. SetSizes (CSize (40, 40), CSize (16 (9));
If (m_wndToolBar1. GetButtonStyle (jj)==TBBS_SEPARATOR) continue;
M_wndToolBar1. SetButtonText (jj, "test");
}
RepositionBars (AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

CodePudding user response:

{//have to be inside the 'for'!!! If the text under img
m_wndToolBar1. SetSizes (CSize (40, 40), CSize (16 (9));
It must be within the for
  • Related