473,395 Members | 1,797 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,395 software developers and data experts.

MenuItem.RadioCheck

I can't find the equivalent of the old MenuItem.RadioCheck property on

ToolStripMenuItem.

I need to allow the menu to have a subgroup of mutually exclusive choices.

How am I supposed to do this now in 2.0?
thanks for help

http://www.scalpa.info
Mar 3 '06 #1
6 2454

"Pascal" <sc*********@wanadoo.rf> wrote in message
news:44**********************@news.wanadoo.fr...
I can't find the equivalent of the old MenuItem.RadioCheck property on

ToolStripMenuItem.

I need to allow the menu to have a subgroup of mutually exclusive choices.

How am I supposed to do this now in 2.0?
thanks for help


Use checkboxes instead and write code to uncheck the other choices.

Mar 3 '06 #2
CMM
Not so fast there... if the items are mutually exclusive, that's bad UI
design and bad advice. Windows Official Guidelines for UI Design:
http://msdn.microsoft.com/library/de...html/ch08b.asp
Read the section towards the end titled "Types of Menu Items"

Here's an easy way to get the ToolStripMenuItem to do what the dolts at MS
were too busy playing ping pong to forget to do.
http://blogs.msdn.com/jfoscoding/arc...07/526335.aspx
--
-C. Moya
www.cmoya.com

"Homer J Simpson" <no****@nowhere.com> wrote in message
news:O8NNf.10802$vC4.602@clgrps12...

"Pascal" <sc*********@wanadoo.rf> wrote in message
news:44**********************@news.wanadoo.fr...
I can't find the equivalent of the old MenuItem.RadioCheck property on

ToolStripMenuItem.

I need to allow the menu to have a subgroup of mutually exclusive
choices.

How am I supposed to do this now in 2.0?
thanks for help


Use checkboxes instead and write code to uncheck the other choices.

Mar 3 '06 #3
oops it seems too hard to understand and use for me.... arrrgh It is a pity!
################################################## #######
menuStrip1.Renderer = new RadioCheckRenderer();
public class RadioCheckRenderer : ToolStripProfessionalRenderer {

protected override void
OnRenderItemCheck(ToolStripItemImageRenderEventArg s e) {

RadioButtonRenderer.DrawRadioButton(e.Graphics,
e.ImageRectangle.Location,
System.Windows.Forms.VisualStyles.RadioButtonState .CheckedNormal);

}

}

################################################## ######
what's the way to use this part of code ? Mystery...

thanks Thank you nevertheless.
Mar 3 '06 #4
CMM
Create this class:
Public Class MyCustomToolStripProfessionalRenderer
Inherits ToolStripProfessionalRenderer

Protected Overrides Sub OnRenderItemCheck(ByVal e As
System.Windows.Forms.ToolStripItemImageRenderEvent Args)
Dim stringFormat As New StringFormat
stringFormat.Alignment = StringAlignment.Center
e.Graphics.DrawString("i", New Font("Marlett", 12, FontStyle.Bold),
SystemBrushes.MenuText, e.ImageRectangle, stringFormat)

'or you can use this instead for an interesting look
'RadioButtonRenderer.DrawRadioButton(e.Graphics,
e.ImageRectangle.Location,
System.Windows.Forms.VisualStyles.RadioButtonState .CheckedNormal)
End Sub
End Class

In your Form_Load, do this:
Me.MenuStrip1.Renderer = New MyCustomToolStripProfessionalRenderer
--
-C. Moya
www.cmoya.com
"Pascal" <sc*********@wanadoo.rf> wrote in message
news:44***********************@news.wanadoo.fr...
oops it seems too hard to understand and use for me.... arrrgh It is a
pity!
################################################## #######
menuStrip1.Renderer = new RadioCheckRenderer();
public class RadioCheckRenderer : ToolStripProfessionalRenderer {

protected override void
OnRenderItemCheck(ToolStripItemImageRenderEventArg s e) {

RadioButtonRenderer.DrawRadioButton(e.Graphics,
e.ImageRectangle.Location,
System.Windows.Forms.VisualStyles.RadioButtonState .CheckedNormal);

}

}

################################################## ######
what's the way to use this part of code ? Mystery...

thanks Thank you nevertheless.

Mar 3 '06 #5
Arrghglglgl.... I did the job (well explain for me thanks); no errors when i
debug but nothing appears on the dropdown menu when the form load. Radio
button appear only when i click.
So i change my mind and :
from microsoft here is the code :
Private Sub MenuOption_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

For Each item As Object In MonMenuToolStripMenuItem.DropDownItems

If (TypeOf item Is ToolStripMenuItem) Then

Dim itemObject As ToolStripMenuItem = CType(item, ToolStripMenuItem)

itemObject.Checked = False

End If

Next

Dim selectedItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem)

selectedItem.Checked = True

End Sub

like this it works fine...
Mar 3 '06 #6

"Pascal" <sc*********@wanadoo.rf> wrote in message
news:44***********************@news.wanadoo.fr...
Arrghglglgl.... I did the job (well explain for me thanks); no errors when
i debug but nothing appears on the dropdown menu when the form load. Radio
button appear only when i click.


Yes. Using this stuff is like trying to knit wet spaghetti.
Mar 3 '06 #7

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

Similar topics

0
by: Marcel | last post by:
Hi, the application I am writing has a MainMenu and a DataGrid (UltraGrid). Now I have to edit the text of each cell in this grid. So far so good. All works fine in editmode but if I press a...
4
by: Jesper | last post by:
Hi, When creating a popup menu I find it rather difficult to provide the eventhandler for the MenuItem with enough information. My actual problem is that I create a popup menu with a list of...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
4
by: Eric Sabine | last post by:
I've simplified the code to the following. I'm just overlooking something very simple I'm sure. Dim mic() As MenuItem mic = New MenuItem(3) {} mic(0) = New MenuItem("a") mic(0).Index = 1 ...
6
by: Eric Sabine | last post by:
Basically, the following code creates a menuItem array and tries to use it twice. In the following piece of code, only the line that appears second gets used. The first becomes ignored presumably...
15
by: Jeff Mason | last post by:
I have an application where I need to set certain menu items invisible based on a user privilege. We did a sinmlar thing in VB6 and used the menu item's tag property to assign an identifier to...
4
by: Jeff Mason | last post by:
I have an application where I need to set certain menu items invisible based on a user privilege. We did a sinmlar thing in VB6 and used the menu item's tag property to assign an identifier to...
13
by: academic | last post by:
ToolStripMenuItems do not have a RadioCheck property. Is this feature not available with the new StripMenu or is it just that I haven't found out how? Hard to believe they dropped such a nice...
2
by: polocar | last post by:
Hi, I'm writing a program using Visual C# 2005 Professional Edition, and I was trying to assign multiple MainMenu objects (one by one, of course) to the same Form (let's suppose 2 MainMenu...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.