how can I visually edit Panel?

  • Thread starter Thread starter Franz
  • Start date Start date
F

Franz

Without add to a windows form, how can I visually edit a panel in VS.NET?
I can edit a UserControl visually, but why can't I do the same for panel?
 
Franz,

You can create a control inherited from Panel and edit it visually. The
Panel isn't meant to be editable by itself - otherwise, where would you
imagine all the instance of edited panels being stored?

P.S. It might be better if you could tell what you are trying to achieve so
we would be able to suggest an appropriate solution.
 
But when I click "View Design", the Editor says "To add components to your
class, drag them from the Server Explorer or Toolbox and use the Properties
window to set their properties. To create methods and events for your class,
click here to switch to code view. However, I can edit a UserControl with
the designer.

Dmitriy Lapshin said:
Franz,

You can create a control inherited from Panel and edit it visually. The
Panel isn't meant to be editable by itself - otherwise, where would you
imagine all the instance of edited panels being stored?

P.S. It might be better if you could tell what you are trying to achieve so
we would be able to suggest an appropriate solution.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Franz said:
Without add to a windows form, how can I visually edit a panel in VS.NET?
I can edit a UserControl visually, but why can't I do the same for panel?
 
I see what you mean. There's a little trick. Create your class as a simple
UserControl first, then go to the Code View and make it derived from Panel.
If this does not help, add a UserControl to your project, open the
csproj/vbproj file in a text editor and compare the icon types the
UserControl and the drived control have (you can then safely dispose of the
UserControl after the desired icon type is determined).
I remember changing this type for the Panel-derived control to that of the
UserControl made it appear as designable (this is easily determined by an
icon displayed next to the control's file in the Solution Explorer).

I know it looks like a kind of hack, but it seems VS .NET lacks a bit of
designer support for derived controls.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Franz said:
But when I click "View Design", the Editor says "To add components to your
class, drag them from the Server Explorer or Toolbox and use the Properties
window to set their properties. To create methods and events for your class,
click here to switch to code view. However, I can edit a UserControl with
the designer.

"Dmitriy Lapshin [C# / .NET MVP]" <[email protected]> ¦b¶l¥ó
Franz,

You can create a control inherited from Panel and edit it visually. The
Panel isn't meant to be editable by itself - otherwise, where would you
imagine all the instance of edited panels being stored?

P.S. It might be better if you could tell what you are trying to achieve so
we would be able to suggest an appropriate solution.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Franz said:
Without add to a windows form, how can I visually edit a panel in VS.NET?
I can edit a UserControl visually, but why can't I do the same for panel?
 
Back
Top