Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Panel1.Parent = PictureBox1 End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Panel1.Parent = PictureBox1 Panel1.BackColor = Color.Transparent End Sub
非常感谢,确实能看到Panel1下面的picturebox里的图片了,但是又有了一个新的问题,那就是Panel1.Parent = PictureBox1了以后Panel1容器就被放在了picturebox里面了, 我在设计里只是把Panel1放在了picturebox的上面,我通过下面代码移动Panel1 Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown oldx = e.X oldy = e.Y move = True End Sub Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove If move Then Panel1.Left = Panel1.Left + e.X - oldx Panel1.Top = Panel1.Top + e.Y - oldy End If End Sub Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp move = False End Sub 但是怎么也移不出picturebox1外面来 我并不想picturebox1包含了panel1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.Parent = PictureBox1 End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.Parent = PictureBox1
Panel1.BackColor = Color.Transparent
End Sub
非常感谢,确实能看到Panel1下面的picturebox里的图片了,但是又有了一个新的问题,那就是Panel1.Parent = PictureBox1了以后Panel1容器就被放在了picturebox里面了,
我在设计里只是把Panel1放在了picturebox的上面,我通过下面代码移动Panel1 Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
oldx = e.X
oldy = e.Y
move = True
End Sub Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If move Then
Panel1.Left = Panel1.Left + e.X - oldx
Panel1.Top = Panel1.Top + e.Y - oldy
End If End Sub Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
move = False
End Sub
但是怎么也移不出picturebox1外面来
我并不想picturebox1包含了panel1