|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MenuItem.RadioCheckI 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 "Pascal" <scalpano***@wanadoo.rf> wrote in message Use checkboxes instead and write code to uncheck the other choices.news:44078ef3$0$6644$8fcfb975@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 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/default.asp?url=/library/en-us/dnwue/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/archive/2006/02/07/526335.aspx "Homer J Simpson" <nob***@nowhere.com> wrote in message news:O8NNf.10802$vC4.602@clgrps12...Show quoteHide quote > > "Pascal" <scalpano***@wanadoo.rf> wrote in message > news:44078ef3$0$6644$8fcfb975@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. > > > 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(ToolStripItemImageRenderEventArgs 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. Create this class:
Public Class MyCustomToolStripProfessionalRenderer Inherits ToolStripProfessionalRenderer Protected Overrides Sub OnRenderItemCheck(ByVal e As System.Windows.Forms.ToolStripItemImageRenderEventArgs) 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 Show quoteHide quote "Pascal" <scalpano***@wanadoo.rf> wrote in message news:44081ffd$0$18320$8fcfb975@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(ToolStripItemImageRenderEventArgs 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. > 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... "Pascal" <scalpano***@wanadoo.rf> wrote in message Yes. Using this stuff is like trying to knit wet spaghetti.news:44089b8b$0$21297$8fcfb975@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.
Basic question
Enumerate members of Administrators Group (AD) Comparing Colors filter rows in a bound datagrid update more than only the email with asp.net membership Web service question Change Report Connection at Runtime Radio Button Grouping in vb/VS 2005 Data Relation Update Namespace Question ... |
|||||||||||||||||||||||