How to Create a 24-digit Toolbar

Source: Internet
Author: User

Step 1:
Declare the member variables in the mainframe. h file:

CToolBar m_hotToolBar;

Create a toolbar in cmainframe: oncreate (). Assume that you have created a toolbar resource and two bitmap resources: idb_toolbar_cold and idb_toolbar_hot. The former indicates normal buttons, the latter indicates the status button when the mouse moves above. Use the following code to create a toolbar:

if (!m_hotToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP  | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||  !m_hotToolBar.LoadToolBar(IDR_HOTBAR)) {  TRACE0("Failed to create toolbar/n");  return -1;      // fail to create }

Step 2:

Add the following code in cmainframe: oncreate () to access bitmap resources:

// Set up hot bar image lists. CImageList imageList; CBitmap  bitmap; // Create and set the normal toolbar image list. bitmap.LoadBitmap(IDB_TOOLBAR_COLD); imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1); imageList.Add(&bitmap, RGB(255,0,255)); m_hotToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList); imageList.Detach(); bitmap.Detach(); // Create and set the hot toolbar image list. bitmap.LoadBitmap(IDB_TOOLBAR_HOT); imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1); imageList.Add(&bitmap, RGB(255,0,255)); m_hotToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList); imageList.Detach(); bitmap.Detach();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.