Click here to Skip to main content
15,890,186 members
Home / Discussions / C#
   

C#

 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
OriginalGriff29-Nov-18 5:32
mveOriginalGriff29-Nov-18 5:32 
AnswerRe: Usercontrol poser ( rusty Winforms guy ) Pin
BillWoodruff1-Dec-18 16:52
professionalBillWoodruff1-Dec-18 16:52 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
pkfox1-Dec-18 21:04
professionalpkfox1-Dec-18 21:04 
AnswerRe: Usercontrol poser ( rusty Winforms guy ) Pin
BillWoodruff2-Dec-18 0:43
professionalBillWoodruff2-Dec-18 0:43 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
pkfox2-Dec-18 3:48
professionalpkfox2-Dec-18 3:48 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
BillWoodruff2-Dec-18 4:06
professionalBillWoodruff2-Dec-18 4:06 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
pkfox2-Dec-18 6:03
professionalpkfox2-Dec-18 6:03 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
BillWoodruff2-Dec-18 6:51
professionalBillWoodruff2-Dec-18 6:51 
Okay, first take a look at this: [^] and this: [^] ... a custom Designer, and the right Attributes on the UserControl class definition, can enable a UserControl to have Controls drag-drop added at design-time.

It's been a while since I have messed with doing this, and I don't think that design-time facility will extend to sub-classed UserControls ... but, I'm not sure.

A custom designer (one I actually wrote) might look like this:
using System.ComponentModel;
using System.Windows.Forms.Design;

namespace YourNameSpace
{
    public class TestControlDesigner : ParentControlDesigner
    {
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            if (Control is InheritedPanel)
                EnableDesignMode((InheritedPanel) Control, Control.Name);
            else if (Control is InheritedPanelHost) EnableDesignMode((InheritedPanelHost) Control, Control.Name);
        }
    }
}
Note the reference to 'InheritedPanel and 'InheritedPanelHost above: Classes I created:
using System.ComponentModel;
using System.Windows.Forms;

namespace YourNameSpace
{
    [Designer(typeof(TestControlDesigner))]
    public partial class InheritedPanel : UserControl
    {
        public InheritedPanel()
        {
            InitializeComponent();
        }
    }
}
Do familiarize yourself with Attributes that enable design-time property-grid editing as shown in use here;
C#
using System.ComponentModel;
using System.Windows.Forms;

namespace YourNameSpace
{
    [Designer(typeof(TestControlDesigner))]
    public partial class PanelBase : UserControl
    {
        public PanelBase()
        {
            InitializeComponent();
        }

        [Category("Appearance")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public TreeView TV { get; private set; }

        [Category("Appearance")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Panel TopPanel { get; private set; }

        [Category("Appearance")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Panel LowerPanel { get; private set; }

        public void setPanelLabel(string s)
        {
            label1.Text = s;
        }

        private void PanelBase_Load(object sender, EventArgs e)
        {
            // set TV, TopPanel, LowerPanel, Properties to actual Controls
        }
    }
}
cheers, Bill
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot


modified 2-Dec-18 13:45pm.

GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
BillWoodruff2-Dec-18 18:57
professionalBillWoodruff2-Dec-18 18:57 
GeneralRe: Usercontrol poser ( rusty Winforms guy ) Pin
pkfox2-Dec-18 19:21
professionalpkfox2-Dec-18 19:21 
QuestionRead and write JSON in c# WinForms Pin
jkirkerx28-Nov-18 13:20
professionaljkirkerx28-Nov-18 13:20 
AnswerRe: Read and write JSON in c# WinForms Pin
OriginalGriff28-Nov-18 19:39
mveOriginalGriff28-Nov-18 19:39 
GeneralRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 8:51
professionaljkirkerx29-Nov-18 8:51 
AnswerRe: Read and write JSON in c# WinForms Pin
Mc_Topaz28-Nov-18 20:05
Mc_Topaz28-Nov-18 20:05 
GeneralRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 8:49
professionaljkirkerx29-Nov-18 8:49 
AnswerRe: Read and write JSON in c# WinForms Pin
Richard Deeming29-Nov-18 1:09
mveRichard Deeming29-Nov-18 1:09 
GeneralRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 9:47
professionaljkirkerx29-Nov-18 9:47 
AnswerRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 9:46
professionaljkirkerx29-Nov-18 9:46 
AnswerI finally got it Pin
jkirkerx29-Nov-18 10:42
professionaljkirkerx29-Nov-18 10:42 
QuestionGet Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 5:48
professionalKevin Marois28-Nov-18 5:48 
AnswerRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 5:55
mveOriginalGriff28-Nov-18 5:55 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 7:03
professionalKevin Marois28-Nov-18 7:03 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 8:15
mveOriginalGriff28-Nov-18 8:15 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 8:42
professionalKevin Marois28-Nov-18 8:42 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 9:12
mveOriginalGriff28-Nov-18 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.