Public Class MyLabel Public TextValue As String = "[tindevil@Nate.com]" Public TextFont As New Font("HY°ß°íµñ", 30) Dim vÀåÆò As Int16 = 100 Dim vÀå³ôÀÌ As Int16 = 100 Dim v¼³¸í As String = vbNullString Dim vÀü°æ»ö As Color = Color.Black Dim vȸÀü As Int16 = 0 Private v_°ø¹é As Int16 = 0 '//°ø¹é Private V_CB As CheckBox Public Repeat As Short = 0 '//¹Ýº¹Ãâ·ÂȽ¼ö Public RepeatX As Single '//¹Ýº¹Ãâ·Â½Ã xº¯À§ Public RepeatY As Single '//¹Ýº¹Ãâ·Â½Ã yº¯À§ Public Pattern As String Public DIV As String Public Sub New() ' ÀÌ È£ÃâÀº Windows Form µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù. InitializeComponent() 'Me.BackColor = Color.Transparent ' InitializeComponent() È£Ãâ µÚ¿¡ ÃʱâÈ­ Äڵ带 Ãß°¡ÇϽʽÿÀ. End Sub _ Public Property CheckBox() As CheckBox Get Return V_CB End Get Set(ByVal value As CheckBox) V_CB = value Me.Invalidate() End Set End Property _ Public Property °ø¹é() As Int16 Get Return v_°ø¹é End Get Set(ByVal value As Int16) v_°ø¹é = value Me.Invalidate() End Set End Property Public Function ÃÖÁ¾¹®ÀÚ() As String If v_°ø¹é = 0 Then Return TextValue.Trim Dim z As New System.Text.StringBuilder For Each A As Char In TextValue.ToCharArray z.Append(A.ToString & Space(v_°ø¹é)) Next Return (z.ToString.Trim()) End Function ''' ''' ÄÁÆ®·ÑÀÇ ÀåÆòÀ» ¼³Á¤ÇÕ´Ï´Ù ±âº»°ª=100 ''' ''' ''' ''' _ Public Property ÀåÆò() As Int16 Get Return vÀåÆò End Get Set(ByVal value As Int16) vÀåÆò = value Me.Invalidate() End Set End Property _ Public Property ȸÀü() As Int16 Get Return vȸÀü End Get Set(ByVal value As Int16) vȸÀü = value Me.Invalidate() End Set End Property _ Public Property Àå³ôÀÌ() As Int16 Get Return vÀå³ôÀÌ End Get Set(ByVal value As Int16) vÀå³ôÀÌ = value Me.Invalidate() End Set End Property Public Function GetSize(Optional ByVal NewFont As Font = Nothing) As SizeF If NewFont Is Nothing Then NewFont = TextFont Return TextRenderer.MeasureText(ÃÖÁ¾¹®ÀÚ, NewFont) End Function ''' ''' ÄÁÆ®·ÑÀÇ ¼³¸íÀ» Áý¾î³Ö½À´Ï´Ù. ''' ''' ''' ''' _ Property ¼³¸í() As String Get If v¼³¸í = vbNullString Then Return Me.Name.ToString Return v¼³¸í End Get Set(ByVal value As String) v¼³¸í = value End Set End Property Public Property MyForeColor() As Color Get Return vÀü°æ»ö End Get Set(ByVal value As Color) vÀü°æ»ö = value Me.Invalidate() End Set End Property _ Public Property MyText() As String Get Return TextValue End Get Set(ByVal value As String) TextValue = value Me.Invalidate() End Set End Property _ Public Property MyFont() As Font Get Return TextFont End Get Set(ByVal value As Font) TextFont = value Me.Invalidate() End Set End Property Public Function GetImage() As Bitmap Dim Br As New SolidBrush(vÀü°æ»ö) Me.Height = GetSize.Height * (vÀå³ôÀÌ / 100) Me.Width = GetSize.Width * (vÀåÆò / 100) Dim Bmp As New Bitmap(Me.Width, Me.Height, Me.CreateGraphics) Dim G As Graphics = Graphics.FromImage(Bmp) G.ScaleTransform((vÀåÆò / 100), (vÀå³ôÀÌ / 100)) G.DrawString(TextValue, TextFont, Br, 0, 0) G.Dispose() Return Bmp End Function Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs) Dim Br As New SolidBrush(vÀü°æ»ö) Dim LastText As String = "" Dim Idx As Integer = 0 Dim Z As New System.Drawing.StringFormat() Z.FormatFlags = StringFormatFlags.MeasureTrailingSpaces If vÀåÆò = 100 AndAlso vÀå³ôÀÌ = 100 Then '//ÀåÆò¹ÌÀû¿ë ¹®ÀڷΠó¸® Me.Width = GetSize.Width Me.Height = GetSize.Height LastText = ÃÖÁ¾¹®ÀÚ() ' Dim A As New Font("±¼¸²", 20, FontStyle.Regular, GraphicsUnit.Display, &H1, True) pe.Graphics.DrawString(LastText, TextFont, Br, 0, 0, Z) 'pe.Graphics.DrawString(LastText, A, Br, 0, 0) Else Me.Height = GetSize.Height * (vÀå³ôÀÌ / 100) Me.Width = GetSize.Width * (vÀåÆò / 100) Dim Bmp As New Bitmap(Me.Width, Me.Height, pe.Graphics) Dim G As Graphics = Graphics.FromImage(Bmp) If vȸÀü <> 0 Then 'G.ResetTransform() 'G.TranslateTransform(-Me.Width, -Me.Height, Drawing2D.MatrixOrder.Append) 'G.RotateTransform(vȸÀü, Drawing2D.MatrixOrder.Append) 'G.TranslateTransform(Me.Width, Me.Height, Drawing2D.MatrixOrder.Append) G.TranslateTransform(-Me.Width, -Me.Height, Drawing2D.MatrixOrder.Append) G.RotateTransform(vȸÀü, Drawing2D.MatrixOrder.Append) G.TranslateTransform(Me.Width, Me.Height, Drawing2D.MatrixOrder.Append) End If 'G.TranslateTransform(Me.Width / 2, Me.Height / 2, Drawing2D.MatrixOrder.Append) G.ScaleTransform((vÀåÆò / 100), (vÀå³ôÀÌ / 100)) G.DrawString(TextValue, TextFont, Br, 0, 0) G.Dispose() pe.Graphics.DrawImage(Bmp, 0, 0) ', CInt(GetSize.Width * (vÀåÆò / 100)), GetSize.Height) End If End Sub Private Sub RotateAt(ByVal gr As Graphics, ByVal cx As Integer, ByVal cy As Integer, ByVal angle As Single) gr.ResetTransform() gr.TranslateTransform(-cx, -cy, Drawing2D.MatrixOrder.Append) gr.RotateTransform(angle, Drawing2D.MatrixOrder.Append) gr.TranslateTransform(cx, cy, Drawing2D.MatrixOrder.Append) End Sub End Class