扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
它们的窗体实际上就是你截图出来的大小,周围的阴影效果都是自己画出来的。
成都创新互联服务项目包括浉河网站建设、浉河网站制作、浉河网页制作以及浉河网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,浉河网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到浉河省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
vb.net2008
vb.net API 是将除特殊变量(如H20000)的Long都改成Integer
窗体的右侧和下方有阴影
Public Class Form1
Private Const CS_DROPSHADOW = H20000
Private Const GCL_STYLE = (-26)
Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetClassLong(Me.Handle, GCL_STYLE, GetClassLong(Me.Handle, GCL_STYLE) Or CS_DROPSHADOW)
End Sub
End Class
设置全局变量:
Dim drag As Boolean
Dim mousex As Integer
Dim mousey As Integer
假设你想拖动的是Panel1控件,以及此控件上的 Label1(用于显示标题)和PictureBox4(用于显示图标):
Private Sub TitleMove_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown, Label1.MouseDown, PictureBox4.MouseDown
drag = True
mousex = Windows.Forms.Cursor.Position.X - Me.Left
mousey = Windows.Forms.Cursor.Position.Y - Me.Top
End Sub
Private Sub TitleMove_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove, Label1.MouseMove, PictureBox4.MouseMove
If drag Then
Me.Top = Windows.Forms.Cursor.Position.Y - mousey
Me.Left = Windows.Forms.Cursor.Position.X - mousex
End If
End Sub
Private Sub TitleMove_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp, Label1.MouseUp, PictureBox4.MouseUp
drag = False
End Sub
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流