我试过用 line  circle 方法画出图形,但不会怎样移动.
特别不会,如果确定我用mouse 可选定其中一个图形,有没其他的画图方法,又可以容易移动,那里有相关的代码,
能助者,再加分,

解决方案 »

  1.   

    哈哈,想到了,你可以使用shape 和line 控件来画你的图形
    它们是对象,当然可以移动啦试试看
      

  2.   

    先用PICTURE画,然后用BITBLT擦写,也蛮快的。
      

  3.   

    多谢各位,但1,我想按一下,"line"按钮,就可以任意画出直线,然后就可用mouse 选定其中一条,并任意移动,2,用line shape控件,只是已有的图形,不是我自已画出来的,.我是要自己画出的.各位高手,再想想办法吧,我有2000多分,想到答案的可以要多少都行
      

  4.   

    用PictureBox的MouseDown判断是否落在图形区域内,然后在MouseMove里重画。我觉得这个反倒用Vc做简单些。
      

  5.   

    如果你是在窗体上的
    那么使用窗体的mouse_down事件判断鼠标是否在line属性 x1,y1和x2,y2之间
    然后使用mouse_move修改line  的属性也就是x1,y1和x2,y2的值
    Dim bifMove  As Boolean
    Dim MousePointx As Single
    Dim MousePointy As SinglePrivate Sub Form_Load()
        bifMove = False
    End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Line1.X1 = Line1.X2 Then
            If Line1.X1 <> X Then
                Exit Sub
            End If
             If (Y > Line1.Y1 And Y < Line1.Y2) Or (Y < Line1.Y1 And Y > Line1.Y2) Then
                MousePointx = X
                MousePointy = Y
                bifMove = True
            End If
        Else
            If Line1.Y1 <> Y Then
                    Exit Sub
            End If
            If (X > Line1.X1 And X < Line1.X2) Or (X < Line1.X1 And X > Line1.X2) Then
                MousePointx = X
                MousePointy = Y
                bifMove = True
            End If
        End IfEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      
        If bifMove = True Then
            Line1.X1 = Line1.X1 - (MousePointx - X)
            Line1.Y1 = Line1.Y1 - (MousePointy - Y)
            Line1.X2 = Line1.X2 - (MousePointx - X)
            Line1.Y2 = Line1.Y2 - (MousePointy - Y)
            
            MousePointx = X
            MousePointy = Y
            
            Me.Refresh
        End If
    End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        bifMove = False
    End Sub还有问题请说
      

  6.   

    但问题是,我用picture1.line ()-() 画出的图是没有名字的,
    所以用不了你说的方法,
    我想首先要让画出的图成为一个个对象,但就是这个我不会,
    有人说过
    ======================================================
    (首先你要为你的每个图形建立对象GC(最好为他们建立一个接口I_Graphic),其中保存有如何绘制自己的信息,另外,在加上 zorder.
    zorder 初始为绘画顺序。
    然后,写一个函数,根据GC和鼠标位置得出最上层的图形对象。
    function IsIntersect(pGo as I_Graphic,pPoint as Point) as boolean依次检查所有图形:
    maxzorder=0
    dim selgro as I_Graphic
    for each gro in AllGraphics
      if gro.zorder>maxzorder and IsIntersect(gro,mousepoint) then
        maxzorder = gro.zorder
        set selgro = gro
      end if
    next=============================
    但我不明白,具体怎样做