16,722
社区成员




Imports System.Runtime.InteropServices
Public Class btn
<DllImport("Gdi32.dll", EntryPoint:="CreateRoundRectRgn")>
Private Shared Function CreateRoundRectRgn(ByVal iLeft As Integer, ByVal iTop As Integer, ByVal iRight As Integer, ByVal iBottom As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer) As IntPtr
End Function
Dim btnstart As New Button()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
With btnstart
.Text = "Start"
'.TextAlign = ContentAlignment.MiddleCenter
.Height = 100
.Width = 100
.Location = New Point(720, -40)
.Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(50, 50, btnstart.Width - 2, btnstart.Height - 2, 50, 50))
.BackColor = Color.Red
.Visible = True
.ForeColor = Color.Black
End With
Me.Controls.Add(btnstart)
AddHandler btnstart.Click, AddressOf startupdate '绑定事件
End Sub
End Class
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a As New GraphicsPath()
a.AddEllipse(25, 6, 25, 25)
Button1.Region = New Region(a)
Button1.Text = "Btn"
Button1.Height = 38
End Sub
但真的不好看没有边框,