Results 1 to 24 of 24

Thread: Office XP Style Menu's in vb.net?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Toronto, Ontario, Canada
    Posts
    275

    Office XP Style Menu's in vb.net?

    how do i make my menus look like the ones in Office XP?

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Dont gain the world and lose your soul

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Toronto, Ontario, Canada
    Posts
    275
    is thre a simpler way?

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Thanks DevGrp.

    A simpler way? What is simpler than a control that does it all for you?

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ROTFL

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    very easy way to simulate XP Style Menu

    here is a good and simple example of XP Style menu.
    using "OwnerDraw" Pro. you can draw any style you want.
    some arg.:

    1-MeasureItem : used to take the dimention of the menu.
    2-DrawImage : used to draw the image stored in the imagelist on the menu .
    3-DrawLine : draw a line with specific sizes .
    4-DrawRectangle : draw rectangle with specific color on specific region.
    5-DrawString :write text on specific region with special charat.
    6-FillRectangle : fill a rectangle region with specific color

    Pirate

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    sorry forget the attachment. It's there
    Attached Files Attached Files

  8. #8
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    That was pretty cool pirate.
    Dont gain the world and lose your soul

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Toronto, Ontario, Canada
    Posts
    275
    thanks, worked perfect with a bit of tweaking o make it look like XP style menu's. thinking of making a dll so faster access. pirate have a prob?

  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    yup

  11. #11
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163
    Pirate,

    I follow your project, and added the following code.

    I want to leave all the default properties of the menu. So I only add these code.

    Private Sub MenuItem2_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles MenuItem2.DrawItem
    e.Graphics.FillRectangle(New SolidBrush(Color.FromName(System.Drawing.KnownColor.Control)), e.Bounds.X, e.Bounds.Y, e.Bounds.X + 32, e.Bounds.Height)
    e.Graphics.DrawString(sender.text, New Font(System.Drawing.FontFamily.GenericSansSerif, 8.25), New SolidBrush(Color.FromName(System.Drawing.KnownColor.MenuText)), 35, e.Bounds.Y + 5)
    e.Graphics.DrawString(sender.Shortcut.ToString, New Font(System.Drawing.FontFamily.GenericSansSerif, 8.25), New SolidBrush(Color.FromName(System.Drawing.KnownColor.MenuText)), 150, e.Bounds.Y + 5)
    e.Graphics.DrawImage(ImageList1.Images.Item(0), e.Bounds.X + 7, e.Bounds.Y + 5)
    End Sub

    I can't see any icon beside the menu item. So I add this code also:

    Private Sub MenuItem2_MeasureItem(ByVal sender As Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles MenuItem2.MeasureItem
    e.ItemHeight = 25
    e.ItemWidth = 200
    End Sub

    But my menu still does not have any icon beside. why?

    Please guide. Thank you.

  12. #12
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Check your post there ...

  13. #13
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163
    Thanks for your reply. I will check my post n try it out...

  14. #14
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    If you don't want owner drawn menus

    Try this link :

    http://www.vbsmart.com/

    I have used this control in both VB6 and .NET and it seems to work like a dream. A really good example of an alternative to owner drawn menus, easy to use and free as well.

  15. #15
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by MattJH
    Try this link :

    http://www.vbsmart.com/
    I have used this control in both VB6 and .NET and it seems to work like a dream. A really good example of an alternative to owner drawn menus, easy to use and free as well.
    And what's wrong with Owner Drawn Menus ??? That example uses same methods as the above .

  16. #16
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    Pirate,

    I tried to use the code you posted for OwnerDrawMenus. I was able to get my form to load and the menu come up with the color. I receive an error when I click on the menu:

    An unhandled exception of type 'System.OutOfMemoryException' occurred in system.drawing.dll

    Additional information: Out of memory.

    Any suggestions on why this might be happening?

    Thanks

  17. #17
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683
    I am new this owner drawn menus but I like it and especially like yours. I am trying to add a second menu with submenus but not having any luck. Do you have a example with more than one dropdown menu. IE. First menu choice is File, Second is Edit. Thanks if you can help

  18. #18
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683
    Ok I figured it out, just slow I guess. I havent been able to figure out how to remove the shortcuts ie. CTL-A. I get it say NONE but would prefer to remove the word totally. I have tried setting the property show shortcut to false but it still showing. Have you tried this?

  19. #19
    New Member
    Join Date
    Mar 2005
    Posts
    11

    Re: Office XP Style Menu's in vb.net?

    pirate,

    can u also plz help me out.......
    i also need to change the color of my main menu and toolbar.......being a new member i just went through the steps u hav been tellin others to get the colored menu....but i am not a pro in .net, i am still learning.....so i would really appreciate if u could explain me "ownerdraw menu" coding.

  20. #20
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    Re: If you don't want owner drawn menus

    Quote Originally Posted by MattJH
    Try this link :

    http://www.vbsmart.com/

    I have used this control in both VB6 and .NET and it seems to work like a dream. A really good example of an alternative to owner drawn menus, easy to use and free as well.
    Please can you tell me how you used it ?
    When i try to put it on a form it tells me :
    "SmartmenuXP objects can be placed on forms only"

  21. #21
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Office XP Style Menu's in vb.net?

    Check out this link for "Ultimate Menus".. looks promising..
    http://www.codeproject.com/vb/net/UltimateMenus.asp

    ***Edit - he has an updated version of this at the following link
    http://www.planet-source-code.com/vb...3325&lngWId=10
    Last edited by gigemboy; Oct 17th, 2005 at 03:14 AM.

  22. #22
    Addicted Member skea's Avatar
    Join Date
    Mar 2006
    Posts
    187

    Re: Office XP Style Menu's in vb.net?

    Menus are every thing to my applications.
    I know this is an old thread. But i wanna revive it.
    Has some one used Kunal's KMMenuComponent with MDI's in the Updated Link above.
    I have an MDI with a menu and other forms with menu's too which do merge with the menus on the MDI. But when i try to use this tool. My Menus get puked up when i load another form that has menus too.

    If some one has gone this direction with this tool or another equally good tool. Please point me to the right direction.

  23. #23
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Re: Office XP Style Menu's in vb.net?

    I am using the ComponentOne suite, which has a great menu control.

  24. #24
    Addicted Member skea's Avatar
    Join Date
    Mar 2006
    Posts
    187

    Re: Office XP Style Menu's in vb.net?

    Thanks MattJH. I will peep there.

    Edit:**** That was good. But how can hoop over that Licence?
    Last edited by skea; Mar 29th, 2006 at 04:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width