如何在vb.net中创建圆角窗体如下所示:
Private Sub Type(ByVal sender As Control, ByVal p_1 As Integer, ByVal p_2 As Double)
Dim oPath As New Drawing2D.GraphicsPath()
oPath.AddClosedCurve(New Point() {New Point(0, sender.Height / p_1), New Point(sender.Width / p_1, 0), New Point(sender.Width - sender.Width / p_1, 0), New Point(sender.Width, sender.Height / p_1), New Point(sender.Width, sender.Height - sender.Height / p_1), New Point(sender.Width - sender.Width / p_1, sender.Height), _
New Point(sender.Width / p_1, sender.Height), New Point(0, sender.Height - sender.Height / p_1)}, CSng(p_2))
sender.Region = New Region(oPath)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Type(Me, 20, 0.1)
End Sub
VB 怎样实现圆角窗体?【vb.net圆角窗体 vb圆形控件】VB.net
示例:
1.
窗体设置
边框模式
2.代码
Declare
Function
CreateRoundRectRgn
Lib
"gdi32"
Alias
"CreateRoundRectRgn"
(ByVal
X1
As
Int32,
ByVal
Y1
As
Int32,
ByVal
X2
As
Int32,
ByVal
Y2
As
Int32,
ByVal
X3
As
Int32,
ByVal
Y3
As
Int32)
As
Int32
Declare
Function
SetWindowRgn
Lib
"user32"
Alias
"SetWindowRgn"
(ByVal
hWnd
As
Int32,
ByVal
hRgn
As
Int32,
ByVal
bRedraw
As
Boolean)
As
Int32
‘GDI重绘API
Private
Sub
Form1_Load(ByVal
sender
As
Object,
ByVal
e
As
System.EventArgs)
Handles
MyBase.Load
Dim
r
As
Integer
=
CreateRoundRectRgn(0,
0,
Me.Width,
Me.Height,
20,
20)
'CreateRoundRectRgn参数([窗体左],[窗体顶],[窗体宽],[窗体高],[向左偏移
],[向
偏移
])
SetWindowRgn(Me.Handle,
r,
True)
End
Sub
VB.Net怎么做圆形窗体设置Region属性:
Dim path As New System.Drawing.Drawing2D.GraphicsPath
path.AddEllipse(0, 0, 400, 300)
Region = New Region(path)
关于vb.net圆角窗体和vb圆形控件的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。
推荐阅读
- 微信公众号证明怎么操作,微信公众号广告费一般多少钱
- 冒险解谜act电脑游戏,冒险解密游戏电脑
- 视频号可以回看吗怎么设置,视频号可以回看吗怎么设置不了
- linux七大命令 20个linux常见命令
- 摩托车赛车图片游戏,摩托车赛车图片大全大图
- 早期游戏网络延迟,游戏网络延迟和什么有关系吗
- 如何查询oracle版本 查询 oracle 版本
- 抖音如何推广爆弹,抖音如何推广爆弹产品
- 国风冒险解谜游戏,中国风解谜手游