Wild Bill
Member
Hi.
I made User Control
In the constructor i wrote Me.AutoSize = False
But when i drop that ZoomingLabel on form AutoSize=True!
I made User Control
VB.NET:
Imports System.Drawing
Public Class ZoomingLabel
Private _zoom As Integer
Private _minFontHeight As Integer
Public Sub New()
InitializeComponent()
Me.AutoSize = False
Me.Zoom = 6
_minFontHeight = 8
SetFont()
End Sub
Public Property Zoom() As Integer
Get
Return _zoom
End Get
Set(ByVal value As Integer)
If value > 0 And value < 11 Then
_zoom = value
SetFont()
End If
End Set
End Property
Private Sub SetFont()
Dim FontHeight As Integer
FontHeight = CInt(Me.Height * _zoom / 10)
If FontHeight < _minFontHeight Then
FontHeight = _minFontHeight
End If
Dim fnt As Font = New Font(Me.Font.Name, FontHeight, Me.Font.Style)
Me.Font = fnt
End Sub
Private Sub ZoomingLabel_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
SetFont()
End Sub
End Class
In the constructor i wrote Me.AutoSize = False
But when i drop that ZoomingLabel on form AutoSize=True!