[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Owner drawn menus, XP or MS Outlook

Francis Shanahan

1/5/2005 4:15:00 AM

Folks,
From googling I can see this has been asked numerous times yet I am unable
to find an answer:

How can I create menus similar to MS Outlook?
Specifically, the gradient menus. I've found and implemented gradients in
the menu items themselves but have not been able to figure out the gradient
ACROSS the ENTIRE menu bar. How is this done?

Also, how are menus generally made dockable, I have a feeling I can subclass
a toolbar and gradient that but how do I add a menu to a toolbar? Is this
even the right track?

Even if I do that I figure I'm missing something as the outlook window I'm
typing in right now seems to have a very subtle gradient from top left to
bottom right across the entire window, including the menu, toolbar and the
content area.

Any help will be appreciated, Thanks folks and happy new year.
-fs


5 Answers

Bob Powell

1/5/2005 10:01:00 AM

0

Generally, the classes that provide menu's that look like office or the
VS.NET IDE are custom controls written from the ground-up. DotNetMagic is a
good example of this.

Either buy a third-party library or roll up your sleeves and do it all
yourself.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
message news:elsLr0t8EHA.2452@TK2MSFTNGP14.phx.gbl...
> Folks,
> From googling I can see this has been asked numerous times yet I am unable
> to find an answer:
>
> How can I create menus similar to MS Outlook?
> Specifically, the gradient menus. I've found and implemented gradients in
> the menu items themselves but have not been able to figure out the
> gradient ACROSS the ENTIRE menu bar. How is this done?
>
> Also, how are menus generally made dockable, I have a feeling I can
> subclass a toolbar and gradient that but how do I add a menu to a toolbar?
> Is this even the right track?
>
> Even if I do that I figure I'm missing something as the outlook window I'm
> typing in right now seems to have a very subtle gradient from top left to
> bottom right across the entire window, including the menu, toolbar and the
> content area.
>
> Any help will be appreciated, Thanks folks and happy new year.
> -fs
>
>


Francis Shanahan

1/5/2005 2:11:00 PM

0

Thanks Bob, this is the type of answer I anticipated but unfortunately not
the type of answer that's helpful.

I'd like to "roll up my sleeves" and have done a bunch of research/proof of
concept work to see what's involved. Here's what I've gotten working
1) owner drawn menu item - the issue is the entire menu is not shaded, just
the menu items. How can I draw over the entire menu ? The coordinates are not
accessible from the form, (0,0) seems to be the first pixel UNDERNEATH the
menu in the Client Area of the form. Can I access the menu?
2) I sub-classed the entire menu to see if there was an OnPaint I could
override. No joy.
3) I sub-classed the toolbar and that seems to allow me to apply a gradient.
I cannot seem to add a menu to this toolbar though.
4) I tried the old "EnableVisualStyles" but this only achieves about 1/10th
of what I'm looking to do.

Any other pointers?


"Bob Powell [MVP]" wrote:

> Generally, the classes that provide menu's that look like office or the
> VS.NET IDE are custom controls written from the ground-up. DotNetMagic is a
> good example of this.
>
> Either buy a third-party library or roll up your sleeves and do it all
> yourself.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
> message news:elsLr0t8EHA.2452@TK2MSFTNGP14.phx.gbl...
> > Folks,
> > From googling I can see this has been asked numerous times yet I am unable
> > to find an answer:
> >
> > How can I create menus similar to MS Outlook?
> > Specifically, the gradient menus. I've found and implemented gradients in
> > the menu items themselves but have not been able to figure out the
> > gradient ACROSS the ENTIRE menu bar. How is this done?
> >
> > Also, how are menus generally made dockable, I have a feeling I can
> > subclass a toolbar and gradient that but how do I add a menu to a toolbar?
> > Is this even the right track?
> >
> > Even if I do that I figure I'm missing something as the outlook window I'm
> > typing in right now seems to have a very subtle gradient from top left to
> > bottom right across the entire window, including the menu, toolbar and the
> > content area.
> >
> > Any help will be appreciated, Thanks folks and happy new year.
> > -fs
> >
> >
>
>
>

Bob Powell

1/5/2005 3:25:00 PM

0

Forget menu's, mainmenus, context menus and menu items entirely. You'll
never derive from any of those and get the look you want. This requires a
completely new class structure with 100% custom drawing and none of the
built-in abilities of the windows menu system. Esentially start-over.

You might also want to research the NativeWindow class and its usage and the
LayeredWindow API.

