Home>

I'm thinking of inheriting the FlowLayoutPanel and adding functions, but it just doesn't work, so please let me know if anyone knows it.

■ What I tried

1. 1. Add user controls to your project.

2. Changed to inherit FlowLayoutPanel.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.ComponentModel.Design;
namespace WFroms
{
    [Designer ("System.Windows.Forms.Design.PanelDesigner, System.Design")] //<-I tried both
    // [Designer ("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof (IDesigner))] //<-I tried both
    public partial class WFlowLayoutPanel: FlowLayoutPanel
    {
        public WFlowLayoutPanel ()
        {
            InitializeComponent ();
        }
    }
}

3. 3. Place the button by pasting it on the form.

■ I'm in trouble

Once the control is placed on the created WFlowLayoutPanel, the placement cannot be moved by dragging.

I tried it in C # VS2017, 2019 and got the same result.

  • Answer # 1

    [Designer ("System.Windows.Forms.Design.PanelDesigner, System.Design")]
    Isn't it because you specify the designer of the panel?
    Since it is a FlowLayoutPanel, let's specify the designer of the FlowLayoutPanel.