Windows Forms Panel

Published 22 February 05 10:39 PM | russnem

Today I was toying with the task of creating an extensible Windows Forms application (much like stock & bond quote systems are today). The client wanted to be able to select a particular real estate investor and have the ability to create any number of more detailed content areas on the main application form.

For example, selecting investor #1 on a Windows form with 6 content areas on it would yield 6 different view of this investor's information.

I thought of using a Windows Forms Panel control. I subclassed it and got everything up and running. Then it came time for me, as one of the developers in my organization, to sit down and design a panel that would provide the user with useful information.

You can't.

I double-clicked on my new class (which subclassed my new "InvestorPanel" Windows Forms control, which in turn subclassed the normal Panel control) and all I got was the component design surface. I wasn't able to precisely lay out labels, text boxes, and other controls on my new control.

Does anyone have an idea of how I can allow developers to visuall design Windows Forms controls in design time so that they don't have to add all their controls at run time?

Comments

# Nat said on February 23, 2005 07:36 AM:

I think in your case it makes more sense to inherit from UserControl instead of Panel so that you can drag and drop some other controls on top of it.

# Russ said on February 23, 2005 12:26 PM:

I changed the inheritance but I still get the component design surface, not the true WYSIWYG design surface like a form provides.

# Nat said on February 23, 2005 01:21 PM:

Try adding this

[System.ComponentModel.DesignerCategory("Form")] at your class definition. See whether it helps.

# Russ said on February 23, 2005 01:25 PM:

Actually, once I built the solution the design surface appeared, so the UserControl idea worked!

Thanks,
Russ

# Nat said on February 23, 2005 01:26 PM:

Sorry.... it should be

[DesignerCategory(Category="UserControl")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="System.Windows.Forms.Design.ControlDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IRootDesigner, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", DesignerTypeName="System.Windows.Forms.Design.UserControlDocumentDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]

# Nat said on February 24, 2005 09:07 PM:

Hey...

Does it work?

[DesignerCategory(Category="UserControl")]
public class InvestorPanel : UserControl
{
...
}

# Russ said on February 24, 2005 10:06 PM:

Actually, once I built the solution the design surface appeared, so the UserControl idea worked!

Thanks,
Russ

# Asia said on April 2, 2010 08:52 PM:

Could you help me. We cannot deny the facts of nature, but we should certainly try to improve on them. Help me! Need information about: Know more about inderal la. I found only this - <a href="www.modellballone.com/.../inderal-migraine">inderal migraine</a>. If you feel term cure lead, n't i have a many spine you should treat to treat all the apprehension you suffer to before stage effects, inderal. Inderal, these are fresh blood medications, top activity medications and social eliminated addition attacks. Thanks :mad:. Asia from Britain.

# weblogs.asp.net said on April 16, 2011 01:49 PM:

378639.. Outstanding :)

# weblogs.asp.net said on June 17, 2011 12:26 PM:

378639.. I like it :)

Leave a Comment

(required) 
(required) 
(optional)
(required)