Control 'seems' to be locked

20,083

Solution 1

This will happen when you try to design an inherited form and the control(s) on that form are private. The designer observes accessibility modifiers. Go back to the base form and change the Modifiers property of the controls from Private to Protected.

Solution 2

I was suffering exactly the same issue but it was just happening with DevExpress controls.

After some hours of changing modifiers and shooting myself in the feet I found this option on Visual Studio => DevExpress => WinForms Controls vX.X.X => Change Design-Time settings => Enable visual inheritance for Developer Express controls used in Visual Studio.

enter image description here

Solution 3

Right click on the form and uncheck option "lock controls"

This should help.

Share:
20,083
MPaul
Author by

MPaul

Updated on June 08, 2021

Comments

  • MPaul
    MPaul almost 3 years

    I'm trying to change properties to a control however it seems as if it's "locked" but in reality, it isn't because when I right-click on the control it shows the control as being unlocked.

    I'm using Visual Studio 2005, and I've never worked with a control that seems to be locked as such in the picture provided.

    I'd really appreciate a simple explanation and how to resolve this issue so that I can proceed with modifying it.

    enter image description here

    • Oded
      Oded over 12 years
      What source control system are you using?
    • Tigran
      Tigran over 12 years
      not very sure, but probably that control is defined in other file. In other words, you see the Host that holds the control.
    • particle
      particle over 12 years
      It might be attach to a process. Did you pressed F5 to run the project and then switch to VS and trying to edit control. If this is the case you need to stop debugger.
    • Igby Largeman
      Igby Largeman over 12 years
      Are those controls on a UserControl which you've placed on your form? If so then you have to open the UserControl and change the modifier property on each of the controls you want to be able to modify. Or you could just modify them on the UserControl itself, if that won't break something else.
  • Gabriel GM
    Gabriel GM over 12 years
    When a control is locked, you can see a little lock at the top left of it. Locking a container also locks all the the controls inside it.
  • MPaul
    MPaul over 12 years
    Sorry, but as I've mentioned before these controls aren't locked.
  • MPaul
    MPaul over 12 years
    Hi, thanks for your answer. I'm still slightly confused though. What do you mean by the base form? In the image above, the bnvNavigator is a user control which is inherited from Microsoft's BindingNavigator control. I'm assuming by going back to the base form you don't mean alter Microsoft's code? Thanks
  • user1703401
    user1703401 over 12 years
    I assumed in my answer that you inherited from a form other than the Form class. Project + Add New Item, Windows Forms + Inherited Form. If that's not the case then this answer doesn't match your problem. To make a control embedded in a UserControl editable, you'll need a custom designer. See stackoverflow.com/questions/2785376/… I don't understand the screen shot though, doesn't look like a UserControl.
  • Bob
    Bob almost 11 years
    @HansPassant That does not seem to do anything for a TableLayoutPanel, nor a FlowLayoutPanel, which seem to be special. (I'm designing a user control inheriting [not embedding, as in your last comment] another that contains a TableLayoutPanel, which remains locked no matter what its accessibility modifier is, Private, Protected or Public.)
  • Bob
    Bob almost 11 years
    Oh, well, confirmed by MSDN: The TableLayoutPanel control does not support visual inheritance in the Windows Forms Designer. A TableLayoutPanel control in a derived class appears as "locked" at design time.
  • rraszewski
    rraszewski over 10 years
    If you are using TableLayoutPanel in base control and you want to change some layout properties in inherited class insert TableLayoutPanel into Panel. Of course Panel should have protected modifier.