Use C # and VB. NET to implement VS. NET or Office XP menus (3)

Source: Internet
Author: User

 

Use C # and VB. NET to implement VS. NET or Office XP menus

Stingy god 2001.08.18

3. "MenuItemStyle"Interfaces andVS. NETStyle menu items

 

ThisProjectSwitchC# Language. In my opinion,Office200Style,VS. NETDefine a unified interface (Interface), Including the imageIcon(DrawIcon), Draw segmentation (DrawSeparator), Draw a menu background (DrawBackground), Write the text of the menu item (DrawMenuText,Office2000AndVS. NETThis interface is implemented based on different situations.Drawxxx. ThenMenuItemInherit a subclass, as described in the second sectionOverridesTwo Functions of the menu item:OnMeasureItemAndOnDrawItemTo callDrawXXXFunction. Finally, I separated all the parts and placed them in. CSFile, compiled into oneVSNET. Menu. DLL, You only useUsing VSNET. Menu;Then you can use the commonMenuItemThat way,DemoIn the source code, you can also see that I have definedIconMenuItemClass, it has a method:MenuItemCreator(VSNET. Menu. IconMenuStyle sType, String sText, Bitmap bmp, System. EventHandler eh) To generate the requiredMenuItem. Originally, I wanted to use source files or upload imagesIconResources are placed in a special file, and then the class is responsible for obtaining resources from the resource file or external class.CreateMenuItem. But it's the first version. You will see that I still use the originalNew Bitmap() Method to obtain resources directly from the hard disk. When I see itShowWhen I came out, I was very happy. Then I found that there were still many improvements. I thought it would take a lot of effort to make a professional menu.

Okay, let's take a look atVS.

Related Article

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.