When you've got it drawing just right you'll need to create a designer for
it so that it integrates with the VS IDE nicely and then you can go into
compettition with the likes of Crownwood Consulting, Dundas, SyncFusion and
Infragistics to name but a few. I guess I'm telling you that this isn't a
"quick example to get you going" thing.

By all means do it. It's a great learning experience. I did but the code was
for a commercial customer so I can't really give it away here.

When I said roll up your sleeves I really meant roll 'em up to your armpits
;-) Good luck!

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Francis Shanahan" <FrancisShanahan@discussions.microsoft.com> wrote in
message news:25D34F3B-FF27-4A23-8A99-FE3036DCD6D5@microsoft.com...
> Thanks Bob, this is the type of answer I anticipated but unfortunately not
> the type of answer that's helpful.
>
> I'd like to "roll up my sleeves" and have done a bunch of research/proof
> of
> concept work to see what's involved. Here's what I've gotten working
> 1) owner drawn menu item - the issue is the entire menu is not shaded,
> just
> the menu items. How can I draw over the entire menu ? The coordinates are
> not
> accessible from the form, (0,0) seems to be the first pixel UNDERNEATH the
> menu in the Client Area of the form. Can I access the menu?
> 2) I sub-classed the entire menu to see if there was an OnPaint I could
> override. No joy.
> 3) I sub-classed the toolbar and that seems to allow me to apply a
> gradient.
> I cannot seem to add a menu to this toolbar though.
> 4) I tried the old "EnableVisualStyles" but this only achieves about
> 1/10th
> of what I'm looking to do.
>
> Any other pointers?
>
>
> "Bob Powell [MVP]" wrote:
>
>> Generally, the classes that provide menu's that look like office or the
>> VS.NET IDE are custom controls written from the ground-up. DotNetMagic is
>> a
>> good example of this.
>>
>> Either buy a third-party library or roll up your sleeves and do it all
>> yourself.
>>
>> --
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tips...
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/f...
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>> "Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
>> message news:elsLr0t8EHA.2452@TK2MSFTNGP14.phx.gbl...
>> > Folks,
>> > From googling I can see this has been asked numerous times yet I am
>> > unable
>> > to find an answer:
>> >
>> > How can I create menus similar to MS Outlook?
>> > Specifically, the gradient menus. I've found and implemented gradients
>> > in
>> > the menu items themselves but have not been able to figure out the
>> > gradient ACROSS the ENTIRE menu bar. How is this done?
>> >
>> > Also, how are menus generally made dockable, I have a feeling I can
>> > subclass a toolbar and gradient that but how do I add a menu to a
>> > toolbar?
>> > Is this even the right track?
>> >
>> > Even if I do that I figure I'm missing something as the outlook window
>> > I'm
>> > typing in right now seems to have a very subtle gradient from top left
>> > to
>> > bottom right across the entire window, including the menu, toolbar and
>> > the
>> > content area.
>> >
>> > Any help will be appreciated, Thanks folks and happy new year.
>> > -fs
>> >
>> >
>>
>>
>>


Francis Shanahan

1/5/2005 4:15:00 PM

0

Thanks Bob. That second post was definitely along the lines of what I was
looking for.
So I'll take a crack at it and see what happens. I sort of sensed from my
trials and errors that I was on the wrong track. Time to dig out my 80's
sleeveless t-shirts...

-fs
http://www.FrancisSh...


"Bob Powell [MVP]" wrote:

