毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

vb椭圆窗口中的任意位置拖动窗体如何实现

更新时间:2013-4-15:  来源:毕业论文

vb椭圆窗口中的任意位置拖动窗体如何实现
Private Type point     X As Long    Y As LongEnd Type   Private Declare Function GetCursorPos Lib "user32" (lpPoint As point) As LongPrivate Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As LongPrivate Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal Redraw As Long) As Long  Dim point1 As point, point2 As point, point3 As point Dim xa As Single, ya As Single      Private Sub Form_ReSize()     Image1.Width = Me.ScaleWidth     Image1.Height = Me.ScaleHeight     Dim Outer_rgn As Long    Dim Inner_rgn As Long    Dim Combined_rgn As Long    Dim wid As Single    Dim hgt As Single    Dim border_width As Single    Dim title_height As Single         wid = Me.ScaleWidth     hgt = Me.ScaleHeight           border_width = (wid - Me.ScaleWidth) / 2     title_height = hgt - border_width - Me.ScaleHeight     Outer_rgn = CreateRectRgn(border_width, title_height, wid, hgt)     Inner_rgn = CreateEllipticRgn(border_width + ScaleWidth * 0.1, title_height + ScaleHeight * 0.1, ScaleWidth * 0.9, ScaleHeight * 0.9)     Combined_rgn = CreateRectRgn(0, 0, 0, 0)     CombineRgn Combined_rgn, Outer_rgn, Inner_rgn, 1     SetWindowRgn Me.hWnd, Combined_rgn, TrueEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) xa = X ya = Y End Sub  Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)     If Button = 1 Then Me.Move Me.Left + X - xa, Me.Top + Y - ya End Sub

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function ReleaseCapture Lib "user32" () As LongPrivate Const WM_SYSCOMMAND = &H112 Private Const SC_MOVE = &HF010& Private Const HTCAPTION = 2 Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)     Call ReleaseCapture   Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, ByVal 0&) End Sub

那些Rgn用完了就DeleteObject

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。