一个PictureBox控件(已经有图片),我想鼠标点下以后鼠标一定范围内的图片被COPY,随着鼠标移动到另外一个位置,送开鼠标的时候放下图片?
请教高手?有源代码就太好了,思路也行,谢谢大侠们了啊
(我知道API中的ReleaseCapture和SendMessage能够实现控件的移动,可是这个是图片该如何实现??)

解决方案 »

  1.   

    我也在思考这个问题啊! 我只想出了一不份:
    我已经解决了图片的部分复制,移动。可是也不知道如何把它再COPY回原图片上面去啊!楼主解决问题后记得给我留言哦!!!!
      

  2.   

    1、选定图像范围
    需要用到pictureclip控件,在picture1上画1个shape控件(方形的)
    option explicit
    dim flag as boolean  '定义一个标志位form_load 事件
       shape1.visible=false
       flag=false
    picture1_click 事件
       flag=true
       shape1.visible=falsepicture1_mousedown 事件
       if button=1 and flag then
          shape1.left=x
          shape1.top=y
       end if
    picture1_mousemove 事件
       if button=1 then flag then
          shape1.width=x-shape1.left
          shape1.height=y-shape1.top
          shape1.visible=true
       end if
    picture1_mouseover 事件
        flag=false
    2、随着鼠标移动到另外一个位置,送开鼠标的时候放下图片
    需要用到pictureclip控件
    option explicit
    dim flag as boolean  '定义一个标志位form_load 事件
       flag=falsecommand1.click 事件
       clipboard.cls
       pictureclip1.picture=picture1
       pictureclip1.clipx=shape1.left
       pictureclip1.clipy=shape1.top
       pictureclip1.width=shape1.width
       pictureclip1.height=shape1.height
       clipboard.setdata pictureclip.clippicture2.click  事件
       flag=truepicture2.mousedown 事件
       if flag and button=1 then
          picture2.paintpicture clipboard.getdata,x,y
       end ifpicture2.mouseover 事件
       flag=false
      

  3.   

    用stretchblt可以将图像在同一或不同的对象间拷贝
      

  4.   

    呵呵,我比你更早解决了这个问题,
    鼠标点下的时候,picture2. paintpicture picture1.picture,0,0,picture2.width, _
                               picture2.height,中你选定的范围
    拖到目标区域后释放鼠标 picture1.paintpicture picture2.image,你想覆盖的区域  '我给你思路了代码太长了,我想你自己可以完成的。