Do you think that the menu provided by Delphi doesn't have a beautiful feeling? You can implement an IE style menu with the VCL control you bring on Delphi! Features include: floating buttons, drag positioning, graphics ... All of these do not need any third-party controls, nor does it require a lot of programming!
Implement an IE-style menu requires the following steps: 1. Define a normal menu according to normal mode; 2. Hide the defined menu from the window; 3. Add Coolbar and Toolbar to the window, as a menu bar; 4 , Map the menu to the Toolbar button; 5, programming for special effects (optional).
The first step is to define a normal menu in normal ways. Add a TMAINMENU control in the window, then define menu items, icons, shortcuts, etc. in the usual manner.
Step 2, hide the defined menu from the window. The defined menu will be automatically displayed on the window. This is because when the TMAINMENU control is added to the window, the MENU property of the TFORM object is automatically set to an increased TmainMenu object. In order to use our own defined menus, you must hide this menu. Clear TForm.Menu, the defined menu will not be displayed automatically.
Step 3, add Coolbar and Toolbar in the window, as a menu bar. Add a TCOOLBAR control to the window and put a TToolbar control in it. Set the AutoLBar and Ttoolbar's AutoSize property for True, set Ttoolbar's FLAT attribute to true, and set the Ttoolbar's showcaptions attribute to true. In this way, there is a blank menu bar above the window. Next we will add menu items to this menu bar.
Step 4, map the menu to the Toolbar button. Use Right-click Ttoolbar to select New Button from the pop-up menu, add the first button to the menu bar. Set the autosize property of this button and the groupage attribute to true, then change the CAPTION property to the menu item. For example, the CAPTION property may be set to & file. Finally, set this button's MenuItem property to the corresponding menu item defined in the TMAINMUUU. For example, the MenuItem property may be set to mnufile. After these settings, the button will be linked together, and the corresponding menu will pop up when you click the button.
The fifth step is to program a special effect (optional). After four steps in the four steps, the new menu is already working properly. However, if you want to implement other effects, such as Coolbar drag positioning, etc., you need to make some programming work. These contents are no longer discussing the theme of this article, and if you are interested, readers can refer to Delphi's help.
Welcome readers to present their own opinions on this paper.