True color graph toolbar

xiaoxiao2021-03-05  21

#define IDC_MAIN_TOOLBAR 1001 # include InitCommonControls (); case WM_CREATE: hWndToolBar = CreateToolBar (hWnd); break; case WM_SIZE: hWndToolBar = GetDlgItem (hWnd, IDC_MAIN_TOOLBAR); SendMessage (hWndToolBar, WM_SIZE, 0,0); break; HWND CreateToolBar (HWND hWndParent) {HWND hWndTB; TBBUTTON tbb [4]; // TBADDBITMAP tbab; hWndTB = CreateWindowEx (0, TOOLBARCLASSNAME, TEXT ( ""), WS_CHILD | WS_VISIBLE | CCS_NODIVIDER | TBSTYLE_LIST, 0,0,0 , 0, hWndParent, (HMENU) IDC_MAIN_TOOLBAR, hInst, NULL); if (! hWndTB) return 0; SendMessage (hWndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof (TBBUTTON), 0); HIMAGELIST hImageList = ImageList_Create (32,28, ILC_COLOR24 , 3,1); HBITMAP hBitmap = LoadBitmap (hInst, MAKEINTRESOURCE (IDB_MAIN_TOOLBAR)); ImageList_Add (hImageList, hBitmap, NULL); DeleteObject (hBitmap); SendMessage (hWndTB, TB_SETIMAGELIST, 0, (LPARAM) hImageList); // tbab .hinst = null; //tbab.nid = idb_toolbar; // sendMessage (hwndtb , TB_ADDBITMAP, (WPARAM) (INT) 2, (LPARAM) & TBAB); ZeromeMory (TBB, SIZEOF (TBB)); TBB [0] .IBitmap = makelong (0,0); TBB [0] .fsState = TBSTATE_ENABLED; TBB [0] .fsStyle = TBStyle_Button | BTNS_AUTOSIZE; TBB [0] .idcommand = idm_find; TBB [0] .istring = (int_ptr) Text ("Find"); TBB [1] .Ibitmap = makelong (1,0) ; TBB [1] .fsState = TBSTATE_ENABED; TBB [1] .fsStyle = TBStyle_Button | BTNS_AUTOSize; TBB [1] .idcommand = IDM_BACK; TBB [1] .istring = (int_ptr) Text ("Back"); TBB [2 ] .IBITMAP = makelong (2,0); TBB [2] .fsState = TBSTATE_ENABED; TBB [2] .fsStyle = TBStyle_Button | BTNS_AUTOSIZE; TBB [2] .idcommand = IDM_FORWARD; TBB [2] .istring = (int_ptr) TEXT ("

Forward "); TBB [3] .IBitmap = makelong (3,0); TBB [3] .fsState = TBSTATE_ENABED; TBB [3] .fsStyle = TBSTYLE_BUTTON | BTNS_AUTOSIZE; TBB [3] .idCommand = IDM_VIEW; TBB [ 3] .ustring = (int_ptr) Text ("View"); SendMessage (HWNDTB, TB_ADDBUTTONS, SIZEOF (TBB) / SizeOf (TbButton); SendMessage (HWNDTB, WM_SIZE, 0, 0); Return Hwndtb }

The program is running as follows:

转载请注明原文地址:https://www.9cbs.com/read-32581.html

New Post(0)