VB窗体美化
我是想把我的VB程序窗体的边角变成圆角的,显得柔滑,我把BorderStyle改成了0,而边角却很锐利,谁能帮帮我?最好有代码。类似PS启动时这种效果,可以不规则地透明窗...
我是想把我的VB程序窗体的边角变成圆角的,显得柔滑,我把BorderStyle改成了0,而边角却很锐利,谁能帮帮我?最好有代码。
类似PS启动时这种效果,可以不规则地透明窗体 展开
类似PS启动时这种效果,可以不规则地透明窗体 展开
1个回答
展开全部
Dim 鼠标当前位置 As Point
Private Sub 椭圆窗体绘制(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
Dim 椭圆形状 As New GraphicsPath
椭圆形状.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New Region(椭圆形状)
End Sub
Private Sub 鼠标按下(sender As Object, e As MouseEventArgs) Handles MyBase.MouseDown
鼠标当前位置 = New Point(-e.X, -e.Y)
End Sub
Private Sub 鼠标移动(sender As Object, e As MouseEventArgs) Handles MyBase.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim 鼠标位置 As Point = Control.MousePosition
鼠标位置.Offset(鼠标当前位置.X, 鼠标当前位置.Y)
Me.Location = 鼠标位置
End If
End Sub
Private Sub 绘制关闭按钮(sender As Object, e As PaintEventArgs) Handles 关闭按钮.Paint
Dim 按钮形状 As New GraphicsPath
Dim 按钮矩形 As Rectangle = 关闭按钮.ClientRectangle
'按钮矩形.Inflate(-1, -1)
e.Graphics.DrawEllipse(Pens.Red, 按钮矩形)
按钮矩形.Inflate(15, 15)
按钮形状.AddEllipse(按钮矩形)
关闭按钮.Region = New Region(按钮形状)
End Sub
Private Sub 关闭按钮_Click(sender As Object, e As EventArgs) Handles 关闭按钮.Click
Me.Close()
End Sub
这是我写过的把窗体改成椭圆形状的,你把那个“椭圆形状”的“.AddEllipse”命令改成矩形,中间加上一个关闭按钮就是,或者改成其他图形。.NET 的
Private Sub 椭圆窗体绘制(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
Dim 椭圆形状 As New GraphicsPath
椭圆形状.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New Region(椭圆形状)
End Sub
Private Sub 鼠标按下(sender As Object, e As MouseEventArgs) Handles MyBase.MouseDown
鼠标当前位置 = New Point(-e.X, -e.Y)
End Sub
Private Sub 鼠标移动(sender As Object, e As MouseEventArgs) Handles MyBase.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim 鼠标位置 As Point = Control.MousePosition
鼠标位置.Offset(鼠标当前位置.X, 鼠标当前位置.Y)
Me.Location = 鼠标位置
End If
End Sub
Private Sub 绘制关闭按钮(sender As Object, e As PaintEventArgs) Handles 关闭按钮.Paint
Dim 按钮形状 As New GraphicsPath
Dim 按钮矩形 As Rectangle = 关闭按钮.ClientRectangle
'按钮矩形.Inflate(-1, -1)
e.Graphics.DrawEllipse(Pens.Red, 按钮矩形)
按钮矩形.Inflate(15, 15)
按钮形状.AddEllipse(按钮矩形)
关闭按钮.Region = New Region(按钮形状)
End Sub
Private Sub 关闭按钮_Click(sender As Object, e As EventArgs) Handles 关闭按钮.Click
Me.Close()
End Sub
这是我写过的把窗体改成椭圆形状的,你把那个“椭圆形状”的“.AddEllipse”命令改成矩形,中间加上一个关闭按钮就是,或者改成其他图形。.NET 的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询