I have been trying to identify a solution to this problem for some time. I have a control on the form. I change the location of that control on a path from an ending point back to the starting point.
I accomplish this by mappint the path incrementally along 64 points along a line. I put all of those points into an array and then loop through the array with a for-each loop. This part works fine, but now, here is the problem.
When the control is displayed on the form at its new location, I would like for that location image to be cleared before displaying the control at its next location. The way it displays now is that there is a path of displayed locations for the control from its ending point back to its starting point, kind of like ghost images.
private static void ProvideDragPathReturnToParent(Control ctrl, int intX_end, int intY_end,
int intX_start, int intY_start)
{
Point pt0 = new Point(intX_start, intY_start);
Point pt64 = new Point(intX_end, intY_end);
Point pt32 = new Point(((pt0.X + pt64.X)/2), ((pt0.Y + pt64.Y)/2));
Point pt16 = new Point(((pt0.X + pt32.X)/2), ((pt0.Y + pt32.Y)/2));
Point pt48 = new Point(((pt32.X + pt64.X)/2), ((pt32.Y + pt64.Y)/2));
Point pt8 = new Point(((pt0.X + pt16.X)/2), ((pt0.Y + pt16.Y)/2));
Point pt24 = new Point(((pt16.X + pt32.X)/2), ((pt16.Y + pt32.Y)/2));
Point pt40 = new Point(((pt32.X + pt48.X)/2), ((pt32.Y + pt48.Y)/2));
Point pt56 = new Point(((pt48.X + pt64.X)/2), ((pt48.Y + pt64.Y)/2));
Point pt4 = new Point(((pt0.X + pt8.X)/2), ((pt0.Y + pt8.Y)/2));
Point pt12 = new Point(((pt8.X + pt16.X)/2), ((pt8.Y + pt16.Y)/2));
Point pt20 = new Point(((pt16.X + pt24.X)/2), ((pt16.Y + pt24.Y)/2));
Point pt28 = new Point(((pt24.X + pt32.X)/2), ((pt24.Y + pt32.Y)/2));
Point pt36 = new Point(((pt32.X + pt40.X)/2), ((pt32.Y + pt40.Y)/2));
Point pt44 = new Point(((pt40.X + pt48.X)/2), ((pt40.Y + pt48.Y)/2));
Point pt52 = new Point(((pt48.X + pt56.X)/2), ((pt48.Y + pt56.Y)/2));
Point pt60 = new Point(((pt56.X + pt64.X)/2), ((pt56.Y + pt64.Y)/2));
Point pt2 = new Point(((pt0.X + pt4.X)/2), ((pt0.Y + pt4.Y)/2));
Point pt6 = new Point(((pt4.X + pt8.X)/2), ((pt4.Y + pt8.Y)/2));
Point pt10 = new Point(((pt8.X + pt12.X)/2), ((pt8.Y + pt12.Y)/2));
Point pt14 = new Point(((pt12.X + pt16.X)/2), ((pt12.Y + pt16.Y)/2));
Point pt18 = new Point(((pt16.X + pt20.X)/2), ((pt16.Y + pt20.Y)/2));
Point pt22 = new Point(((pt20.X + pt24.X)/2), ((pt20.Y + pt24.Y)/2));
Point pt26 = new Point(((pt24.X + pt28.X)/2), ((pt24.Y + pt28.Y)/2));
Point pt30 = new Point(((pt28.X + pt32.X)/2), ((pt28.Y + pt32.Y)/2));
Point pt34 = new Point(((pt32.X + pt36.X)/2), ((pt32.Y + pt36.Y)/2));
Point pt38 = new Point(((pt36.X + pt40.X)/2), ((pt36.Y + pt40.Y)/2));
Point pt42 = new Point(((pt40.X + pt44.X)/2), ((pt40.Y + pt44.Y)/2));
Point pt46 = new Point(((pt44.X + pt48.X)/2), ((pt44.Y + pt48.Y)/2));
Point pt50 = new Point(((pt48.X + pt52.X)/2), ((pt48.Y + pt52.Y)/2));
Point pt54 = new Point(((pt52.X + pt56.X)/2), ((pt52.Y + pt56.Y)/2));
Point pt58 = new Point(((pt56.X + pt60.X)/2), ((pt56.Y + pt60.Y)/2));
Point pt62 = new Point(((pt60.X + pt64.X)/2), ((pt60.Y + pt64.Y)/2));
Point pt1 = new Point(((pt0.X + pt2.X)/2), ((pt0.Y + pt2.Y)/2));
Point pt3 = new Point(((pt2.X + pt4.X)/2), ((pt2.Y + pt4.Y)/2));
Point pt5 = new Point(((pt4.X + pt6.X)/2), ((pt4.Y + pt6.Y)/2));
Point pt7 = new Point(((pt6.X + pt8.X)/2), ((pt6.Y + pt8.Y)/2));
Point pt9 = new Point(((pt8.X + pt10.X)/2), ((pt8.Y + pt10.Y)/2));
Point pt11 = new Point(((pt10.X + pt12.X)/2), ((pt10.Y + pt12.Y)/2));
Point pt13 = new Point(((pt12.X + pt14.X)/2), ((pt12.Y + pt14.Y)/2));
Point pt15 = new Point(((pt14.X + pt16.X)/2), ((pt14.Y + pt16.Y)/2));
Point pt17 = new Point(((pt16.X + pt18.X)/2), ((pt16.Y + pt18.Y)/2));
Point pt19 = new Point(((pt18.X + pt20.X)/2), ((pt18.Y + pt20.Y)/2));
Point pt21 = new Point(((pt20.X + pt22.X)/2), ((pt20.Y + pt22.Y)/2));
Point pt23 = new Point(((pt22.X + pt24.X)/2), ((pt22.Y + pt24.Y)/2));
Point pt25 = new Point(((pt24.X + pt26.X)/2), ((pt24.Y + pt26.Y)/2));
Point pt27 = new Point(((pt26.X + pt28.X)/2), ((pt26.Y + pt28.Y)/2));
Point pt29 = new Point(((pt28.X + pt30.X)/2), ((pt28.Y + pt30.Y)/2));
Point pt31 = new Point(((pt30.X + pt32.X)/2), ((pt30.Y + pt32.Y)/2));
Point pt33 = new Point(((pt32.X + pt34.X)/2), ((pt32.Y + pt34.Y)/2));
Point pt35 = new Point(((pt34.X + pt36.X)/2), ((pt34.Y + pt36.Y)/2));
Point pt37 = new Point(((pt36.X + pt38.X)/2), ((pt36.Y + pt38.Y)/2));
Point pt39 = new Point(((pt38.X + pt40.X)/2), ((pt38.Y + pt40.Y)/2));
Point pt41 = new Point(((pt40.X + pt42.X)/2), ((pt40.Y + pt42.Y)/2));
Point pt43 = new Point(((pt42.X + pt44.X)/2), ((pt42.Y + pt44.Y)/2));
Point pt45 = new Point(((pt44.X + pt46.X)/2), ((pt44.Y + pt46.Y)/2));
Point pt47 = new Point(((pt46.X + pt48.X)/2), ((pt46.Y + pt48.Y)/2));
Point pt49 = new Point(((pt48.X + pt50.X)/2), ((pt48.Y + pt50.Y)/2));
Point pt51 = new Point(((pt50.X + pt52.X)/2), ((pt50.Y + pt52.Y)/2));
Point pt53 = new Point(((pt52.X + pt54.X)/2), ((pt52.Y + pt54.Y)/2));
Point pt55 = new Point(((pt54.X + pt56.X)/2), ((pt54.Y + pt56.Y)/2));
Point pt57 = new Point(((pt56.X + pt58.X)/2), ((pt56.Y + pt58.Y)/2));
Point pt59 = new Point(((pt58.X + pt60.X)/2), ((pt58.Y + pt60.Y)/2));
Point pt61 = new Point(((pt60.X + pt62.X)/2), ((pt60.Y + pt62.Y)/2));
Point pt63 = new Point(((pt62.X + pt64.X)/2), ((pt62.Y + pt64.Y)/2));
Point[] arrPoint = {pt64, pt63, pt62, pt61, pt60, pt59, pt58, pt57, pt56,
pt55, pt54, pt53, pt52, pt51, pt50, pt49, pt48, pt47,
pt46, pt45, pt44, pt43, pt42, pt41, pt40, pt39, pt38,
pt37, pt36, pt35, pt34, pt33, pt32, pt31, pt30, pt29,
pt28, pt27, pt26, pt25, pt24, pt23, pt22, pt21, pt20,
pt19, pt18, pt17, pt16, pt15, pt14, pt13, pt12, pt11,
pt10, pt9, pt8, pt7, pt6, pt5, pt4, pt3, pt2, pt1, pt0};
foreach (Point pt in arrPoint)
{
ctrl.Location = pt;
ctrl.Update();
}
}
-- modified at 8:55 Saturday 10th March, 2007
|