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. ToolStripMenu

ToolStripMenu

Scheduled Pinned Locked Moved C#
tutorial
15 Posts 5 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.
  • J Offline
    J Offline
    jojoba2010
    wrote on last edited by
    #1

    How to lock ToolstripMenu form adding new items!

    D 1 Reply Last reply
    0
    • J jojoba2010

      How to lock ToolstripMenu form adding new items!

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      Well don't add any Items to it. It's YOU and eventually YOUR code that adds an item to the toolstrip menu. If you have a pice of code that dynamically adds items at runtime, than make some sort of logic/condition to not allow any Items to be added unless the condition is satisfied.

      J 1 Reply Last reply
      0
      • D Dan Mos

        Well don't add any Items to it. It's YOU and eventually YOUR code that adds an item to the toolstrip menu. If you have a pice of code that dynamically adds items at runtime, than make some sort of logic/condition to not allow any Items to be added unless the condition is satisfied.

        J Offline
        J Offline
        jojoba2010
        wrote on last edited by
        #3

        I have usercontrol that inherant form toolstrip, now how can i disable tsmi task!

        D 1 Reply Last reply
        0
        • J jojoba2010

          I have usercontrol that inherant form toolstrip, now how can i disable tsmi task!

          D Offline
          D Offline
          Dan Mos
          wrote on last edited by
          #4

          jojoba2010 wrote:

          now how can i disable tsmi task!

          I really don't want to offend you but I just DO NOT understand your question. Please use Google Translate or something.

          J 1 Reply Last reply
          0
          • D Dan Mos

            jojoba2010 wrote:

            now how can i disable tsmi task!

            I really don't want to offend you but I just DO NOT understand your question. Please use Google Translate or something.

            J Offline
            J Offline
            jojoba2010
            wrote on last edited by
            #5

            I wanna to have tooltip that just have 12items and user(programmer) cannot remove these items!

            realJSOPR M D 3 Replies Last reply
            0
            • J jojoba2010

              I wanna to have tooltip that just have 12items and user(programmer) cannot remove these items!

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              Just add a normal MenuStrip object to your form. It doesn't have that functionality by default. Are you by chance talking about a ToolStrip?

              .45 ACP - because shooting twice is just silly
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

              1 Reply Last reply
              0
              • J jojoba2010

                I wanna to have tooltip that just have 12items and user(programmer) cannot remove these items!

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                Are you building an application or an add in for VS

                Never underestimate the power of human stupidity RAH

                J 1 Reply Last reply
                0
                • M Mycroft Holmes

                  Are you building an application or an add in for VS

                  Never underestimate the power of human stupidity RAH

                  J Offline
                  J Offline
                  jojoba2010
                  wrote on last edited by
                  #8

                  Yes i am talking about ToolStrip! And wanna disable toolstrip Task(in design view we have toolstrip Task) where we can add/Delete new items !

                  realJSOPR 1 Reply Last reply
                  0
                  • J jojoba2010

                    I wanna to have tooltip that just have 12items and user(programmer) cannot remove these items!

                    D Offline
                    D Offline
                    Dan Mos
                    wrote on last edited by
                    #9

                    First - did you make a custom control derived from ToolStripMenu? If YES than the only way I can think of how you could force that, is by overriding the methods/events such as myCoolMenuStrip1.ItemAdded and do nothing in there. Something like:

                    protected override void OnItemAdded(ToolStripItemEventArgs e)
                    {
                    //do absolutely nothing
                    //base.OnItemRemoved(e);
                    }

                    protected override void OnItemRemoved(ToolStripItemEventArgs e)
                    {
                    //do absolutely nothing
                    //base.OnItemRemoved(e);
                    }

                    If Not state more clearly what you want.

                    J 1 Reply Last reply
                    0
                    • J jojoba2010

                      Yes i am talking about ToolStrip! And wanna disable toolstrip Task(in design view we have toolstrip Task) where we can add/Delete new items !

                      realJSOPR Offline
                      realJSOPR Offline
                      realJSOP
                      wrote on last edited by
                      #10

                      The ToolStrip can be locked by using one or more properties, disallowing removal of buttons. I don't know what these properties are, but a little googling should help.

                      .45 ACP - because shooting twice is just silly
                      -----
                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                      -----
                      "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                      1 Reply Last reply
                      0
                      • D Dan Mos

                        First - did you make a custom control derived from ToolStripMenu? If YES than the only way I can think of how you could force that, is by overriding the methods/events such as myCoolMenuStrip1.ItemAdded and do nothing in there. Something like:

                        protected override void OnItemAdded(ToolStripItemEventArgs e)
                        {
                        //do absolutely nothing
                        //base.OnItemRemoved(e);
                        }

                        protected override void OnItemRemoved(ToolStripItemEventArgs e)
                        {
                        //do absolutely nothing
                        //base.OnItemRemoved(e);
                        }

                        If Not state more clearly what you want.

                        J Offline
                        J Offline
                        jojoba2010
                        wrote on last edited by
                        #11

                        public partial class UserControl1 : ToolStrip And i have added 10 items to this Toolstrip and now i wanna to force every-one who use this usercontrol from remove these items from this menuStrip!

                        D 1 Reply Last reply
                        0
                        • J jojoba2010

                          public partial class UserControl1 : ToolStrip And i have added 10 items to this Toolstrip and now i wanna to force every-one who use this usercontrol from remove these items from this menuStrip!

                          D Offline
                          D Offline
                          Dan Mos
                          wrote on last edited by
                          #12

                          please insert the code that you have so far, that is if you have any. And be SPECIFIC like "I want the user of the control not to be able to remove or add anything" Or "I want the user not to be able to remove any Item but be able to Add". Anyway post what you have.

                          J 1 Reply Last reply
                          0
                          • D Dan Mos

                            please insert the code that you have so far, that is if you have any. And be SPECIFIC like "I want the user of the control not to be able to remove or add anything" Or "I want the user not to be able to remove any Item but be able to Add". Anyway post what you have.

                            J Offline
                            J Offline
                            jojoba2010
                            wrote on last edited by
                            #13

                            this is the exact thing i want : I want the user not to be able to remove any Item but be able to Add for user control that inherent from toolstrip; So please Help!!!!!!!!!!!!

                            D 1 Reply Last reply
                            0
                            • J jojoba2010

                              this is the exact thing i want : I want the user not to be able to remove any Item but be able to Add for user control that inherent from toolstrip; So please Help!!!!!!!!!!!!

                              D Offline
                              D Offline
                              DaveAuld
                              wrote on last edited by
                              #14

                              From my understanding. You have created a usercontrol that has a number of items. If someone else uses this control, you do not want any of those items to be visible? If this is the case then you will want to have some form of mechanism that checks if the user has authority to use those items. If they do not then when the control is initialised then emove those items, else them them there. Is that what you mean?

                              Dave Don't forget to vote on messages! Find Me On: Web|Facebook|Twitter|LinkedIn Waving? dave.m.auld[at]googlewave.com

                              J 1 Reply Last reply
                              0
                              • D DaveAuld

                                From my understanding. You have created a usercontrol that has a number of items. If someone else uses this control, you do not want any of those items to be visible? If this is the case then you will want to have some form of mechanism that checks if the user has authority to use those items. If they do not then when the control is initialised then emove those items, else them them there. Is that what you mean?

                                Dave Don't forget to vote on messages! Find Me On: Web|Facebook|Twitter|LinkedIn Waving? dave.m.auld[at]googlewave.com

                                J Offline
                                J Offline
                                jojoba2010
                                wrote on last edited by
                                #15

                                No i wanna these items be visible for them but they wont be able do remove these default items!

                                modified on Sunday, January 31, 2010 11:48 AM

                                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