Hi! From other posts and just messing around, I'm very close to making this work properly. However I'm running into a couple of issues that I can't seem to clear up.
Essentially I have two flowchart controls on one form. When one is disabled, boxes on that control can be dragged and dropped on the second flowchart.
Here's the pertinent code:
private void flowChart2_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void flowChart2_DragDrop(object sender, DragEventArgs e)
{
PointF pF = flowChart2.ClientToDoc(new Point(e.X, e.Y));
if (e.Data.GetDataPresent(typeof(Box)))
{
Box tb = (Box)e.Data.GetData(typeof(Box));
//tb.Move(pF.X, pF.Y);
flowChart2.Objects.Add(tb);
flowChart2.Refresh();
}
}
private void flowChart1_MouseDown(object sender, MouseEventArgs e)
{
if (flowChart1.Behavior == BehaviorType.DoNothing)
{
PointF pF = flowChart1.ClientToDoc(new Point(e.X, e.Y));
Box b = flowChart1.GetBoxAt(pF);
if (b == null) return;
DoDragDrop(b, DragDropEffects.Copy);
}
}
Here are my problems:
1.) If there are arrows connected to the original box, they are also copied, but are only visible when the box in the second FC is selected. Also, the arrow isn't selectable. I DON'T want any connected arrows to transfer - only the box.
2.) I can't get the box to drop where the users mouse is. The //tb.Move(pF.X, pF.Y); was my attempt at this, but it offset the placement of the shape in the second FC, and deleted it from the top FC!!
3.) If one of the "drag/dropped" boxes in the second FC is selected and moved, the application crashes.
Can you help me with this??
Thanks in advance,
Blaze