Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to have MenuItems not show arrow when it has submenu

How to have MenuItems not show arrow when it has submenu

Scheduled Pinned Locked Moved C#
helpgraphicstutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VPMahank
    wrote on last edited by
    #1

    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 ); }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups