본문 바로가기
카테고리 없음

[vb.net] Round Button

by IT HUB 2023. 6. 7.
728x90
반응형

    Private Sub RoundButton(btn As Button)
 
        btn.FlatStyle = FlatStyle.Flat
        btn.FlatAppearance.BorderSize = 0
        btn.BackColor = Color.Red
        btn.ForeColor = Color.White
        btn.Cursor = Cursors.Hand
        btn.Font = New Font("Century Gothic"14)
 
        Dim Raduis As New Drawing2D.GraphicsPath
 
        Raduis.StartFigure()
        'appends an elliptical arc to the current figure
        'left corner top
        Raduis.AddArc(New Rectangle(002020), 18090)
        'appends a line segment to the current figure
        Raduis.AddLine(100, btn.Width - 200)
        'appends an elliptical arc to the current figure
        'right corner top
        Raduis.AddArc(New Rectangle(btn.Width - 2002020), -9090)
        'appends a line segment to the current figure
        Raduis.AddLine(btnRound.Width, 20, btn.Width, btn.Height - 10)
        'appends an elliptical arc to the current figure 
        'right corner buttom
        Raduis.AddArc(New Rectangle(btn.Width - 25, btn.Height - 252525), 090)
        'appends a line segment to the current figure
        'left corner bottom
        Raduis.AddLine(btn.Width - 10, btn.Width, 20, btn.Height)
        'appends an elliptical arc to the current figure
        Raduis.AddArc(New Rectangle(0, btn.Height - 202020), 9090)
        'Close the current figure and start a new one.
        Raduis.CloseFigure()
        'set the window associated with the control
        btnRound.Region = New Region(Raduis)
    End Sub
반응형

댓글