关于图片拖动的问题
在对picturebox上的图片进行拖动的时候会出现一个黑框,怎么样去掉那个黑框? 问题点数:50、回复次数:4Top
1 楼ayuu(ayuu)回复于 2002-07-16 12:34:09 得分 10
不能去掉的。但可以用其他方法来实现你想要的效果。
通过clike和move来控制图片的位置移动,这样不使用drag就不会有黑框了。Top
2 楼griefforyou(为你伤心)回复于 2002-07-16 12:39:07 得分 30
Option Explicit
Dim maymove As Boolean
Dim dx As Integer
Dim dy As Integer
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = 1) Then
dx = X
dy = Y
maymove = True
Else
Unload Me
End If
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim mx As Integer
Dim my As Integer
If (maymove = True) Then
mx = X - dx
my = Y - dy
Form1.Left = Form1.Left + mx
Form1.Top = Form1.Top + my
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
maymove = False
End Sub
Private Sub Form_Load()
maymove = False
'Me.BorderStyle = none
Form1.Height = Command1.Height
Form1.Width = Command1.Width
Command1.Left = 0
Command1.Top = 0
End Sub
Private Sub Timer1_Timer()
Command1.Caption = Now
End Sub
Top
3 楼wxy_xiaoyu(猪是的看来过倒)回复于 2002-07-16 13:14:58 得分 10
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Const HTCAPTION = 2
Const WM_NCLBUTTONDOWN = &HA1
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage Picture1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End If
End Sub
Top




