Results 1 to 4 of 4

Thread: Setting a ContextMenuStrip's width manually = submenu "arrows" in the wrong place

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    126

    Setting a ContextMenuStrip's width manually = submenu "arrows" in the wrong place

    Hey guys,

    I've got a context menu strip that I would like to appear at a specific width, so I set its autosize to "false", and specified an exact width for it. Which works (kinda). Only problem now is, the submenu "arrows" that it contains no longer appear at the far right side of the control, as they should (they are closer to the middle). Here's a screenshot...

    Name:  cms.JPG
Views: 1139
Size:  10.9 KB


    How do I fix this? I couldn't find any property that controls the location of the arrows.

    Thanks!

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Setting a ContextMenuStrip's width manually = submenu "arrows" in the wrong place

    Quote Originally Posted by BMAN645 View Post
    How do I fix this? I couldn't find any property that controls the location of the arrows.
    Easiest way I can see to do that is to just leave autosize to true for the ContextMenuStrip and all the menu items. Add a menu item (to top of menu) and type a long word for the Text property so menu resizes to width you want, and set that menus Visible property to false. Now when menu is displayed you don't see top menu item but width is still intact.


    Name:  wide menu.png
Views: 1134
Size:  14.6 KB
    Last edited by Edgemeal; May 14th, 2014 at 06:28 PM. Reason: Clarify: Long word is for Text property :)

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Setting a ContextMenuStrip's width manually = submenu "arrows" in the wrong place

    Quote Originally Posted by Edgemeal View Post
    Easiest way I can see to do that is to just leave autosize to true for the ContextMenuStrip and all the menu items. Add a menu item (to top of menu) and type a long word so menu resizes to width you want, and set that menus Visible property to false. Now when menu is displayed you don't see top menu item but width is still intact.


    Name:  wide menu.png
Views: 1134
Size:  14.6 KB
    Nice and easy quick trick
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    126

    Re: Setting a ContextMenuStrip's width manually = submenu "arrows" in the wrong place

    Thanks Edgemeal. Yeah, I actually thought about doing something similar (just typing a bunch of blank space after one of the menu items), which has the same effect... but I was hoping to come up with a less "ghetto" solution, lol. But I reckon it will get the job done.

Tags for this Thread

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