Control 'seems' to be locked
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.
Solution 3
Right click on the form and uncheck option "lock controls"
This should help.
MPaul
Updated on June 08, 2021Comments
-
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.
-
Oded over 12 yearsWhat source control system are you using?
-
Tigran over 12 yearsnot very sure, but probably that control is defined in other file. In other words, you see the Host that holds the control.
-
particle over 12 yearsIt 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 over 12 yearsAre 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 over 12 yearsWhen 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 over 12 yearsSorry, but as I've mentioned before these controls aren't locked.
-
MPaul over 12 yearsHi, 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 over 12 yearsI 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 almost 11 years@HansPassant That does not seem to do anything for a
TableLayoutPanel
, nor aFlowLayoutPanel
, which seem to be special. (I'm designing a user control inheriting [not embedding, as in your last comment] another that contains aTableLayoutPanel
, which remains locked no matter what its accessibility modifier is,Private
,Protected
orPublic
.) -
Bob almost 11 yearsOh, 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 over 10 yearsIf 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.