LopezPhil | Bonjour !
Ce code marche, mais je désire intégrer mes propres images...
Des exemples seraient plus productifs que des critiques ! Merci d'avance !
Code :
- void InitToolBar(HWND hwndParent) {
- #define NOMBRE_BOUTONS 10 // Bouttons et séparations
- TBADDBITMAP tbab;
- TBBUTTON tbb[NOMBRE_BOUTONS];
- HINSTANCE g_hInstance;
- ToolBar = CreateWindowEx(
- WS_EX_WINDOWEDGE,
- TOOLBARCLASSNAME,
- NULL,
- WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT| WS_BORDER,
- 0, 0, 0, 0,
- hwndParent,
- 0,
- g_hInstance,
- NULL);
- SendMessage(ToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
- tbab.hInst = HINST_COMMCTRL;
- tbab.nID = IDB_STD_SMALL_COLOR;
- SendMessage(ToolBar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
- ZeroMemory(tbb, sizeof(tbb));
- tbb[0].iBitmap = STD_FILENEW;
- tbb[0].fsState = TBSTATE_ENABLED;
- tbb[0].fsStyle = TBSTYLE_BUTTON;
- tbb[0].idCommand = M_FILE_NEW;
- tbb[1].iBitmap = STD_FILEOPEN;
- tbb[1].fsState = TBSTATE_ENABLED;
- tbb[1].fsStyle = TBSTYLE_BUTTON;
- tbb[1].idCommand = M_FILE_OPEN;
- tbb[2].iBitmap = STD_FILESAVE;
- tbb[2].fsState = TBSTATE_ENABLED;
- tbb[2].fsStyle = TBSTYLE_BUTTON;
- tbb[2].idCommand = M_FILE_SAVE;
- tbb[3].fsStyle = TBSTYLE_SEP;
- tbb[4].iBitmap = STD_UNDO;
- // tbb[4].fsState = TBSTATE_ENABLED;
- tbb[4].fsStyle = TBSTYLE_BUTTON;
- tbb[4].idCommand = M_EDIT_UNDO;
- tbb[5].iBitmap = STD_REDOW;
- // tbb[5].fsState = TBSTATE_ENABLED;
- tbb[5].fsStyle = TBSTYLE_BUTTON;
- tbb[5].idCommand = M_EDIT_UNDO;
- tbb[6].fsStyle = TBSTYLE_SEP;
- tbb[7].iBitmap = STD_CUT;
- tbb[7].fsState = TBSTATE_ENABLED;
- tbb[7].fsStyle = TBSTYLE_BUTTON;
- tbb[7].idCommand = M_EDIT_DEL;
- tbb[8].iBitmap = STD_COPY;
- tbb[8].fsState = TBSTATE_ENABLED;
- tbb[8].fsStyle = TBSTYLE_BUTTON;
- tbb[8].idCommand = M_EDIT_COPY;
- tbb[9].iBitmap = STD_PASTE;
- // tbb[9].fsState = TBSTATE_ENABLED;
- tbb[9].fsStyle = TBSTYLE_BUTTON;
- tbb[9].idCommand = M_EDIT_PASTE;
- SendMessage(ToolBar, TB_ADDBUTTONS, NOMBRE_BOUTONS, (LPARAM)&tbb);
- }
|
|