473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

override menu drawing?

hi, im making my own menustrip control since i want to add a few things to
it. but now im stuck on how when you click on for instance a main node of
"File", it always is highlighted in one color....i cant figure out how to
change this, be it on the normal one or how to override this by making my
own....any help would be great
--
-iwdu15
Jul 12 '06 #1
1 950
On Tue, 11 Jul 2006 19:19:01 -0700, iwdu15 <jmmgoalsteratyahoodotcom>
wrote:
>hi, im making my own menustrip control since i want to add a few things to
it. but now im stuck on how when you click on for instance a main node of
"File", it always is highlighted in one color....i cant figure out how to
change this, be it on the normal one or how to override this by making my
own....any help would be great

When I want to customize a MenuStrip, ToolStrip,or StatusStrip, I use
the ToolStripProfessionalRenderer class which has a number of
properties that can be assigned custom colors for all of the above.
This example produces a SlateGray gradient when the cursor is over a
MenuItem:

Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
ToolStripManager.Renderer = New _
ToolStripProfessionalRenderer _
(New CustomProfessionalColors())
End Sub
Public Class CustomProfessionalColors
Inherits ProfessionalColorTable

Public Overrides ReadOnly Property MenuItemSelectedGradientBegin()
_ As System.Drawing.Color
Get
Return Color.White
End Get
End Property
Public Overrides ReadOnly Property MenuItemSelectedGradientEnd() _
As System.Drawing.Color
Get
Return Color.SlateGray
End Get
End Property

Public Overrides ReadOnly Property MenuItemBorder() _
As System.Drawing.Color
Get
Return Color.MidnightBlue
End Get
End Property

End Class

The above is only valid on target systems with VisualStyles enabled.
Gene
Jul 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ed Sutton | last post by:
I am dynamically appending to a context menu when user right mouse clicks on a treeView. The first time I right-mouse click I see the appended menu. Subsequently, the menu items I append do not...
1
by: Craig | last post by:
I've tried to override the paint method and I can't get the overriden paint method to get called. I put the the method below within the class, but it never gets called when I open up my form. By...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
0
by: Amiram Korach | last post by:
When you create a MDI form, you can attach a main menu to the parent and to the child. When a child form is active, its menu is merged with the parent menu. The problem is: when the forms are...
2
by: Peter Proost | last post by:
Hi group, I've got this ownerdraw menu module which I got from a site and modified to my personal needs, but the only problem I'm having is with the lines in a menu, when you type - as text, it...
2
by: Peter Proost | last post by:
Hi, I've got the following ownerdraw menu: drag a mainmenu on a form and add some menuitems to it, set all the menuitems to ownerdraw = true and for every menuitem add this code (replace...
4
by: John Smith | last post by:
Hi All; I am using the HeaderAndDataAlignColumn class from Ken Tucker. I have customized it for a wider row. I reposition the DrawString method so the text is centered vertically in the row. ...
1
by: Brian Heibert | last post by:
Can anyone tell me how to create a Edit menu I am new to VB .Net and this news group Thanks, Brian
1
by: Anila | last post by:
Hi........ My problem is i wrote a program for drawing a line in Csharp. My code is using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.