纯代码作图漂亮特效动画按钮

纯代码绘制漂亮特效动画按钮
纯代码作图漂亮特效动画按钮

Imports System.ComponentModel
<DefaultEvent("Click")> _
Public Class DSButton
    Private _ButtonColor As Color = Color.White
    Private SF As New System.Drawing.StringFormat
    Private _Text As String
    <DefaultValue(True)>
    Public Property ButtonColor As Color
        Get
            Return _ButtonColor
        End Get
        Set(ByVal value As Color)
            _ButtonColor = value
            MakeRoundedRect(RoundRectValue, Me, Color.FromArgb(255, ButtonColor.R / 255 * 50, ButtonColor.G / 255 * 50, ButtonColor.B / 255 * 50))
        End Set
    End Property
    Public Property RoundRectValue As Integer = 10
    Private nIndex As Integer = 0
    Private IsMouseEnter As Boolean = False
    Public Property IsShowAnimate As Boolean = False
    Public Property ButtonText As String
        Get
            Return _Text
        End Get
        Set(ByVal value As String)
            _Text = value
            MakeRoundedRect(RoundRectValue, Me, Color.FromArgb(255, ButtonColor.R / 255 * 50, ButtonColor.G / 255 * 50, ButtonColor.B / 255 * 50))
        End Set
    End Property
    Private _TextColor As Color = Color.White
    Public Property TextColor As Color
        Get
            Return _TextColor
        End Get
        Set(ByVal value As Color)
            _TextColor = value
            MakeRoundedRect(RoundRectValue, Me, Color.FromArgb(255, ButtonColor.R / 255 * 50, ButtonColor.G / 255 * 50, ButtonColor.B / 255 * 50))
        End Set
    End Property

    Private Sub DSButton_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SetStyle(ControlStyles.UserPaint, True)