Get the App
SLTechnology News&Howtos  ›  Development  › 

How to create Visual Studio Toolbar controls in Ribbon Interface

Shulou Source: shulou.com Published: 2022-06-02 06:09:29 09月19日 Update

This article mainly introduces how to create the Visual Studio toolbar control in the Ribbon interface, which is very detailed and has a certain reference value. Interested friends must read it!

Visual Studio after a long period of development, many users are very familiar with the Visual Studio toolbar, here I would like to post a personal understanding, and discuss with you. In the traditional menu interface, the toolbar is widely used as a useful supplement to the menu. By placing some commonly used commands on the toolbar, we can give users intuitive and quick access to common functions and improve efficiency.

In the Ribbon interface, the Visual Studio toolbar has been further enhanced. In addition to the original toolbar function, the toolbar also has extended functions such as drop-down menus due to the use of command buttons.

The following code demonstrates how to create a Visual Studio toolbar control in the Ribbon interface:

CMFCRibbonPanel* pPanel1 = pCategory- > AddPanel (_ T ("From Toolbar")); / / simplest, create a toolbar pPanel1- > AddToolBar (IDR_TOOLBAR) by specifying a toolbar resource through the AddToolBar () function; / / manually create a toolbar CMFCRibbonPanel* pPanel2 = pCategory- > AddPanel (_ T ("Manual")); / / create a button group CMFCRibbonButtonsGroup* pButtonsGroup1 = new CMFCRibbonButtonsGroup / / add a new button to the button group pButtonsGroup1- > AddButton (new CMFCRibbonButton (ID_RIBBON_GBTN_1, _ T ("), 0); pButtonsGroup1- > AddButton (new CMFCRibbonButton (ID_RIBBON_GBTN_2, _ T ("), 1)); / / create an edit box control CMFCRibbonEdit* pEdit = new CMFCRibbonEdit (ID_RIBBON_GBTN_3, 65); / / set the default text pEdit- > SetEditText (_ T ("Edit")) PButtonsGroup1- > AddButton (pEdit); pButtonsGroup1- > AddButton (new CMFCRibbonButton (ID_RIBBON_GBTN_4, _ T ("), 2)); pButtonsGroup1- > AddButton (ID_RIBBON_GBTN_5, _ T ("), 3)); / / add button groups to the panel pPanel2- > Add (pButtonsGroup1); / / add new button groups and buttons CMFCRibbonButtonsGroup* pButtonsGroup2 = new CMFCRibbonButtonsGroup PButtonsGroup2- > AddButton (new CMFCRibbonButton (ID_RIBBON_GBTN_6, _ T ("), 4)); pButtonsGroup2- > AddButton (new CMFCRibbonButton (ID_RIBBON_GBTN_7, _ T ("), 5)); pButtonsGroup2- > AddButton (ID_RIBBON_GBTN_8, _ T ("), 6)); pButtonsGroup2- > AddButton (ID_RIBBON_GBTN_9, _ T ("), 7); pPanel2- > Add (pButtonsGroup2); CMFCRibbonButtonsGroup* pButtonsGroup3 = new CMFCRibbonButtonsGroup CMFCRibbonButton* pBtn10 = new CMFCRibbonButton (ID_RIBBON_GBTN_10, _ T ("), 8); pBtn10- > SetMenu (IDR_RIBBON_MENU_1); pButtonsGroup3- > AddButton (pBtn10); CMFCRibbonButton* pBtn11 = new CMFCRibbonButton (ID_RIBBON_GBTN_11, _ T ("), 9); / / specify a submenu for the button pBtn11- > SetMenu (IDR_RIBBON_MENU_1, TRUE); pButtonsGroup3- > AddButton (pBtn11); pPanel2- > Add (pButtonsGroup3) The above is all the content of the article "how to create Visual Studio toolbar controls in the Ribbon interface". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Tools toolbars buttons interfaces controls menus functions content commands commonly used users articles useful intuitive personal size code value traditions interests Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS Linux vpn Microsoft