Imports System.Drawing

Public Class C_label
    Public Font As New Font("HY견고딕", 30)      '//초기폰트
    Public visible As Boolean = True                     '//표시여부
    Public Tag As Object = Nothing                     '//태그
    Public Left, Right, Top, Bottom As Single            '//위치정보   
    Public Height, Width As Single                      '//크기정보
    Public Name As String = "arin"                   '//컨트롤의 이름
    Public Gidx As Short = -1                                 '//그룹의 인덱스
    Public Idx As Short = -1                                '//컨트롤인덱스
    Public Desc As String                               '//설명  v_설명과 중복이나 나중에 v_설명을 없앨생각이다.
    Public Text As String = "" '//초기 문자값
    Public Fixed As Boolean = False
    ' Public UseHPattern As Boolean = False
    Public ForeColor As Color = Color.Black
    Public ForeColor2 As Color = Color.Black
    Public WordWidth As Single = 100
    Public WordHeight As Single = 100
    Public Rotate As Single = 0
    Public WordSpace As Int16 = 0 '//공백
    Public Repeat As Short '//반복횟수
    Public RepeatX As Single  '//반복x
    Public RepeatY As Single  '//반복y
    Public HasPattern As Boolean = False
    Public Property Size() As System.Drawing.SizeF
        Get
            Return New System.Drawing.Size(Me.Width, Me.Height)
        End Get
        Set(ByVal value As System.Drawing.SizeF)
            Me.Width = value.Width
            Me.Height = value.Height
        End Set
    End Property

    Public Property Location() As PointF
        Get
            Return New Point(Me.Left, Me.Top)
        End Get
        Set(ByVal value As PointF)
            Me.Left = value.X
            Me.Top = value.Y
        End Set
    End Property

    ''' <summary>
    ''' 공백기능을 적용한후의 문자열을 반환
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function text2() As String
        If WordSpace = 0 Then Return Text
        Dim z As New System.Text.StringBuilder
        For Each A As Char In Text.ToCharArray
            z.Append(A.ToString & Space(WordSpace))
        Next
        Return (z.ToString.Trim())
    End Function

    ''' <summary>
    ''' 글씨가 차지하는 크기를 재계산합니다.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetSize(g As Graphics) As SizeF
        ' Return System.Windows.Forms.TextRenderer.MeasureText(text2, Font)
        Return g.MeasureString(text2, Font)

    End Function

    Public Function GetSize() As SizeF
        Return System.Windows.Forms.TextRenderer.MeasureText(text2, Font)
        'Return g.MeasureString(text2, Font)

    End Function

    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

    Public Sub New()

    End Sub

    
End Class
