| Public Sub New() MyBase.New() ''''该调用是 Windows 窗体设计器所必需的。 InitializeComponent() ''''在 InitializeComponent() 调用之后添加任何初始化 Me.Button1.Width = 100 ‘设置按钮的初始大小 Me.Button1.Height = 23 Me.Button1.BackColor = Color.Transparent ‘背景色透明 Me.Button1.ForeColor = Color.Black Me.PictureBox1.Controls.Add(Me.Button1) End Sub Private m_text As String ‘设置按钮标题 Private a As Integer ''''Private m_image As Image <Description("picturebox图片。")> _ Public Property image() As image Get Return Me.PictureBox1.Image End Get Set(ByVal Value As image) Me.PictureBox1.Image = Value Invalidate() End Set End Property Shadows Property forecolor() As Color Get Return Me.Button1.ForeColor End Get Set(ByVal Value As Color) Me.Button1.ForeColor = Value Invalidate() End Set End Property Shadows Sub ResetForeColor() Me.Button1.ForeColor = SystemColors.ControlText End Sub ''''//// ''''按钮的单击事件 Event BtnClick(ByVal sender As Object, ByVal e As System.EventArgs) Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click RaiseEvent BtnClick(Me, e) End Sub ''''//// ''''控件改变大小时,需重绘控件,以使子控件排位美观 Private Sub FileTextBox_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize RedrawControls() End Sub ''''子控件会自动继续容器的Font属性,所以改变容器的Font属性时也要重绘控件 &n 上一页 [1] [2] [3] 下一页 |