Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            xButton1.Click += delegate { MessageBox.Show("this is a circle button"); };
            //  button1.Click += delegate { xButton1.Enabled = xButton1.Enabled ? false : true; };

            for (int i = 0; i < 200; i++)
            {
                CustomControl1 cc = new CustomControl1();
                cc.Size = new Size(flowLayoutPanel1.Width - 30, 73);
                flowLayoutPanel1.Controls.Add(cc);
            }
        }
Example #2
0
    // When a control is parented, tell the parent is the GroupBox, not the control itself
    protected override Control GetParentForComponent(IComponent component)
    {
        CustomControl1 cc = (CustomControl1)Control;

        return(cc.MyBox);
    }
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var customControl1 = new CustomControl1();

            XamlHost.Child = customControl1;
        }