Implement ribbon-style forms

Source: Internet
Author: User

 

With the rise of office2007, Microsoft has shown us a Ribbon-style form, and many software have begun to use the Ribbon style.
So what should we do if we want to develop it on our own? This article addresses this issue.

First of all, Delphi itself does not have Ribbon-style Windows that can be used directly. Many Ribbon-like styles on the market are made in usage, which is very troublesome, in addition, the image control requirements are extremely high. This will undoubtedly increase the software cost. Here we will introduce how to use third-party controls and DevExpress Bar 6 to complete Ribbon-style interfaces.

First download and install DevExpress Bar 6, note that it must be 6. In previous versions, there is no Ribbon style, and then install it in Delphi2007. Next, you can start to get started.

1. Drag and Drop necessary controls

These controls are essential to Ribbon and are dragged to the form.

On the drag-and-drop interface, you can see that the Ribbon Tab is displayed, but it is not the effect we want. Next, set the properties of the control.
Set the BarManager attribute of dxRibbon to the DxBarManager control and the Ribbon attribute of dxRibbonPopupMenu to the dxRibbon control. Double-click the dxBarManager control and create a new ToolBar.

A ToolBar named dxBarManager1Bar1 will be added to the Object Inspector. Set the QuickAccessToolBar. ToolBar attribute of dxRibbon to dxBarManager1Bar1. You can see that ApplicationMenu is displayed.

Right-click the arrow on the Right of ApplicationMenu and add several buttons. Double-click dxBarManager, add ToolBar, right-click dxRibbon, select Tabs Editor, and select the Tab in the pop-up window. Double-click the Groups property to add a Group and associate the newly added ToolBar with the Group. Program Interface

Run the program to check the effect.

We can see the results, but it is a little different from office2007. We have to remove the title bar so that the text in the title bar is displayed in Ribbon. This place requires a tip. Switch to the Code view by pressing F12, add the reference of dxRibbonForm under uses, and change the base class of the form from TForm to TDxRibbonForm. Set the SupportNonClientDrawing attribute of the dxRibbon control to True. Run the program again.

Now we can see that the effect is Ribbon, but there is still nothing to do With ApplicationMenu. We need to add a menu under ApplicationMenu. Double-click the ItemLinks attribute of the dxBarApplicationMenu control. A small window is displayed in the upper-left corner of the screen. This form is used for ApplicationMenu. add buttons and groups to it.

Run the program again and click the circular pattern in the upper left corner to see ApplicationMenu. The creation of the Ribbon form is also over.

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.