How to have MenuItems not show arrow when it has submenu
-
Hai all, Somebody help me in this issue. I need to have a menu bar which is RightToLeft aligned, which I can achieve by setting MainMenu's RightToLeft property to "Yes". The problem that I get is, if one of MenuItems has submenu...the arrow(or small triangle which indiates it has submenu) appears in the left. I wanted to know when is this getting drawn. I want to trap that and draw my own image to indicate that it has submenu. Below is the code that I have written for DrawItem and MeasureItem for each MenuItem. Any help is greatly appreciated..... Thanks, Madhavi. private void menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Rectangle rc = new Rectangle(e.Bounds.X+1 , e.Bounds.Y+1, e.Bounds.Width, e.Bounds.Height-1); e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51,102,153)), rc); MenuItem s = (MenuItem)sender ; RedrawSubMenuItems(s); string s1 = s.Text +" |" ; StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Near ; e.Graphics.DrawString(s1 , new Font("Ariel" ,9, FontStyle.Bold), new SolidBrush(Color.FromArgb(255,255,128)) , rc , sf ); Console.WriteLine(e.State.ToString()); if ( e.State == (DrawItemState.NoAccelerator | DrawItemState.Selected) || e.State == ( DrawItemState.NoAccelerator | DrawItemState.HotLight) ) { //e.Graphics.FillRectangle(new SolidBrush(Color.LightYellow) , rc); e.Graphics.DrawString( s.Text , new Font("Ariel" , 9 , FontStyle.Bold | FontStyle.Underline ) , new SolidBrush(Color.FromArgb(255,255,128)), rc ,sf); //e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black)), rc ); }