コード例 #1
0
        Control CreateChild(object context = null)
        {
            var item  = (Control)Activator.CreateInstance(ViewType);
            item.Tag  = context;
            item.Dock = DockStyle.Fill;

            var panel     = new BaseUserControl { Dock = DockStyle.Top, Height = item.Height };
            var btnRemove = new Button { Text = "-", Dock = DockStyle.Right, Width = 30 };

            btnRemove.Click += (s, e) => RemoveItem(context);
            panel.Controls.Add(item);
            panel.Controls.Add(btnRemove);

            return panel;
        }
コード例 #2
0
        Control CreateChild(object context = null)
        {
            var item = (Control)Activator.CreateInstance(ViewType);

            item.Tag  = context;
            item.Dock = DockStyle.Fill;

            var panel = new BaseUserControl {
                Dock = DockStyle.Top, Height = item.Height
            };
            var btnRemove = new Button {
                Text = "-", Dock = DockStyle.Right, Width = 30
            };

            btnRemove.Click += (s, e) => RemoveItem(context);
            panel.Controls.Add(item);
            panel.Controls.Add(btnRemove);

            return(panel);
        }