用户控件的事件不会被触发

用户控件的事件不会被触发

本文介绍了用户控件的事件不会被触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







Public Class ButtonTemplet
    Inherits UserControl

    Private mButtonText As String
    Public Property ButtonText As String
        Set(value As String)
            lblTitle.Text = value
        End Set
        Get
            Return lblTitle.Text
        End Get
    End Property

    Private Sub ButtonTemplet_MouseEnter(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseEnter
        Me.BackgroundImage = Global.WindowsApplicationDemo.My.Resources.Resources.Clients_grey_button_Templet
        Me.lblTitle.ForeColor = Color.White
    End Sub

    Private Sub ButtonTemplet_MouseLeave(sender As System.Object, e As System.EventArgs) Handles MyBase.MouseLeave
        Me.BackgroundImage = Global.WindowsApplicationDemo.My.Resources.Resources.Orders_white_button_Templet
        Me.lblTitle.ForeColor = Color.Gray
    End Sub

    Protected Overrides Sub OnMouseEnter(e As System.EventArgs)
        MyBase.OnMouseEnter(e)
        Me.BackgroundImage = Global.WindowsApplicationDemo.My.Resources.Resources.Clients_grey_button_Templet
        Me.lblTitle.ForeColor = Color.White
    End Sub

    Protected Overrides Sub OnMouseLeave(e As System.EventArgs)
        MyBase.OnMouseLeave(e)
        Me.BackgroundImage = Global.WindowsApplicationDemo.My.Resources.Resources.Orders_white_button_Templet
        Me.lblTitle.ForeColor = Color.Gray
    End Sub
End Class

推荐答案


这篇关于用户控件的事件不会被触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 17:31