> Forget menu's, mainmenus, context menus and menu items entirely. You'll
> never derive from any of those and get the look you want. This requires a
> completely new class structure with 100% custom drawing and none of the
> built-in abilities of the windows menu system. Esentially start-over.
>
> You might also want to research the NativeWindow class and its usage and the
> LayeredWindow API.
>
> When you've got it drawing just right you'll need to create a designer for
> it so that it integrates with the VS IDE nicely and then you can go into
> compettition with the likes of Crownwood Consulting, Dundas, SyncFusion and
> Infragistics to name but a few. I guess I'm telling you that this isn't a
> "quick example to get you going" thing.
>
> By all means do it. It's a great learning experience. I did but the code was
> for a commercial customer so I can't really give it away here.
>
> When I said roll up your sleeves I really meant roll 'em up to your armpits
> ;-) Good luck!
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Francis Shanahan" <FrancisShanahan@discussions.microsoft.com> wrote in
> message news:25D34F3B-FF27-4A23-8A99-FE3036DCD6D5@microsoft.com...
> > Thanks Bob, this is the type of answer I anticipated but unfortunately not
> > the type of answer that's helpful.
> >
> > I'd like to "roll up my sleeves" and have done a bunch of research/proof
> > of
> > concept work to see what's involved. Here's what I've gotten working
> > 1) owner drawn menu item - the issue is the entire menu is not shaded,
> > just
> > the menu items. How can I draw over the entire menu ? The coordinates are
> > not
> > accessible from the form, (0,0) seems to be the first pixel UNDERNEATH the
> > menu in the Client Area of the form. Can I access the menu?
> > 2) I sub-classed the entire menu to see if there was an OnPaint I could
> > override. No joy.
> > 3) I sub-classed the toolbar and that seems to allow me to apply a
> > gradient.
> > I cannot seem to add a menu to this toolbar though.
> > 4) I tried the old "EnableVisualStyles" but this only achieves about
> > 1/10th
> > of what I'm looking to do.
> >
> > Any other pointers?
> >
> >
> > "Bob Powell [MVP]" wrote:
> >
> >> Generally, the classes that provide menu's that look like office or the
> >> VS.NET IDE are custom controls written from the ground-up. DotNetMagic is
> >> a
> >> good example of this.
> >>
> >> Either buy a third-party library or roll up your sleeves and do it all
> >> yourself.
> >>
> >> --
> >> Bob Powell [MVP]
> >> Visual C#, System.Drawing
> >>
> >> Find great Windows Forms articles in Windows Forms Tips and Tricks
> >> http://www.bobpowell.net/tips...
> >>
> >> Answer those GDI+ questions with the GDI+ FAQ
> >> http://www.bobpowell.net/f...
> >>
> >> All new articles provide code in C# and VB.NET.
> >> Subscribe to the RSS feeds provided and never miss a new article.
> >>
> >>
> >>
> >>
> >>
> >> "Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
> >> message news:elsLr0t8EHA.2452@TK2MSFTNGP14.phx.gbl...
> >> > Folks,
> >> > From googling I can see this has been asked numerous times yet I am
> >> > unable
> >> > to find an answer:
> >> >
> >> > How can I create menus similar to MS Outlook?
> >> > Specifically, the gradient menus. I've found and implemented gradients
> >> > in
> >> > the menu items themselves but have not been able to figure out the
> >> > gradient ACROSS the ENTIRE menu bar. How is this done?
> >> >
> >> > Also, how are menus generally made dockable, I have a feeling I can
> >> > subclass a toolbar and gradient that but how do I add a menu to a
> >> > toolbar?
> >> > Is this even the right track?
> >> >
> >> > Even if I do that I figure I'm missing something as the outlook window
> >> > I'm
> >> > typing in right now seems to have a very subtle gradient from top left
> >> > to
> >> > bottom right across the entire window, including the menu, toolbar and
> >> > the
> >> > content area.
> >> >
> >> > Any help will be appreciated, Thanks folks and happy new year.
> >> > -fs
> >> >
> >> >
> >>
> >>
> >>
>
>
>

Mick Doherty

1/5/2005 5:32:00 PM

0

There's a lot you can't do with menus but then theres also a fair amount you
can do.

Drawing the menubar is simple enough and you'll find an example of that on
my site, just use a PatternBrush instead of a SolidBrush.
http://dotnetrix.co.uk/...

To modify the actual menu window rather than the menuitems you will need a
Windows hook.
I am working on a MenuExtender which modifies menu borders and paints the
entire menubar, aswell as painting the menuitems, but it'll be a while
before I complete it due to other commitments.

You'll find an example of a menuextender on CodeProject which modifies the
border.
http://www.codeproject.com/vb/net/vsnetstylem...

Mine will do things slightly differently, but the basics are the same.

If you want Dockable, expandable Menu's then, as Bob stated, you will have
to forget about inheriting the Menu class and build a component completely
from scratch.

--
Mick Doherty
http://dotnetrix.co.uk/no...


"Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
message news:elsLr0t8EHA.2452@TK2MSFTNGP14.phx.gbl...
> Folks,
> From googling I can see this has been asked numerous times yet I am unable
> to find an answer:
>
> How can I create menus similar to MS Outlook?
> Specifically, the gradient menus. I've found and implemented gradients in
> the menu items themselves but have not been able to figure out the
> gradient ACROSS the ENTIRE menu bar. How is this done?
>
> Also, how are menus generally made dockable, I have a feeling I can
> subclass a toolbar and gradient that but how do I add a menu to a toolbar?
> Is this even the right track?
>
> Even if I do that I figure I'm missing something as the outlook window I'm
> typing in right now seems to have a very subtle gradient from top left to
> bottom right across the entire window, including the menu, toolbar and the
> content area.
>
> Any help will be appreciated, Thanks folks and happy new year.
> -fs
>
>