我创建了一个小用户控件,它只是一个标签和一个图片框。 (它被设计为菜单项控件,其中许多被添加到流程布局面板中作为“家庭手册”
用户控件的代码如下:
Imports System.ComponentModel
Public Class HomeButton
Public Event HomeButton_Click()
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Description("HomeButtonProperties"),
Browsable(True)>
Public Property Image() As Image
Get
Return Me.Icon_PictureBox.Image
End Get
Set(ByVal image As Image)
Me.Icon_PictureBox.Image = image
End Set
End Property
Public Property Text_Menu As String
Get
Return MenuText_Label.Text
End Get
Set(value As String)
MenuText_Label.Text = value
End Set
End Property
Private Sub Icon_PictureBox_Click(sender As Object, e As EventArgs) Handles Icon_PictureBox.Click, MenuText_Label.Click, Me.Click
RaiseEvent HomeButton_Click()
End Sub
End Class
我遇到的问题是随机时间(通常是构建)控件松开控件Icon_picturebox.image中的图像。这一切都需要重置。
文字标签很好。图像来自项目资源。
我做错了什么?感谢。