Reputation: 729
I have a base form containing some elements like this:
- pnlSearch of type Panel
: search button
- pnlActions of type FlowLayoutPanel
: add, edit, delete, export.. etc buttons
nothing is locked, both panels' modifiers are Private
& buttons' modifiers are Protected
FlowLayoutPanel
is used to customize options in the child forms (e.g. removing the delete option) without leaving empty spaces since the elements will flow accordingly.
In a child form, the search button only is accessible. Buttons in pnlActions
are locked in the designer but by checking the properties Locked = False
and Modifiers= Protected
Tried setting the pnlActions' modifiers to Protected
but it's still the same.
Any idea what's causing this behavior?
what's the difference between Panel
and FlowLayoutPanel
other than inner controls layout?
I'd post code samples if I've hand-coded anything but it's all generated by designer
I'm using VS 2013 on Win7 if that would matter
Thanks in advance
Upvotes: 0
Views: 1225
Reputation: 722
I know it's an old question, but I share a possible solution, in case someone needs it.
We will create a class that inherits FlowLayoutPanel
, I name it FlowLayoutPanelHeritable
. You can place it in the namespace that you consider appropriate, for this example the namespace is WindowsFormsApp
.
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace WindowsFormsApp
{
[Designer(typeof(ParentControlDesigner))]
public class FlowLayoutPanelHeritable : FlowLayoutPanel
{
}
}
First we must set the modifiers of the FlowLayoutPanel
that is in FatherForm
, in Protected
. Now we must make a modification by code in FatherForm
, accessing FatherForm.designer.cs
. We will replace each instance of FlowLayoutPanel
, by FlowLayoutPanelHeritable
(in the creation, and initialization of variables). Then we save, and recompile.
Now if you access ChildForm
, you will see that you no longer have the modification restriction at design time.
Important: if you want to edit FatherForm
, you will have to access FatherForm.designer.cs
and replace all the FlowLayoutPanelHeritable
to FlowLayoutPanel
again; When you finish editing, perform the reverse process.
Upvotes: 0
Reputation: 654
this is a problem of the Designer. if you do your changes via code all work... The problem won't be resolved because the platform is not mainteined by Microsoft anymore.
Upvotes: 1