I have created a customized user control from the FlowLayoutPanel control that contains customized Panels inside, added dynamically. I want to get the position of the controls within this FlowLayoutPanel to complete the isPointOverPanel method. Any idea? Thanks in advance
{
public partial class FlowDynamicPanel : FlowLayoutPanel
{
private PictureBox addIcon;
List<ResizablePanel> resizablePanels;
public FlowDynamicPanel()
{
resizablePanels = new List<ResizablePanel>();
ResizablePanel rp = CreateNewPanel();
Controls.Add(rp);
addIcon = new PictureBox
{
Image = Resource1.adIcon,
Size = new Size(100, 100),
SizeMode = PictureBoxSizeMode.StretchImage,
BorderStyle = BorderStyle.FixedSingle
};
addIcon.MouseClick += AddIcon_MouseClick;
this.Controls.Add(addIcon);
InitializeComponent();
}
private void AddIcon_MouseClick(object sender, MouseEventArgs e)
{
Controls.Add(CreateNewPanel());
Controls.SetChildIndex(addIcon, Controls.Count);
}
private ResizablePanel CreateNewPanel()
{
ResizablePanel _newRp = new ResizablePanel
{
Size = new Size(40, 40),
BorderStyle = BorderStyle.FixedSingle
};
resizablePanels.Add(_newRp);
return _newRp;
}
public ResizablePanel IsPointOverPanel(Point p)
{
//Obtener la posición de los paneles dentro de this y comprobar si p esta dentro.
}