有10个image并且中有图片..要实现10个位置任意两个image中的图像拖放互换算法???
各位大哥帮帮忙!!!!

解决方案 »

  1.   

    参考 第三方控件http://www.visual-graph.com/delphi调用这个图形控件 实现
      

  2.   

    使用TCAD可以实现.
    http://www.codeidea.com/cn/
      

  3.   

    你可以判断image的图形边框,并利用鼠标状态,如果你在一个image中按下鼠标,并一直按着进入到另外一个image区域中,在释放鼠标左键时进行图片的互换就可以了
      

  4.   

    期间主要是把哪儿image的image1.Picture.LoadFromFile的属性对调而已,,,
      

  5.   

    用Paintbox 显示图片,多少个都行          AItem:=TPaintBox.Create(ScrollBox1);
              AItem.Tag:=AQuery.FieldByName('ID').AsInteger;
              AItem.Parent:=ScrollBox1;
              AItem.OnMouseDown:=PaintBox1MouseDown;
              AItem.OnMouseMove:=PaintBox1MouseMove;
              AItem.OnMouseUp:=PaintBox1MouseUp;
              AItem.OnPaint:=PaintBox1Paint;
    //绘制内容
    procedure TFormDoor.PaintBox1Paint(Sender: TObject);
    Var AItem:TPaintBox;
    begin
         If Not(Sender Is TPaintBox) Then Exit;
         AItem:=Sender As TPaintBox;     ImageList2.Draw(AItem.Canvas,10,25,0)
    end;//鼠标按下
    procedure TFormDoor.PaintBox1MouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    Var P:TPoint;
    begin
         If Not(Sender Is TPaintBox) Then Exit;
         CurrentItemM:=TPaintBox(Sender);
         ScrollBox1.Refresh;     MDown:=True;     P.X:=X; P.Y:=Y; P:=TPaintBox(Sender).ClientToScreen(P);
         OldX:=P.X;
         OldY:=P.Y;
    end;//移动
    procedure TFormDoor.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    Var P:TPoint;
    begin
         If Not(Sender Is TPaintBox) Then Exit;
         If Not MDown Then Exit;
         If Sender<>CurrentItem Then Exit;     P.X:=X; P.Y:=Y; P:=TPaintBox(Sender).ClientToScreen(P);     TPaintBox(Sender).Left:=TPaintBox(Sender).Left+P.X-OldX;
         TPaintBox(Sender).Top:=TPaintBox(Sender).Top+P.Y-OldY;     OldX:=P.X;
         OldY:=P.Y;
    end;//结束移动
    procedure TFormDoor.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
         If Not(Sender Is TPaintBox) Then Exit;
         If Not MDown Then Exit;
         MDown:=False;     If Sender<>CurrentItem Then Exit;     TPaintBox(Sender).Left:=Round((TPaintBox(Sender).Left / 8))*8;
         TPaintBox(Sender).Top:=Round((TPaintBox(Sender).Top / 8))*8;     //保存位置信息
         //显示信息
    end;