重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
它们的窗体实际上就是你截图出来的大小,周围的阴影效果都是自己画出来的。
创新互联-专业网站定制、快速模板网站建设、高性价比成县网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式成县网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖成县地区。费用合理售后完善,10多年实体公司更值得信赖。
窗体?美化?你是winform还是webform?还是mvc模板?还是其他的?这个东西网上都有对应的插件的哈,想要好看的话就用别人的插件吧,比起自己琢磨来的更直接,强行花时间在美化窗体上也没有多大的意义。
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