473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MenuItem.RadioC heck

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

ToolStripMenuIt em.

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 2481

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

ToolStripMenuIt em.

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 ToolStripMenuIt em 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.1080 2$vC4.602@clgrp s12...

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

ToolStripMenuIt em.

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.Rend erer = new RadioCheckRende rer();
public class RadioCheckRende rer : ToolStripProfes sionalRenderer {

protected override void
OnRenderItemChe ck(ToolStripIte mImageRenderEve ntArgs e) {

RadioButtonRend erer.DrawRadioB utton(e.Graphic s,
e.ImageRectangl e.Location,
System.Windows. Forms.VisualSty les.RadioButton State.CheckedNo rmal);

}

}

############### ############### ############### ###########
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 MyCustomToolStr ipProfessionalR enderer
Inherits ToolStripProfes sionalRenderer

Protected Overrides Sub OnRenderItemChe ck(ByVal e As
System.Windows. Forms.ToolStrip ItemImageRender EventArgs)
Dim stringFormat As New StringFormat
stringFormat.Al ignment = StringAlignment .Center
e.Graphics.Draw String("i", New Font("Marlett", 12, FontStyle.Bold) ,
SystemBrushes.M enuText, e.ImageRectangl e, stringFormat)

'or you can use this instead for an interesting look
'RadioButtonRen derer.DrawRadio Button(e.Graphi cs,
e.ImageRectangl e.Location,
System.Windows. Forms.VisualSty les.RadioButton State.CheckedNo rmal)
End Sub
End Class

In your Form_Load, do this:
Me.MenuStrip1.R enderer = New MyCustomToolStr ipProfessionalR enderer
--
-C. Moya
www.cmoya.com
"Pascal" <sc*********@wa nadoo.rf> wrote in message
news:44******** *************** @news.wanadoo.f r...
oops it seems too hard to understand and use for me.... arrrgh It is a
pity!
############### ############### ############### ############
menuStrip1.Rend erer = new RadioCheckRende rer();
public class RadioCheckRende rer : ToolStripProfes sionalRenderer {

protected override void
OnRenderItemChe ck(ToolStripIte mImageRenderEve ntArgs e) {

RadioButtonRend erer.DrawRadioB utton(e.Graphic s,
e.ImageRectangl e.Location,
System.Windows. Forms.VisualSty les.RadioButton State.CheckedNo rmal);

}

}

############### ############### ############### ###########
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_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s)

For Each item As Object In MonMenuToolStri pMenuItem.DropD ownItems

If (TypeOf item Is ToolStripMenuIt em) Then

Dim itemObject As ToolStripMenuIt em = CType(item, ToolStripMenuIt em)

itemObject.Chec ked = False

End If

Next

Dim selectedItem As ToolStripMenuIt em = CType(sender, ToolStripMenuIt em)

selectedItem.Ch ecked = True

End Sub

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

"Pascal" <sc*********@wa nadoo.rf> wrote in message
news:44******** *************** @news.wanadoo.f r...
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
2793
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 key which is also a shortcut it doesn´t work and the menuitem-clickevent will be performed.
4
2306
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 objects of which one, by clicking the item, must be assinged to another object. I use the same eventhandler for all the menuitems in the popup menu as the objects listed in the popup menu is of arbitrary length. To correlate the 'sender' menuitem in...
6
6224
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 method from the mdichild, I get this error: C:\MyProjects\Visual Studio Projects\Tournament\Forms\frmLogin.cs(69): The name 'test' does not exist in the class or namespace 'Tournament.frmLogin' frmLogin is the mdichild.
4
3445
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 mic(1) = New MenuItem("b") mic(1).Index = 2
6
1330
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 when the second is run. Me.mnuFile.MenuItems.AddRange(myMenu) Me.ContextMenu1.MenuItems.AddRange(myMenu) Below I've included just enough code to see it as an example. Can someone explain to me why this happens?
15
2476
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 each menu entry, then used that identifier as an index into a collection populated at user login in order to determine the item's visibility. Now, for some reason there's no tag property for .NET MenuItems, so I'm looking for some way to...
4
1833
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 each menu entry, then used that identifier as an index into a collection populated at user login in order to determine the item's visibility. Now, for some reason there's no tag property for .NET MenuItems, so I'm looking for some way to...
13
1945
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 feature. Is it still available some how?
2
2166
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 objects). It is possible (and it's my case) that these 2 MainMenu objects use some different MenuItem objects and some identical MenuItem objects. For example, let's assume that: mainMenu1 contains miFile, miEdit, miHelp mainMenu2 contains miFile,...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9911
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.