| bsp; Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs) ''''让基控件更新文本框 MyBase.OnFontChanged(e) ''''重绘控件 RedrawControls() End Sub ''''重绘控件 Private Sub RedrawControls() ''''控件宽度 Dim width As Integer = Me.ClientRectangle.Width ''''获得工作区宽 ''''以按钮的高度来确定控件高度 Dim btnSide As Integer = Button1.Height Dim btnwidth As Integer = Button1.Width If Me.ClientRectangle.Height <> btnSide Then ''''设置控件工作区的大小 ''''Me.SetClientSizeCore(btnwidth, btnSide) Me.SetClientSizeCore(width, btnSide) ''''这里使用工作区的宽是因为:按钮和picturebox可以调整宽度 ''''上面的语句激发了嵌套的Resize事件,因此需要立即退出,如果不退出,就会反复调用进入死循环 Exit Sub End If ''''调整子控件的大小 ''''Txt.SetBounds(0, 0, width, btnSide) ''''Btn.SetBounds(width - 19, 2, 17, btnSide - 4) Me.PictureBox1.SetBounds(0, 0, width, btnSide) Me.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage Me.Button1.SetBounds(0, 0, width, btnSide) End Sub End Class
上一页 [1] [2] [3] |