Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello all,
I am currently attempting to implement a custom menu strip, which instead of drawing it's menu items with a tendency to be underneath the menu heading, instead prefers to draw them directly above

eg instead of
_________________
  |menuitem|
----|---------|--
    | item 1  |
    | item 1  |
    | item 1  |
    -----------


we get
   ___________
   | item 1  |
   | item 1  |
   | item 1  |
-----------------
   |menuitem|
-----------------


I've gotten as far as creating a custom component and inheriting menustrip.
But I'm stuck at what 'draw' routine to override to change the menu layout.

I can find plenty of information to make the menu any gaudy colour gradient I like, but nothing much about repositioning the menu.
Help please!


EDIT: Forgot to mention, the menu strip behaves the way I wish, if it is docked to the bottom of a form,
however, I need the control to operate in this manner even if it isn't docked (ie free floating)
Posted
Updated 24-Jul-12 15:28pm
v3
Comments
Sergey Alexandrovich Kryukov 24-Jul-12 22:16pm    
Wow! I wonder why? Want to surprise your customers? Why?

Anyway, what did you try so far? Any problems you stuck with? I must note that I would not hope for a very fruitful answer in this case. You see, to give you a solution or an idea of a solution, one would need to try to implement it, spend considerable amount of time for it.

The problem is: your idea is not crazy enough to interest people so much that somebody would decide to spend time on it. If somebody give you a really working advice on such control, consider yourself lucky.

--SA

1 solution

Despite of my note in my comment to the question (please see it), on second thought, I can give you a really working advice, but not sure you will like it.

You can always implement desired functionality based on System.Windows.Forms.Control as a base class: implement a brand new menu item class as a derived class, render its content using overridden method OnPaint, introduce members representing item data and relationship with other items (such as Children). On top of it, implement some Menu class. And you don't have to waste time on the behavior of your classes under the Designer, if you do it just for yourself.

It's really hard to say if it would be possible to customize the available menu or menu strip control so much it would behave like you want. Probably not. I personally would hardly even try, because — I can only repeat — your design idea is not crazy enough to be interesting. Well, upside-down menu, what's so funny?

—SA
 
Share this answer
 
v2
Comments
cognismith 25-Jul-12 4:36am    
Haha, thanks for your responses, yes, it does seem a little useless on its own, but it's for a specific project, ofwhich the context makes it more sensible, but no matter, I wasn't after a specific solution persay, more of a probe for hints. and yes, I have been playing about with painting my own controls (partly for another control I'm writing, and was hoping to avoid it if possible if I could simply alter the current menu strip( to do something it already does(!), only not when I want it to).
Sergey Alexandrovich Kryukov 27-Jul-12 17:05pm    
I don't think you can find something more useful, but good luck on that. At least my advise is can certainly be implemented, it just needs some work...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900