Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Math
Imports System.IO

Public Class Printform_deung

    Dim DrStyle As PatternDS.TStyleRow = Nothing
    Dim DtPattern As PatternDS.TPatternDataTable = Nothing

    Dim AllLabels() As Str_Alllabels    '//전체갯수는 추가할대 셋팅한다.

    Dim S번호(0) As MyLabel

    Dim S고객번호(0) As MyControlOLEDBv2.MyLabel
    Dim S관리번호1(0) As MyControlOLEDBv2.MyLabel
    Dim S관리번호2(0) As MyControlOLEDBv2.MyLabel
    Dim S관리번호3(0) As MyControlOLEDBv2.MyLabel
    Dim S지점명(0) As MyControlOLEDBv2.MyLabel

    Dim S전산화번호(0) As MyControlOLEDBv2.MyLabel
    Dim S선로명(0) As MyControlOLEDBv2.MyLabel
    Dim S전주번호(0) As MyControlOLEDBv2.MyLabel


    Dim 고객번호 As String = vbNullString
    Dim 관리번호1 As String = vbNullString
    Dim 관리번호2 As String = vbNullString
    Dim 관리번호3 As String = vbNullString
    Dim 지점명 As String = vbNullString
    Dim 전산화번호 As String = ""
    Dim 선로명 As String = ""
    Dim 전주번호 As String = ""

    Dim NoView As Boolean = False   '//LOAD_STYLE 을 잠시 실행하지 않기위햇(중복실행방지)서 둔다.(..이벤트가.. -_-;;너무 중복으로 발생함)
  
    Dim SrcIdx As Integer = -1  '//원본 리뷰에서 클릭된 인덱스
    Dim Srcnum As Integer = -1  '//원본 리뷴에서 클릭된 번호값
    Dim Srcrow As DataRowView
    Dim FirstIdx As Integer = -1 '//새로 생성된 리뷰에서 적용될 인덱스

    'Public File As String = My.Application.Info.DirectoryPath & "\style.ini"   '//스타일 파일
    Dim StyleDir As New System.IO.DirectoryInfo(My.Application.Info.DirectoryPath & "\stylejd")
    Public FileC As String = My.Application.Info.DirectoryPath & "\styleCjd.ini" '//사용자 스타일 파일

    Private WithEvents pDoc As New PrintDocument()
    Dim SelCon As New ArrayList '//선택된 레이블들이 저장된 배열이다.
    Dim onlyOne As MyControlOLEDBv2.MyLabel  '//포커스를 가진 레이블이다.

    Dim srcTable As ireaDataSet.Detail_DeungDataTable    '//데이터가 저장될 테이블
    Dim Dv As DataView   '//데이터뷰(실제로 이 뷰의 데이터를 가지고 출력을 행한다.)

    Dim printindex As Integer = 0   '//프린트되는 페이지 번호 이값이 -1 이면 현재페이지이므로 갱신하지 않고 출력한다.
    Dim PrintArray() As Integer '//프린트할 페이지의 배열번호

    Dim SettingFile As String = My.Application.Info.DirectoryPath & "\epole.ini"    '//환경설정 파일
    Dim PrintMode As Boolean = False

    Public Sub New()
        InitializeComponent()
        WLog2(Auto_Log, "New()", "\정액등순차로그.txt")
    End Sub

    Public Sub New(ByRef Src As ireaDataSet.Detail_DeungDataTable, Optional ByVal IRow As DataRowView = Nothing)
        InitializeComponent()
        WLog2(Auto_Log, "New(srctable,srcRow)", "\정액등순차로그.txt")
        srcTable = Src  '//가져온 테이블을 임시테이블에 저장을 해두고 사용한다.
        Srcrow = IRow  '//이것은 클릭된 행번호이다. 이 행번호를 가지고 스타일을 판별한다
    End Sub

    Private Sub printform_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        'If Not BackWork Is Nothing Then BackWork = Nothing
        'Me.CustFP1.ColSize_Save()
        Me.dataview.Setting_Save(False, "printjjung", "\viewConfig\deung_")
        WLog2(Auto_Log, "Form_Close", "\정액등순차로그.txt")
        Save_Setting()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.dataview.Setting_Load(False, "printjjung", "\viewConfig\deung_")
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True) '//더블버퍼링
        WLog2(Auto_Log, "Form_Load()", "\정액등순차로그.txt")
        GetPrintersName()   '//프린터명을 가져옵니다.
        Load_Setting()
        SetControls()   '//컨트롤을 초기화하고 셋팅한다.

        If srcTable Is Nothing Then
            'MsgBox("소스가없어서 기본셋팅으로 전환함")
            WLog2(Auto_Log, "개발자 기본셋팅으로 전환()", "\정액등순차로그.txt")
            Common.Auto_Log = True
            Me.NoView = True
            'Me.detTableAdapter1.Connection.ConnectionString = ConString
            'Me.detTableAdapter1.Fill(Me.IreaDataSet1.jjungtable, 1)
            'Me.srcTable = Me.IreaDataSet1.jjungtable
            Admin = True
        End If

        WLog2(Auto_Log, "개발자모드=" & Admin.ToString, "\정액등순차로그.txt")
        If Admin Then
            For Each A As Control In Me.TabPage3.Controls
                If A.GetType.Name.ToUpper = "CHECKBOX" Then
                    A.Visible = True
                End If
            Next
        End If

        Me.SETTOOLTIP()
        GetStyleList()  '//style.ini 에서 스타일목록명만 가져온다.


        If Srcrow Is Nothing Then '//가져온 행값이인덱스가 없으므로 1번째 스타일을 지정한다.
            WLog2(Auto_Log, "가져온 행값이 없습니다. firstidx=0 / 일반용으로 셋팅합니다()", "\정액등순차로그.txt")
            FirstIdx = 0 '//또한 맨 처음 데이터를 표시하게된다.
            Me.cmb_style.Text = "정액등"  '//여기서 데이터가 걸러지게된다.
        Else
            Srcnum = Srcrow("번호") 'srcTable.Rows(SrcIdx).Item("번호")
            Me.cmb_style.Text = "정액등"  '//여기서 데이터가 걸러지게된다.
        End If

    End Sub

    Private Sub printform_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        'If SelCon Is Nothing Then Return
        'Dim Tobj As MyControlOLEDBv2.MyLabel
        Select Case e.KeyCode
            Case Keys.Up
                If e.Shift Then '//글씨높이
                    Me.CtrSize(True, -1)
                Else
                    Me.CtrPos(True, -1)
                End If
                'Me.ViewProperty(SelCon(0))
                e.Handled = True
            Case Keys.Down
                If e.Shift Then
                    Me.CtrSize(True, 1)
                Else
                    Me.CtrPos(True, 1)
                End If
                'ViewProperty(Tobj)
                e.Handled = True
            Case Keys.Left
                If e.Shift Then
                    Me.CtrSize(False, -1)
                Else
                    Me.CtrPos(False, -1)
                End If
                'ViewProperty(Tobj)
                e.Handled = True
            Case Keys.Right
                If e.Shift Then
                    Me.CtrSize(False, 1)
                Else
                    Me.CtrPos(False, 1)
                End If
                'ViewProperty(Tobj)
                e.Handled = True
            Case Keys.S

            Case Keys.F7
                Me.bt_print.PerformButtonClick()
            Case Keys.F8
                Me.bt_prnpreview.PerformClick()
        End Select

    End Sub

    Public Sub AddControl(ByRef CtlCnt As Short, ByVal 설명 As String, ByVal tag As String, ByVal Labels() As MyControlOLEDBv2.MyLabel, ByRef Cb As CheckBox, Optional ByVal bPattern As String = "")
        Cb.Tag = tag
        Cb.Text = 설명
        For i As Integer = 0 To Labels.GetUpperBound(0)  '//모든문자를 할당한다.
            Labels(i) = New MyControlOLEDBv2.MyLabel
            Labels(i).설명 = 설명 & i + 1
            Labels(i).DIV = tag
            Labels(i).Name = tag & i + 1
            Labels(i).TextValue = ""
            Labels(i).Repeat = 0
            Labels(i).RepeatX = 0
            Labels(i).RepeatY = 0
            Labels(i).Pattern = bPattern
            ReDim Preserve AllLabels(CtlCnt)
            AllLabels(CtlCnt).ctl = Labels(i)
            Me.cmb_controls.Items.Add(Labels(i).설명)
            CtlCnt += 1
        Next
        Labels(0).CheckBox = Cb
        Labels(0).Pattern = bPattern
    End Sub

    Private Sub SetControls()
        WLog2(Auto_Log, "SetControls()", "\정액등순차로그.txt")
        Dim CtlCnt As Short = 0

        AddControl(CtlCnt, "번호", "X", Me.S번호, Me.cb_seq)

        AddControl(CtlCnt, "고객번호", "U", Me.S고객번호, Me.cb_usernum, "UNOPATTERN")
        AddControl(CtlCnt, "관리번호1", "A", Me.S관리번호1, Me.cb_mnum1, "MAN1PATTERN")
        AddControl(CtlCnt, "관리번호2", "B", Me.S관리번호2, Me.cb_mnum2, "MAN2ATTERN")
        AddControl(CtlCnt, "관리번호3", "C", Me.S관리번호3, Me.cb_mnum3, "MAN3PATTERN")
        AddControl(CtlCnt, "지점명", "J", Me.S지점명, Me.cb_jijum, "JIJUMPATTERN")
        AddControl(CtlCnt, "전산화번호", "K", Me.S전산화번호, Me.chk_k, "JUNSANPATTERN")
        AddControl(CtlCnt, "선로명", "L", Me.S선로명, Me.chk_l, "SUNLOPATTERN")
        AddControl(CtlCnt, "전주번호", "M", Me.S전주번호, Me.chk_m, "JUNJUPATTERN")
    End Sub


    Private Sub SETTOOLTIP()
        WLog2(Auto_Log, "Settooltip()", "\정액등순차로그.txt")
        Dim TMSG As New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("선택가능한 개체목록을 볼 수 잇습니다")
        TMSG.AppendLine()
        TMSG.AppendLine("화면에 보이지 않는 개체도 선택이 가능합니다")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.cmb_controls, TMSG.ToString)

        TMSG = New System.Text.StringBuilder("")
        TMSG.AppendLine()
        TMSG.AppendLine("선택된 개체들의 화면표시여부를 결정정합니다")
        Me.ToolTip1.SetToolTip(Me.cb_visible, TMSG.ToString)


        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("▼ 연속된 페이지는 -(마이너스) 로 구분합니다")
        TMSG.AppendLine("   예) 2페이지에서 8페이지까지 :  2-8")
        TMSG.AppendLine()
        TMSG.AppendLine("▼ 불규칙 페이지는 ,(콤마) 로 구분합니다")
        TMSG.AppendLine("   예) 1,3,4,10 페이지 : 1,3,4,7")
        TMSG.AppendLine()
        TMSG.AppendLine("▼ 각조건의 구분은 /(슬래쉬) 로 구분합니다")
        TMSG.AppendLine("   예) 2~8페이지와 11,15번 페이지 : 2-8/11,15")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.RadioButton3, TMSG.ToString)

        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("<개체들의 상태를 확인할 수 있습니다>")
        TMSG.AppendLine()
        TMSG.AppendLine("더블클릭시 임시적으로 해당 문자를 수정할 수 있습니다.")
        TMSG.AppendLine("왼쪽클릭시 해당개체만 선택됩니다.")
        TMSG.AppendLine("Ctrl + 왼쪽클릭시 해당개체가 속한 그룹이 선택됩니다.")
        TMSG.AppendLine("우클릭시 선택된 개체가 추가됩니다(다중선택기능)")
        TMSG.AppendLine()
        TMSG.AppendLine("[번호출력시 색상구분]")
        TMSG.AppendLine("흑색 :  문자패턴 적용")
        TMSG.AppendLine("녹색 :  길이패턴 적용")
        TMSG.AppendLine("적색 :  길이,문자패턴 미적용")
        TMSG.AppendLine()
        TMSG.AppendLine(">>환경설정에서 색상구분이 가능하도록 설정되어야 합니다")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.PictureBox1, TMSG.ToString)

        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("<사용할 프린터를 선택하세요>")
        TMSG.AppendLine()
        TMSG.AppendLine("아무것도 입력되지 않았으면 기본프린터로 출력됩니다.")
        TMSG.AppendLine("현재 설치되어있는 프린터 목록이 표시됩니다.")
        TMSG.AppendLine()
        Me.combobox5.ToolTipText = TMSG.ToString
        'Me.ToolTip1.SetToolTip(Me.ComboBox5, TMSG.ToString)



        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("<2번째 장이 출력될 위치를 결정하세요.>")
        TMSG.AppendLine()
        TMSG.AppendLine("2번째 장이 출력될때 1번째장과의 왼쪽거리 값입니다. 0 으로할경우 동일한 X값이 됩니다.")
        TMSG.AppendLine("같은 줄 아래쪽에 표시를 하려면 X=0 으로두고 Y=값을 임의로 입력하세요")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.tb_secX, TMSG.ToString)

        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("<2번째 장이 출력될 위치를 결정하세요.>")
        TMSG.AppendLine()
        TMSG.AppendLine("2번째 장이 출력될때 1번째장과의 위쪽거리 값입니다. 0 으로할경우 동일한 Y값이 됩니다.")
        TMSG.AppendLine("같은 줄 아래쪽에 표시를 하려면 X=0 으로두고 Y=값을 임의로 입력하세요")
        TMSG.AppendLine()
        Me.ToolTip1.SetToolTip(Me.tb_secY, TMSG.ToString)

        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine()
        TMSG.AppendLine("<2장 출력시 데이터의 출력방법을 선택하세요.>")
        TMSG.AppendLine()
        TMSG.AppendLine("[복사]는 현재데이터와 동일한 데이터가 표시됩니다.")
        TMSG.AppendLine("[다음]은 다음데이터가 표시됩니다.")
        TMSG.AppendLine()
        TMSG.AppendLine("동일한 데이터를 한번더 출력하려면 [복사]를 선택하세요.")
        TMSG.AppendLine("다음데이터까지 출력하려면 [다음]을 선택하세요")
        Me.ToolTip1.SetToolTip(Me.cmb_dummy, TMSG.ToString)

        TMSG = New System.Text.StringBuilder()
        TMSG.AppendLine("녹색은 길이패턴만 적용된 아이템이며")
        TMSG.AppendLine("적색은 길이,문자패턴이 존재하지 않는 아이템입니다")
        TMSG.AppendLine("흑색은 문자패턴이나 길이,문자패턴이 존재하는 경우입니다.")
        TMSG.AppendLine()
        'Me.ToolTip1.SetToolTip(Me.X1, X1.설명 & vbCrLf & TMSG.ToString)
        'Me.ToolTip1.SetToolTip(Me.X2, X2.설명 & vbCrLf & TMSG.ToString)
        'Me.ToolTip1.SetToolTip(Me.X3, X3.설명 & vbCrLf & TMSG.ToString)



    End Sub
    Private Sub con_dclick(ByVal sender As Object, ByVal e As System.EventArgs)
        WLog2(Auto_Log, "개체를 더블클릭했습니다.(이것은 사용되지 않음)", "\정액등순차로그.txt")
        Dim Msg As New System.Text.StringBuilder("변경할 값을 입력하세요")
        Msg.AppendLine("줄바꿈을하려면 \n 을 입력하세요")
        Msg.AppendLine("예) 세로로 12를 출력하려면 1\n2 을 입력하세요")
        Msg.AppendLine()
        Msg.AppendLine("변경한 값은 현재페이지에만 적용됩니다")
        Dim A As MyControlOLEDBv2.MyLabel = sender
        Dim Val As String = InputBox(Msg.ToString, "변경", A.MyText)
        If Val = "" Then Return
        Val = Val.Replace("\n", vbCrLf)
        A.MyText = Val
        '//preview 는 아마도 픽쳐박스 더블클릭에서 정의한듯 하다.
    End Sub
    Private Sub Save_Setting()
        WLog2(Auto_Log, "현재 설정(스타일)을 저장합니다.", "\정액등순차로그.txt")
        Dim A As New MyINI2(SettingFile)
        A.Write("PRINTFORM", "printername", Me.combobox5.Text)   '//패턴검사조건 콤보박스      
    End Sub
    Private Sub Load_Setting()
        WLog2(Auto_Log, "현재설정(스타일)을 가져옵니다.()", "\정액등순차로그.txt")
        WLog2(Auto_Log, "Load_Setting()", "\정액등순차로그.txt")
        Dim a As New MyINI2(SettingFile)
        Me.combobox5.Text = a.Read("PRINTFORM", "printername", "")
    End Sub

    Public Sub GeTviewData(ByVal index As Integer, ByVal previewWindow As Boolean, Optional ByRef 번호패턴검사 As Integer = -1)
        ' Dim STARTTIME, ENDTIME As Date
        WLog2(Auto_Log, "GetviewData 진입()", "\정액등순차로그.txt")
        If Dv.Count <= 0 OrElse index < 0 OrElse index > Dv.Count Then
            WLog2(Auto_Log, "GetViewData : 인덱스가 없거나 문제가 잇어서 리턴합니다.()", "\정액등순차로그.txt")
            ' MsgBox("GETVIEWDATA : 데이터가 없거나 잘못된 인덱스 입니다", MsgBoxStyle.Information, "확인") ' & index & "/" & Me.CustFP1.ActiveSheet.RowCount & ")", MsgBoxStyle.Critical, "확인")
            Return '//잘못된 인덱스는 리턴
        End If

        고객번호 = GetSpread(Me.Dv, index, "고객번호1") & Space(1) & GetSpread(Me.Dv, index, "고객번호2") & Space(1) & GetSpread(Me.Dv, index, "고객번호3")
        관리번호1 = GetSpread(Me.Dv, index, "관리번호1")
        관리번호2 = GetSpread(Me.Dv, index, "관리번호2")
        관리번호3 = GetSpread(Me.Dv, index, "관리번호3")
        지점명 = GetSpread(Me.Dv, index, "지점명")

        전산화번호 = GetSpread(Me.Dv, index, "전산화번호1") & GetSpread(Me.Dv, index, "전산화번호2")
        선로명 = GetSpread(Me.Dv, index, "선로명")
        전주번호 = GetSpread(Me.Dv, index, "전주번호1") & GetSpread(Me.Dv, index, "전주번호2") & GetSpread(Me.Dv, index, "전주번호3")

        WLog2(Auto_Log, "데이터뷰의 데이터를 변수로 가져오기 완료()", "\정액등순차로그.txt")

        Me.Text = "출력작업(" & 고객번호 & " : " & 관리번호1 & "/" & 관리번호2 & "/" & 관리번호3

        WLog2(Auto_Log, "PASE구문을 실행합니다.()", "\정액등순차로그.txt")
        '============ 여기는 따로 해석이 없는곳이다 ==========================================================
        'Me.PARSE_고객번호(고객번호)
        'Me.PARSE_관리번호1(관리번호1)
        'Me.PARSE_관리번호2(관리번호2)
        'Me.PARSE_관리번호3(관리번호3)
        'Me.PARSE_지점명(지점명)
        '====================================================================================================

        WLog2(Auto_Log, "패턴이있는 PASE 구문을 실행합니다.()", "\정액등순차로그.txt")

        If Me.PARSE(고객번호, Me.S고객번호) Then Me.PARSE_PATTERN(고객번호, Me.S고객번호)
        If Me.PARSE(관리번호1, Me.S관리번호1) Then Me.PARSE_PATTERN(관리번호1, Me.S관리번호1)
        If Me.PARSE(관리번호2, Me.S관리번호2) Then Me.PARSE_PATTERN(관리번호2, Me.S관리번호2)
        If Me.PARSE(관리번호3, Me.S관리번호3) Then Me.PARSE_PATTERN(관리번호3, Me.S관리번호3)
        If Me.PARSE(지점명, Me.S지점명) Then Me.PARSE_PATTERN(지점명, Me.S지점명)

        If Me.PARSE(전산화번호, Me.S전산화번호) Then Me.PARSE_PATTERN(전산화번호, Me.S전산화번호)
        If Me.PARSE(선로명, Me.S선로명) Then Me.PARSE_PATTERN(선로명, Me.S선로명)
        If Me.PARSE(전주번호, Me.S전주번호) Then Me.PARSE_PATTERN(전주번호, Me.S전주번호)

        '======================== 기타 =================================================
        '휴 끝났다.......................................................
        WLog2(Auto_Log, "Pewview 윈도우를 실행합니다.()", "\정액등순차로그.txt")

        '//이러면 표시해야한다.
        If Me.cb_seq.Checked Then
            Me.S번호(0).MyText = GetSpread(Me.Dv, index, "번호") 'index + 1
            Me.S번호(0).Visible = True
        Else
            Me.S번호(0).Visible = False
        End If

        Me.preview_window()
    End Sub

    Public Function ChkNumPattern(ByVal index As Integer) As Int16
        WLog2(Auto_Log, "번호패턴을 체크합니다. int16을 반환합니다.()", "\지중순차로그.txt")
        If Dv.Count <= 0 Or index < 0 OrElse index > Dv.Count Then
            'MsgBox("데이터가 없거나 잘못된 인덱스 입니다(" & index & "/" & Me.CustFP1.ActiveSheet.RowCount & ")", MsgBoxStyle.Critical, "확인")
            Return -1 '//잘못된 인덱스는 리턴
        End If

        Dim 검사번호패턴검사 As Integer = 0
        Dim 검사번호 As String

        검사번호 = GetSpread(Me.Dv, index, "번호1") & GetSpread(Me.Dv, index, "번호2") & GetSpread(Me.Dv, index, "번호3") & GetSpread(Me.Dv, index, "번호4") & GetSpread(Me.Dv, index, "번호5")
        If 검사번호.Trim = "" Then Return -1 '//검사번호자체에 문제가잇을시 에 리턴

        Dim Wlen As Short = 검사번호.Length : If Wlen <= 0 Then Return -1 '//없는 글귀가 왓을때 턴해버린다.
        Dim SRC() As Char = 검사번호.ToCharArray
        Dim Log As String = "\Parse_검사번호패턴.txt"
        Dim SepPos As Short = 검사번호.IndexOf(";")
        Dim retval As Integer = 0   ''0은 정상 1은 길이패턴없음 2는 3은 길이+문자없음

        '//검사번호는 길이패턴을 하지않고 문자패턴만 한다.
        Dim pname As String
        Dim Arinini As New MyINI2(drstyle.File)
        Dim PATTERN As String = PATTERN_ENC(검사번호)

        '//먼저문자가있는지 확인한다.
        pname = "JJNUMPATTERNII" & PATTERN

        Dim Dr() As DataRow
        Dr = dtpattern.Select("NAME = '" & pname & "DESC'")
        WLog2(Auto_Log, "길이패턴의 존재여부 = " & Dr.GetUpperBound(0) & ":" & pname, "\지중순차로그.txt")
        If Dr.GetUpperBound(0) <> -1 Then '//있다.
            retval += 2
            'WLog2(Auto_Log, "관리구5번 문자를 찾았습니다 (" & pname & "DESC" & ")", Log)
        End If

        'If Arinini.Read(pname, "DESC") = vbNullString Then retval += 2 '//패턴이 없으므로 바로 넘긴다.

        pname = "JJNUMPATTERN" & Wlen
        Dr = dtpattern.Select("NAME = '" & pname & "DESC'")
        WLog2(Auto_Log, "문자패턴의 존재여부 = " & Dr.GetUpperBound(0) & ";" & pname, "\지중순차로그.txt")
        If Dr.GetUpperBound(0) <> -1 Then '//있다.
            retval += 1
            'WLog2(Auto_Log, "관리구5번 문자를 찾았습니다 (" & pname & "DESC" & ")", Log)
        End If
        Return retval '// 0이 리턴될것이다. 패턴이 모두 정상이란 뜻이다
    End Function
    Public Sub CLEAR_ITEM(ByVal labels() As MyControlOLEDBv2.MyLabel)
        WLog2(Auto_Log, "Clear_item div=", "\지중(케이블라벨)순차로그.txt")
        For i As Short = 0 To labels.GetUpperBound(0)
            labels(i).MyText = ""
            labels(i).Visible = False
        Next
    End Sub
    Public Sub GetStyleList()
        AddLog(Auto_Log, "GetStyleList진입()", "\지중(케이블라벨)순차로그.txt")
        '//스타일명을 가져와서 콤보박스에 표시합니다.
        '//style 폴더아래의 ini 파일전체를 스타일 이라한다.
        '//파일을 읽어서 메모리에 저장한다.
        ' Dim Arinini As MyINI
        Dim CurIdx As Integer = 0
        If StyleDir.Exists = False Then StyleDir.Create()
        Dim StyleCnt As Short = StyleDir.GetFiles("*.ini").GetUpperBound(0)

        ' ReDim StyleList(StyleCnt)
        ReDim Common.PDS(StyleCnt) '//패턴데이터셋의 갯수를 저장한다 

        Dim Section, Value As New ArrayList
        Dim SectionIdx As Integer = 0

        AddLog(Auto_Log, "GetStyleList(파일에서 스타일목을 가져온다)", "\지중(케이블라벨)순차로그.txt")

        '//스타일파일명을 테이블에 임시저장한다(일괄로 불러오기위함이다.)
        Dim Dt As New System.Data.DataTable : Dt.Columns.Add("파일명")

        For Each FI As IO.FileInfo In StyleDir.GetFiles("*.ini")
            Dt.Rows.Add(FI.FullName)
        Next
        For Each Dr As DataRow In Dt.Select("", "파일명 asc")
            Dim FileName As String = Dr("파일명")
            AddLog(Auto_Log, "파일명=(" & FileName & ") 의 스타일을 가져옵니다 메모리로", "\지중순차로그.txt")

            '//XML테이블을 새로생성
            Common.PDS(CurIdx) = New PatternDS

            GetAllsection(FileName, CurIdx)

            Me.cmb_style.Items.Add(Common.PDS(CurIdx).TStyle.Rows(0)("Desc").ToString)
            CurIdx += 1
        Next



    End Sub

    Private Sub 데이터테이블갱신()
        WLog2(Auto_Log, "데이터테이블 갱신()", "\정액등순차로그.txt")
        GetAllsection(DrStyle.FILE, Me.cmb_style.SelectedIndex)

        DrStyle = Common.PDS(Me.cmb_style.SelectedIndex).TStyle.Rows(0)
        DtPattern = Common.PDS(Me.cmb_style.SelectedIndex).TPattern

    End Sub

    Private Function Prepare_Print() As Boolean '//범위내의 페이지번호와 일치하는 번호를 찾아서 배열에 할당한다.
        WLog2(Auto_Log, "Func(PrePare_Print) 인쇄번호 할당 준비", "\Alllog.txt")

        Dim Number As Integer = 0
        Dim FindNum As Boolean = False
        Me.printindex = 0   '//배열의 첫번으로 출력을 준비한다.
        'Me.PrintArray = Nothing  '//출력번호 배열을 저장할 것이다.\
        ReDim PrintArray(0)
        PrintArray(0) = 1

        'log = False
        'AddLog("==============출력준비중==============", True)

        Me.pDoc.DefaultPageSettings.Margins.Left = 0 'Me.tb_marginx.Text  '//좌,우 여백 설정
        Me.pDoc.DefaultPageSettings.Margins.Top = 0 'Me.tb_marginy.Text
        Me.pDoc.DefaultPageSettings.Landscape = IIf(Me.cmb_landscape.SelectedIndex = 0, False, True) '//가로,세로 출력결정
        '//프린터명이 지정되어있다면 해당 프린터로설정,없으면 기본프린터
        If Me.combobox5.Text <> "" Then Me.pDoc.PrinterSettings.PrinterName = Me.combobox5.Text
        '//범위인데 값이 비어있으면 현재출력으로
        If Me.RadioButton3.Checked AndAlso Me.tb_printrange.Text.Trim = "" Then Me.RadioButton2.Checked = True

        If Me.rad_repeat.Checked Then
            If IsNumeric(Me.tb_printrange.Text) = False Then
                MsgBox("출력장수에 숫자만 입력하세요", MsgBoxStyle.Critical, "확인")
                Return False
            End If
            ReDim PrintArray(Val(Me.tb_printrange.Text) - 1)
            For i As Integer = 0 To Val(Me.tb_printrange.Text) - 1
                PrintArray(i) = Me.BindingNavigatorPositionItem.Text - 1
            Next
        End If

        If Me.RadioButton1.Checked Then '//전체출력이므로 배열에 모든것을 리턴한다 : 모든데이터의 레코드 인덱스를 저장한다.
            'MsgBox("rad1")
            ReDim Me.PrintArray(Me.Dv.Count - 1)
            For i As Integer = 0 To Dv.Count - 1
                Me.PrintArray(i) = i
            Next
        End If

        If Me.RadioButton2.Checked Then '//현재페이지 : 현재보고있다는 페에지의  레코드인덱스만 저장한다.
            'MsgBox("Rad2" & Me.BindingNavigatorPositionItem.Text - 1)
            ReDim Me.PrintArray(0)
            Me.PrintArray(0) = Me.BindingNavigatorPositionItem.Text - 1    '/현재카운트보다 1작다 배열은 0부터 시작하기떄문에
            'Me.printindex = -1
        End If


        '//2007-12-21일  변경시작
        If Me.RadioButton3.Checked Then '//범위지정 : 지정된범위내의 번호값을 가지고 해당 인덱스를 찾아서 배열에 할당한다.
            'Dim buff() As String = Me.tb_printrange.Text.Split("/")
            'Dim curpos As Integer = 0
            'MsgBox("rad3")


            Dim buff As String = Me.tb_printrange.Text
            ReDim Me.PrintArray(0) : Me.PrintArray(0) = -1

            '//먼저 -가 있나없나 판단해서 한페이지용인지 범위용인지 구분한다.
            If buff.IndexOf("-") >= 0 Then    '//범위이다.
                Dim SubBuff() As String = buff.Split("-")
                Dim Sttnum As Integer = CInt(SubBuff(0))  '//시작
                Dim endnum As Integer = CInt(SubBuff(1)) '//종료값

                For SI As Integer = 0 To endnum - Sttnum    '//범위갯수만큼 돈다
                    FindNum = False
                    Number = CInt(Sttnum + SI)   '//페이지만 적엇을 것이므로
                    For ni As Integer = 0 To Dv.Count - 1  '//현재뷰의 모든데이터를 가지고 검색한다 좌->우 순차검색
                        If Number = Dv(ni).Row("번호") Then
                            If PrintArray(0) = -1 Then '//처음데이터이므로
                                Me.PrintArray(0) = ni
                            Else   '//처음이아니므로 배열을 증가시키고 기입한다.
                                ReDim Preserve PrintArray(PrintArray.GetUpperBound(0) + 1)   '//배열1증가
                                Me.PrintArray(PrintArray.GetUpperBound(0)) = ni
                            End If
                            FindNum = True
                            Exit For
                        End If
                    Next
                Next

            Else   '//페이지번호만 적었을때다    
                If IsNumeric(buff) Then
                    Number = CInt(buff)   '//페이지만 적엇을 것이므로
                    For ni As Integer = 0 To Dv.Count - 1  '//현재뷰의 모든데이터를 가지고 검색한다 좌->우 순차검색
                        If Number = Dv(ni).Row("번호") Then
                            PrintArray(0) = ni
                            Exit For
                        End If
                    Next
                Else
                    MsgBox("범위(-)를 제외하고 숫자만 입력하세요", MsgBoxStyle.Critical, "입력오류")
                End If
            End If
        End If

        If PrintArray(0) = -1 Then '//배열에 아무것도 없다면
            Return False
        Else
            Return True
        End If
    End Function

    Private Sub Print_Preview()
        WLog2(Auto_Log, "print_preview 미리보기 버튼을 눌렀을때다.()", "\정액등순차로그.txt")
        Me.PrintMode = True
        If Not Prepare_Print() Then
            MsgBox("인쇄할 목록이 없습니다", MsgBoxStyle.Critical, "확인")
            Return
        End If

        Dim Preview As New PrintPreviewDialog()
        Try
            Preview.Document = pDoc
            Preview.ShowDialog()

        Catch EX As Exception
            MsgBox(EX.Message)
        End Try
    End Sub

    Private Sub pDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pDoc.PrintPage

        AddLog(Admin, "proc_printpage 프린트패이지를 작성한다 중요하다.()", "\Alllog.txt")

        Dim fmt As New StringFormat(StringFormatFlags.LineLimit)
        Dim MyFont As Font
        Dim NewFontSize As Int16 = 10
        Dim dummy As Boolean = False    '//이값이 true 이면 출력시 변위를 지정해서 출력한다.
        Dim C As MyControlOLEDBv2.MyLabel
        Dim NewLeft, NewTop As Integer

        '페이지 구분을 이해하고 몇개를 찍을지 결정한다.
        'Debug.Print("프린터인덱스=" & Me.printindex)
        'Debug.Print("프린터배열=" & Me.PrintArray.GetUpperBound(0))

        If Me.printindex <> -1 Then
            If Me.rad_repeat.Checked = False Then Me.GeTviewData(Me.PrintArray(Me.printindex), False) '//페이지를 갱신하고 출력을 시작한다.
        Else
            MsgBox("프린트 인덱스가 없습니다", MsgBoxStyle.Critical, "확인")

        End If
        e.Graphics.ScaleTransform(Me.tb_scalex.Text, Me.tb_scaley.Text)


Dummyflag:  '//--2장출력일경우 이부분에서 다시 시작한다.

        'MsgBox(dummy)

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            C = Me.AllLabels(i).ctl
            If C.Visible = True AndAlso C.MyText <> "" Then
                '//myfont 는 글꼴의 일괄크기변경 옵션의의해서 생성됨
                NewFontSize = C.MyFont.Size + Me.tb_myfontsize.Text
                If NewFontSize < 0 Then NewFontSize = 0

                MyFont = New Font(C.MyFont.FontFamily, NewFontSize, C.MyFont.Style)

                If dummy Then  '//인쇄가 아닐대에는 margin 을 넣지않는다.
                    NewLeft = C.Left + IIf(Me.PrintMode, Me.tb_marginx.Text, 0) + Me.tb_secX.Text
                    NewTop = C.Top + IIf(Me.PrintMode, Me.tb_marginy.Text, 0) + Me.tb_secY.Text
                Else
                    NewLeft = C.Left + IIf(Me.PrintMode, Me.tb_marginx.Text, 0)
                    NewTop = C.Top + IIf(Me.PrintMode, Me.tb_marginy.Text, 0)
                End If

                If C.장평 = 100 AndAlso C.장높이 = 100 Then '//장평미사용 문자열 처리                 
                    e.Graphics.DrawString(C.최종문자, MyFont, Brushes.Black, New Point(NewLeft, NewTop))
                Else    '//장평사용 이미지 처리
                    Dim NewX, Newy As Integer
                    Dim SrcDpix, SrcDPiY As Single
                    'MsgBox(Tobj.장높이)
                    SrcDpix = C.CreateGraphics.DpiX
                    SrcDPiY = C.CreateGraphics.DpiY

                    NewX = C.GetSize(MyFont).Width * (C.장평 / 100) * (e.Graphics.DpiX / SrcDpix)
                    Newy = C.GetSize(MyFont).Height * (C.장높이 / 100) * (e.Graphics.DpiY / SrcDPiY)

                    Dim BMP As New Bitmap(NewX, Newy, e.Graphics)
                    Dim G As Graphics = Graphics.FromImage(BMP)

                    G.ScaleTransform((C.장평 / 100), (C.장높이 / 100))
                    G.DrawString(C.최종문자, MyFont, Brushes.Black, 0, 0)
                    G.Dispose()
                    e.Graphics.DrawImage(BMP, New Point(NewLeft, NewTop)) ', CInt(GetSize.Width * (v장평 / 100)), GetSize.Height)
                End If
            End If
        Next

        '//페이지가 있던없던 2장복사를 먼저 확인한다.
        '//다음페이지가 잇으면 다음기능을 확인하고 그렇지 않을경우에는 한장복사만 확인한다.
        If dummy = False AndAlso Me.cb_dummy.Checked Then   '//2장복사일경우에는  현재복사인지 다음복사인지 체크

            dummy = True
            If Me.cmb_dummy.SelectedIndex = 0 Then  '//현재복사는 궂이 다음장없어도 가능하다.
                'dummy = True
                ' MsgBox("잇던없던 현재복사")
                GoTo Dummyflag
            Else    '//다음복사이므로 다음장이잇는지 확인하고해야한다.
                'MsgBox("다음장복사")
                If Me.printindex >= 0 AndAlso Me.printindex < Me.PrintArray.GetUpperBound(0) Then   '//다음장이있다.
                    'MsgBox("다음장이잇다.. 데이터바꾸고 goto한다")
                    Me.printindex += 1  '/1장넘기고 
                    If Me.rad_repeat.Checked = False Then Me.GeTviewData(Me.PrintArray(Me.printindex), False) '//데이터 바꾸는데..화면은 갱신하지 않는다.
                    GoTo Dummyflag  '//바로 출력다시한다.
                Else
                    'MsgBox("다음장없어서 그냥넘어간다")
                    '다음장이없으므로 그냥 넘어간다.
                    e.HasMorePages = False
                End If
            End If
        Else    '//다음장으로넘깁니다.
            If Me.printindex >= 0 AndAlso Me.printindex < Me.PrintArray.GetUpperBound(0) Then   '//다음장이있다.
                dummy = False   '//장수를 넘어가면 더미를 해제한다.
                Me.printindex += 1
                e.HasMorePages = True
            Else
                e.HasMorePages = False
            End If
        End If
        e.Graphics.Dispose()
    End Sub

    Private Sub Print()
        If MsgBox("인쇄를 하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") = MsgBoxResult.Ok Then
            WLog2(Auto_Log, "print 바로 출력을 하라는 명령이다()", "\Alllog.txt")
            Me.PrintMode = True
            If Me.Prepare_Print() Then
                pDoc.Print()
                GeTviewData(BindingSource1.Position, True) '   preview_window()
            Else
                MsgBox("인쇄가능한 목록이 없습니다", MsgBoxStyle.Critical, "확인")
            End If
        Else
            NOTICE("인쇄가 취소되었습니다", Color.Tomato, Me.lb_msg)
        End If
    End Sub

    Private Sub con_Mmove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        WLog2(Auto_Log, "con _move 개체이동할 프로시져인데 현재 안쓴다.()", "\정액등순차로그.txt")
        If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Button = Windows.Forms.MouseButtons.Left Then
            ' Me.Text = CType(sender, Label).Left & "/" & e.X
            CType(sender, MyControlOLEDBv2.MyLabel).Left += e.X
            CType(sender, MyControlOLEDBv2.MyLabel).Top += e.Y
        End If
    End Sub

    '''우측에 개체의 상태를 보여줍니다.
    '''
    Public Sub ViewProperty(ByVal sender As MyControlOLEDBv2.MyLabel)
        WLog2(Auto_Log, "view properfty  개체의 상태보기()", "\정액등순차로그.txt")
        If Not Me.GroupBox2.Enabled Then Me.GroupBox2.Enabled = True

        Me.TB_FONTNAME.Text = sender.MyFont.Name.ToString
        Me.tb_left.Text = sender.Left
        Me.tb_top.Text = sender.Top

        Me.tb_foncol.BackColor = sender.MyForeColor
        Me.cb_visible.Checked = sender.Visible

        Me.cb_bold.Checked = sender.MyFont.Bold
        'Me.cb_italic.Checked = sender.MyFont.Italic
        ' Me.cb_uline.Checked = sender.MyFont.Underline

        Me.tb_fsize.Text = sender.MyFont.Size
        Me.tb_wordwidth.Text = sender.장평
        Me.tb_wordheight.Text = sender.장높이
        Me.tb_space.Text = sender.공백



        Me.GroupBox2.Text = "위치/크기/글꼴(" & sender.MyText & ") W=" & sender.Width & ",H=" & sender.Height


        If Not sender.Tag Is Nothing Then   '//여기서 개체의 패턴적용여부를 표시합니다.
            ' MsgBox(sender.Tag.ToString)
            Me.lb_countpattern.ForeColor = IIf(sender.Tag.ToString.IndexOf("L") >= 0, Color.Green, Color.Black)
            Me.lb_strpattern.ForeColor = IIf(sender.Tag.ToString.IndexOf("C") >= 0, Color.Green, Color.Black)
            'Me.CB_LPATTERN.Checked = IIf(sender.Tag.ToString.IndexOf("L") >= 0, True, False)
            'Me.CB_CHARPATTERN.Checked = IIf(sender.Tag.ToString.IndexOf("C") >= 0, True, False)
        Else
            Me.lb_countpattern.ForeColor = Color.Black
            Me.lb_strpattern.ForeColor = Color.Black
        End If
    End Sub

    Private Sub ViewBackImage()
        WLog2(Auto_Log, "viewBackImage 배경이미지를 표시합니다.()", "\정액등순차로그.txt")
        Dim Picimg As String
        If Me.tb_picfile.Text.IndexOf(":") > -1 Then  '//드라이브명이 있으면 그대로쓰고 아니면 붙여서쓴다.
            Picimg = Me.tb_picfile.Text
        Else
            Picimg = My.Application.Info.DirectoryPath & "\image\" & Me.tb_picfile.Text
        End If
        If Not System.IO.File.Exists(Picimg) Then
            Me.CheckBox4.Checked = False
        ElseIf Me.CheckBox4.Checked Then
            Me.PictureBox1.BackgroundImage = Image.FromFile(Picimg)
        End If
    End Sub

    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
        WLog2(Auto_Log, "배경보기 체크박스를 클릭했다.)", "\정액등순차로그.txt")
        'Me.PictureBox1.Visible = IIf(CType(sender, CheckBox).Checked, True, False)
        If CType(sender, Windows.Forms.CheckBox).Checked Then
            Me.ViewBackImage()
        Else
            Me.PictureBox1.BackgroundImage = Nothing
        End If
    End Sub

    Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click
        Dim A As New OpenFileDialog
        WLog2(Auto_Log, "파일찾기 버튼이 클릭됨", "\정액등순차로그.txt")

        If System.IO.File.Exists(Me.tb_picfile.Text) Then
            A.FileName = Me.tb_picfile.Text
        Else
            A.FileName = My.Application.Info.DirectoryPath & "\image\normal.jpg"
        End If
        If A.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return
        Me.tb_picfile.Text = A.FileName
        Me.PictureBox1.BackgroundImage = Image.FromFile(Me.tb_picfile.Text)
        Me.CheckBox4.Checked = True
    End Sub

    Public Sub CtrPos(ByVal vertical As Boolean, ByVal offset As Short)
        WLog2(Auto_Log, "ctrpos (선택된 개체들의 위치값을 변경합니다)", "\정액등순차로그.txt")
        If SelCon Is Nothing OrElse SelCon.Count < 1 Then Exit Sub

        For Each sender As Control In SelCon
            If vertical Then    '//좌우측
                If My.Computer.Keyboard.AltKeyDown Then
                    If offset < 0 Then
                        sender.Top -= 1
                    Else
                        sender.Top += 1
                    End If
                ElseIf My.Computer.Keyboard.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.Top -= 10
                    Else
                        sender.Top += 10
                    End If
                Else
                    sender.Top += offset
                End If
            Else    '//상하측
                If My.Computer.Keyboard.AltKeyDown Then
                    If offset < 0 Then
                        sender.Left -= 1
                    Else
                        sender.Left += 1
                    End If
                ElseIf My.Computer.Keyboard.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.Left -= 10
                    Else
                        sender.Left += 10
                    End If
                Else
                    sender.Left += offset
                End If
            End If

        Next

        WLog2(Auto_Log, "ctrpos =[ preview 호출합니다]", "\정액등순차로그.txt")
        Me.preview_window()
        'Me.ViewProperty(sender)
    End Sub

    Private Sub ShowMsg(ByVal Message As String)
        WLog2(Auto_Log, "showmsg 메세지를 보여줍니다 =" & Message, "\정액등순차로그.txt")
        Me.lb_msg.Text = "▷ " & Message & Space(1) & TimeOfDay.ToString
    End Sub

    Public Sub SetFont()   '//체크박스 상태에따라서 폰트를 변경합니다.
        WLog2(Auto_Log, "set font 체크박스 상태에 따라서 폰트를 변경합니다.", "\정액등순차로그.txt")
        Dim B As System.Drawing.FontStyle
        If Me.cb_bold.Checked = True Then B = FontStyle.Bold
        Dim Tobj As MyControlOLEDBv2.MyLabel
        For Each A As Control In SelCon
            Tobj = CType(A, MyControlOLEDBv2.MyLabel)
            Tobj.MyFont = New Font(Tobj.MyFont, B)
        Next
        WLog2(Auto_Log, "setfont = preview 호출합니다.", "\정액등순차로그.txt")
        Me.preview_window()
    End Sub

    Private Sub cmb_style_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmb_style.KeyUp
        WLog2(Auto_Log, "스타일콤보박스에서 keyip 이 감지되었으나 핸들을 true 로 해버린다.", "\정액등순차로그.txt")
        e.Handled = True
    End Sub

    Private Sub cmb_style_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_style.SelectedIndexChanged
        '//여기서 데이터를 추려내고(필터를 가져온다.)
        '//해당 스타일을 불러온다
        WLog2(Auto_Log, "스타일 인덱스가 변경되었다.", "\정액등순차로그.txt")
        If Me.cmb_style.SelectedIndex < 0 Then Me.cmb_style.SelectedIndex = 0

        '//기본변수설정 170219
        DrStyle = Common.PDS(Me.cmb_style.SelectedIndex).TStyle.Rows(0)
        DtPattern = Common.PDS(Me.cmb_style.SelectedIndex).TPattern

        Dim DataFilter As String = drstyle.Filter
        If DataFilter.Trim = "" Then
            DataFilter = "출력 = true" '//인쇄필드는 지선주 구분용으로 재사용한다.
        Else
            DataFilter &= " AND 출력 = true" '//지선주는 인쇄가 True 값이기때문에 해당 값을 제외한다
        End If

        Me.BindingSource1.Sort = ""
        Me.BindingSource1.DataSource = Nothing
        Me.SaveReadLayOut(True)

        Try
            Dv = New DataView(srcTable, DataFilter, "정렬번호,번호", DataViewRowState.CurrentRows)

            'Dv = New DataView(srcTable, "len(DL명) > 0", "", DataViewRowState.CurrentRows)

            If Dv.Count <= 0 Then '//데이터가없다면
                MsgBox(Me.cmb_style.Text & "에 해당하는 데이터가존재하지 않습니다" & vbCrLf & vbCrLf & "다른 스타일을 선택하세요", MsgBoxStyle.Information, "확인")
                Me.PictureBox1.Refresh()
            Else
                WLog2(Auto_Log, "선택된 스타일에 데이터가있다=" & Dv.Count, "\정액등순차로그.txt")
                Me.textbox2.Text = Dv.Count - 1 '//패턴검사시 종료카운터이다...
                Me.VScrollBar1.Minimum = 0
                Me.VScrollBar1.Maximum = Dv.Count - 1

                'MsgBox("스크롤 수=" & Me.VScrollBar1.Maximum)
                Me.LOAD_STYLE()   '//스타일불러오기(여기서 모든컨트롤의 기본 위치와 글꼴이 결정된다)
                If Me.FirstIdx = -1 Then
                    For i As Integer = 0 To Dv.Count - 1    '//맨첨보여줄놈을 찾는다. DV와 원래 인덱스값이 다르기때문에 찾아야한다.
                        If Dv(i)("번호") = Srcnum Then
                            FirstIdx = i
                            Exit For
                        End If
                    Next
                End If

                '필터를 적용해서 뷰를 구성한다음에 해당 뷰를 데이터소스로 변경한다.
                Me.SaveReadLayOut(True)

                If FirstIdx = -1 OrElse FirstIdx > Dv.Count - 1 Then FirstIdx = 0 '//찾지못하고 나왓을경우에는 1번쨰 레코드를 보여주도록 한다.


                NoView = True   '//For Validate Index =0


                If FirstIdx = 0 Then    '//Index is first
                    WLog2(Auto_Log, "View : First Record // Set = 0", "\Alllog.txt")
                Else    '//index is not first
                    WLog2(Auto_Log, "View : Index Count = " & FirstIdx, "\Alllog.txt")
                End If

                Me.BindingSource1.DataSource = Dv 'Dv   '//여기서셋팅되면서 바로 tview 가 작동된다.
                Me.BindingSource1.Sort = "정렬번호,번호" ',번호"            
                Me.VScrollBar1.Value = FirstIdx
                Me.BindingSource1.Position = FirstIdx
                Me.dataview.DataSource = Me.BindingSource1

                'MsgBox("ASDF" & Me.BindingNavigatorPositionItem.Text)
                If FirstIdx = 0 Then Me.GeTviewData(Me.BindingNavigatorPositionItem.Text - 1, True)
            End If

        Catch ex As Exception
            '//에러난다면 거의 뭐;;폼을 바로 실행하는경우다
            '//MsgBox("관리자 모드인가봅니다")

        End Try

        ''WLog2(Auto_Log, "cmb_style selectindexchanged 에서 preview 를 호출함", "\지중순차로그.txt")
        'Me.preview_window()
    End Sub

    Public Sub LOAD_STYLE(Optional ByVal Div As String = "Z")   '//저장된 스타일을 불러옵니다.
        '  MsgBox("LOADSTYLE" & "/" & Div)
        '  MsgBox("LOADSTYLE" & "/" & Div)
        WLog2(Auto_Log, "load_style : 스타일을 불러옵니다. div= " & Div, "\정액등순차로그.txt")
        Dim Arinini As New MyINI2(drstyle.File)
        Dim pos(), font(), visible, mytext As String
        Dim Tobj As MyControlOLEDBv2.MyLabel
        Dim DR() As DataRow
        Dim idx As Integer = 0

        '//모든아이템을 돈다
        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)   '//모든아이템을 돈다.
            Tobj = Me.AllLabels(i).ctl
            If Div.ToUpper = "Z" Then '//모든아이템을 가져오고
                '//메모리에서 찾는다.
                Tobj.Tag = ""
                DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "POS'")
                If DR.GetUpperBound(0) = 0 Then
                    pos = DR(0)(1).ToString.Split(",")
                    Tobj.Location = New Point(pos(0), pos(1))
                    Tobj.Size = New Size(pos(2), pos(3))
                End If

                DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "FONT'")
                If DR.GetUpperBound(0) = 0 Then
                    font = DR(0)(1).ToString.Split(",")
                    Tobj.장평 = font(5)
                    Tobj.장높이 = font(6)
                    Tobj.MyFont = New Font(font(0), font(1), IIf(font(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                End If

                DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "VISIBLE'")
                If DR.GetUpperBound(0) = 0 Then
                    visible = DR(0)(1).ToString
                    Tobj.Visible = CType(visible, Boolean)
                End If

                DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "MYTEXT'")
                If DR.GetUpperBound(0) = 0 Then
                    mytext = DR(0)(1).ToString
                    Select Case Tobj.Name.ToUpper.Substring(0, 1)
                        Case "U", "A", "B", "D", "E"    '//사용자문자일경우에는 문자열도 저장해야한다.
                            If mytext <> "" Then Tobj.MyText = TextDec(mytext) '//ini구조상 바로저장하면안되기때문에 변환해서 저장한다.
                    End Select
                End If

                DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "SPACE'")
                If DR.GetUpperBound(0) = 0 Then Tobj.공백 = DR(0)(1).ToString
            Else    '//특정아이템구분일때 

                If Tobj.Name.ToUpper.Substring(0, 1) = Div Then

                    '//메모리에서 찾는다.
                    Tobj.Tag = ""
                    DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "POS'")
                    If DR.GetUpperBound(0) = 0 Then
                        pos = DR(0)(1).ToString.Split(",")
                        Tobj.Location = New Point(pos(0), pos(1))
                        Tobj.Size = New Size(pos(2), pos(3))
                    End If

                    DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "FONT'")
                    If DR.GetUpperBound(0) = 0 Then
                        font = DR(0)(1).ToString.Split(",")
                        Tobj.장평 = font(5)
                        Tobj.장높이 = font(6)
                        Tobj.MyFont = New Font(font(0), font(1), IIf(font(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                    End If

                    DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "VISIBLE'")
                    If DR.GetUpperBound(0) = 0 Then
                        visible = DR(0)(1).ToString
                        Tobj.Visible = CType(visible, Boolean)
                    End If

                    'DR = dtpattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "MYTEXT'")
                    'If DR.GetUpperBound(0) = 0 Then
                    'mytext = DR(0)(1).ToString
                    'Select Case Tobj.Name.ToUpper.Substring(0, 1)
                    '    Case "U", "A", "B", "D", "E"    '//사용자문자일경우에는 문자열도 저장해야한다.
                    'If mytext <> "" Then Tobj.MyText = TextDec(mytext) '//ini구조상 바로저장하면안되기때문에 변환해서 저장한다.
                    'End Select
                    'End If

                    DR = DtPattern.Select("NAME = 'STYLE" & Tobj.Name.ToUpper & "SPACE'")
                    If DR.GetUpperBound(0) = 0 Then Tobj.공백 = DR(0)(1).ToString
                End If
            End If

        Next

        If Div.ToUpper <> "Z" Then Return '//모든템이아니다


        WLog2(Auto_Log, "load_style 기본값 체크박스등의 값을 불러온다. 이것은 맨첨에만 불러오면 된다. ", "\정액등순차로그.txt")

        '''''''''''''''''''''우측 스타일 체크박스를 가져온다.
        For Each B As Control In Me.TabPage1.Controls
            If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
                CType(B, Windows.Forms.CheckBox).Checked = Arinini.Read("STYLE", B.Name, False)  '//기본값 false
            End If
        Next
        For Each B As Control In Me.TabPage3.Controls
            If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
                CType(B, Windows.Forms.CheckBox).Checked = Arinini.Read("STYLE", B.Name, False)  '//기본값 false
            End If
        Next
        ''''''''''''''''''''''''''''외'''''''''''''''''''''''''''''''''
        Me.tb_marginx.Text = drstyle.MarginX 'Arinini.Read("STYLE", "MarginX", 10)
        Me.tb_marginy.Text = drstyle.MarginY ' Arinini.Read("STYLE", "MarginY", 10)
        Me.tb_scalex.Text = drstyle.ScaleX ' Arinini.Read("STYLE", "ScaleX", "1.5")
        Me.tb_scaley.Text = drstyle.ScaleY ' Arinini.Read("STYLE", "ScaleY", "1.3")
        ''''''''''''2중
        Me.cb_dummy.Checked = drstyle.Dummy 'Arinini.Read("STYLE", "dummy", False)
        Me.cmb_dummy.SelectedIndex = drstyle.Dummytype ' Arinini.Read("STYLE", "dummytype", 0)
        Me.tb_secX.Text = drstyle.dummmyx ' Arinini.Read("STYLE", "dummmyx", "0")
        Me.tb_secY.Text = drstyle.dummmyy ' Arinini.Read("STYLE", "dummmyy", "300")

        Me.tb_picfile.Text = drstyle.Backimg ' Arinini.Read("STYLE", "backimg", My.Application.Info.DirectoryPath & "\image\wall.bmp").ToString.Trim(Chr(0))
        Me.ViewBackImage()  '//배경이미지를 표시한다.

        Me.pDoc.DefaultPageSettings.Landscape = drstyle.LandScape ' Arinini.Read("STYLE", "LandScape", False)
        Me.cmb_landscape.SelectedIndex = IIf(drstyle.LandScape, 1, 0)
        'Me.SetLayOut(IIf(Me.cmb_landscape.SelectedIndex = 0, False, True))

        Me.CheckBox4.Checked = drstyle.Viewimage ' Arinini.Read("STYLE", "ViewImage", True)
        Me.tb_myfontsize.Text = drstyle.PrintFontOffset    ' Arinini.Read("STYLE", "PrintFontOffset", 0)

        'Me.PictureBox1.Width = drstyle.CanvasX 'Arinini.Read("STYLE", "CanvasX", 297) '520
        'Me.PictureBox1.Height = drstyle.CanvasY ' Arinini.Read("STYLE", "CanvasY", 520) '520

        NOTICE(Me.cmb_style.Text & "스타일을 불러왔습니다.", Me.lb_msg)

    End Sub

    Public Sub SAVE_STYLE()
        WLog2(Auto_Log, "ini파일에 스타일을 저장합니다. ", "\정액등순차로그.txt")
        Dim Arinini As New MyINI2(drstyle.File)
        Dim Arininic As New MyINI2(CStr(drstyle.File).ToLower.Replace("ini", "cfg"))

        Dim Tobj As MyControlOLEDBv2.MyLabel
        '//현재 선택된 스타일을 저장합니다.
        If Me.cmb_style.SelectedIndex < 0 Then
            erp.SetError(Me.cmb_style, "저장할 스타일이 선택되어있지 않습니다")
            NOTICE("스타일을 선택하세요", Me.lb_msg)
            Return
        End If
        erp.SetError(Me.cmb_style, vbNullString)

        Dim f As New fProgress()
        f.ProgressBar1.Minimum = 0
        f.ProgressBar1.Maximum = Me.AllLabels.Length
        f.ProgressBar1.Value = 0
        f.ProgressBar1.Style = ProgressBarStyle.Blocks
        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "Control")
        'f.TopMost = True
        f.Show()
        Application.DoEvents()


        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)

            f.ProgressBar1.Value += 1
            f.Refresh()


            Tobj = Me.AllLabels(i).ctl
            If Tobj.Pattern = "" Then
                Arinini.Write("STYLE", Tobj.Name & "pos", Tobj.Left & "," & Tobj.Top & "," & Tobj.Width & "," & Tobj.Height)
                Arinini.Write("STYLE", Tobj.Name & "font", Tobj.MyFont.Name & "," & Tobj.MyFont.Size & "," & Tobj.MyFont.Underline & "," & Tobj.MyFont.Bold & "," & Tobj.MyFont.Italic & "," & Tobj.장평 & "," & Tobj.장높이)
                Arinini.Write("STYLE", Tobj.Name & "visible", "true") '기본값으로 표시로 정해놓고 체크박스 체크한다.
                Arinini.Write("STYLE", Tobj.Name & "space", Tobj.공백)
            End If
        Next

        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "CheckBox")
        f.Show()
        Application.DoEvents()
        f.ProgressBar1.Style = ProgressBarStyle.Marquee

        For Each TC As TabPage In Me.TabControl1.TabPages  '//탭컨트롤1의 모든 페이지에서 체크박스의 상태를 저장한다.
            For Each B As Control In TC.Controls
                If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
                    Arinini.Write("STYLE", B.Name, CType(B, Windows.Forms.CheckBox).Checked) 'A.Visible)
                End If
            Next
        Next

        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "일반정보")
        f.Show()
        Application.DoEvents()

        If Not IsNumeric(tb_marginx.Text) Then
            MsgBox("인쇄여백(가로) 값을 숫자로 입력하세요." + vbCrLf + "현재입력값:" + tb_marginx.Text, MsgBoxStyle.Information, "확인")
        Else
            Arininic.Write("printer", "MarginX", Me.tb_marginx.Text)
        End If

        If Not IsNumeric(tb_marginy.Text) Then
            MsgBox("인쇄여백(세로) 값을 숫자로 입력하세요." + vbCrLf + "현재입력값:" + tb_marginy.Text, MsgBoxStyle.Information, "확인")
        Else
            Arininic.Write("printer", "MarginY", Me.tb_marginy.Text)
        End If

        If Not IsNumeric(tb_scalex.Text) Then
            MsgBox("확대비율(가로) 값을 숫자로 입력하세요." + vbCrLf + "현재입력값:" + tb_scalex.Text, MsgBoxStyle.Information, "확인")
        Else
            Arininic.Write("printer", "ScaleX", Me.tb_scalex.Text)
        End If

        If Not IsNumeric(tb_scaley.Text) Then
            MsgBox("확대비율(세로) 값을 숫자로 입력하세요." + vbCrLf + "현재입력값:" + tb_scaley.Text, MsgBoxStyle.Information, "확인")
        Else
            Arininic.Write("printer", "ScaleY", Me.tb_scaley.Text)
        End If

        Arinini.Write("STYLE", "ViewImage", Me.CheckBox4.Checked)


        If Me.tb_picfile.Text.Trim = "" Then
            Arinini.Write("STYLE", "backimg", "")
        Else
            Dim newpath As String = CStr(My.Application.Info.DirectoryPath & "\image\").ToUpper
            Dim NEwpathp As Short = (Me.tb_picfile.Text.ToUpper.IndexOf(newpath))
            If NEwpathp = -1 Then
                Arinini.Write("STYLE", "backimg", Me.tb_picfile.Text)
            Else
                Arinini.Write("STYLE", "backimg", Me.tb_picfile.Text.Substring(NEwpathp + newpath.Length))
            End If
        End If

        Arininic.Write("printer", "PrintFontOffset", Me.tb_myfontsize.Text)
        Arinini.Write("STYLE", "LandScape", Me.pDoc.DefaultPageSettings.Landscape)

        '//더미 체크박스랑 더미콤보박스 인덱스랑 변위 x,y
        Arinini.Write("STYLE", "dummy", Me.cb_dummy.Checked)
        Arinini.Write("STYLE", "dummytype", Me.cmb_dummy.SelectedIndex)
        Arinini.Write("STYLE", "dummmyx", Me.tb_secX.Text)
        Arinini.Write("STYLE", "dummmyy", Me.tb_secY.Text)
        ' Arinini.Write("STYLE", "picstyle", Me.ComboBox1.SelectedIndex)

        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "레이아웃")
        f.Show()
        Application.DoEvents()

        '//스타일저장시에 현재 레이아웃상태또한 저장하게한다. 이부분은 스타일불러올때 쓰지는 않고
        '//가로/세로 선택할때 불러오게한다(파일에서 직접 불러오게한다 어차피 한번뿐이므로 궃이 메모리에 올리필요없다
        SaveReadLayOut(False) '//레이아웃저장한다.

        f.Close()
        f.Dispose()
        Application.DoEvents()

        NOTICE("기본스타일을 저장했습니다", Me.lb_msg)
        WLog2(Auto_Log, "save style 완료후 데이터테이블 갱신을 호춣 ", "\정액등순차로그.txt")
        Me.데이터테이블갱신()
        Me.preview_window()
    End Sub

    Private Sub SaveReadLayOut(ByVal read As Boolean)   '//현재 화면구성을 가로/세로 결정합니다.
        '//ini파일에저장한다. 섹션명은 pagetype0 ,pagetyp1  0은 세로 1은 가로다
        Dim ini As New MyINI2(drstyle.File)
        Dim Secname As String = "pagetype" & Me.cmb_landscape.SelectedIndex

        If read = False Then
            ini.Write(Secname, "tablelayoutpanel1loc", Me.TableLayoutPanel1.Left & "," & Me.TableLayoutPanel1.Top)
            ini.Write(Secname, "tablelayoutpanel1size", Me.TableLayoutPanel1.Width & "," & Me.TableLayoutPanel1.Height)
            ini.Write(Secname, "PictureBox1loc", Me.PictureBox1.Left & "," & Me.PictureBox1.Top)
            ini.Write(Secname, "PictureBox1size", Me.PictureBox1.Width & "," & Me.PictureBox1.Height)
            ini.Write(Secname, "TabControl1loc", Me.TabControl1.Left & "," & Me.TabControl1.Top)
            ini.Write(Secname, "TabControl1size", Me.TabControl1.Width & "," & Me.TabControl1.Height)
            ini.Write(Secname, "TabControl2loc", Me.TabControl2.Left & "," & Me.TabControl2.Top)
            ini.Write(Secname, "TabControl2size", Me.TabControl2.Width & "," & Me.TabControl2.Height)
            ini.Write(Secname, "GroupBox3loc", Me.GroupBox3.Left & "," & Me.GroupBox3.Top)
            ini.Write(Secname, "GroupBox3size", Me.GroupBox3.Width & "," & Me.GroupBox3.Height)
            ini.Write(Secname, "GroupBox2loc", Me.GroupBox2.Left & "," & Me.GroupBox2.Top)
            ini.Write(Secname, "GroupBox2size", Me.GroupBox2.Width & "," & Me.GroupBox2.Height)
            ini.Write(Secname, "cmb_styleloc", Me.cmb_style.Left & "," & Me.cmb_style.Top)
            ini.Write(Secname, "cmb_stylesize", Me.cmb_style.Width & "," & Me.cmb_style.Height)
            ini.Write(Secname, "ToolStrip2loc", Me.ToolStrip2.Left & "," & Me.ToolStrip2.Top)
            ini.Write(Secname, "mesize", Me.Width & "," & Me.Height)
        Else   '//여기는 읽는 부분
            If Me.cmb_landscape.SelectedIndex = 0 Then '//세로
                Me.pDoc.DefaultPageSettings.Landscape = False
                TableLayoutPanel1.Location = New Point(ini.Read(Secname, "tablelayoutpanel1loc", "0,31").Split(",")(0), ini.Read(Secname, "tablelayoutpanel1loc", "0,31").Split(",")(1))
                TableLayoutPanel1.Size = New Size(ini.Read(Secname, "tablelayoutpanel1size", "297,522").Split(",")(0), ini.Read(Secname, "tablelayoutpanel1size", "297,522").Split(",")(1))
                PictureBox1.Location = New Point(ini.Read(Secname, "PictureBox1loc", "3,3").Split(",")(0), ini.Read(Secname, "PictureBox1loc", "3,3").Split(",")(1))
                PictureBox1.Size = New Size(ini.Read(Secname, "PictureBox1size", "270,479").Split(",")(0), ini.Read(Secname, "PictureBox1size", "270,479").Split(",")(1))
                TabControl1.Location = New Point(ini.Read(Secname, "TabControl1loc", "303,34").Split(",")(0), ini.Read(Secname, "TabControl1loc", "303,34").Split(",")(1))
                TabControl1.Size = New Size(ini.Read(Secname, "TabControl1size", "279,519").Split(",")(0), ini.Read(Secname, "TabControl1size", "279,519").Split(",")(1))
                TabControl2.Location = New Point(ini.Read(Secname, "TabControl2loc", "16,246").Split(",")(0), ini.Read(Secname, "TabControl2loc", "16,246").Split(",")(1))
                'TabControl2.Size = New Size(ini.Read(Secname, "TabControl2size", "239,228").Split(",")(0), ini.Read(Secname, "TabControl2size", "239,228").Split(",")(1))
                GroupBox3.Location = New Point(ini.Read(Secname, "GroupBox3loc", "11,368").Split(",")(0), ini.Read(Secname, "GroupBox3loc", "11,368").Split(",")(1))
                GroupBox3.Size = New Size(ini.Read(Secname, "GroupBox3size", "246,78").Split(",")(0), ini.Read(Secname, "GroupBox3size", "246,78").Split(",")(1))
                GroupBox2.Location = New Point(ini.Read(Secname, "GroupBox2loc", "11,170").Split(",")(0), ini.Read(Secname, "GroupBox2loc", "11,170").Split(",")(1))
                GroupBox2.Size = New Size(ini.Read(Secname, "GroupBox2size", "245,192").Split(",")(0), ini.Read(Secname, "GroupBox2size", "245,192").Split(",")(1))
                cmb_style.Location = New Point(ini.Read(Secname, "cmb_styleloc", "11,18").Split(",")(0), ini.Read(Secname, "cmb_styleloc", "11,18").Split(",")(1))
                cmb_style.Size = New Size(ini.Read(Secname, "cmb_stylesize", "245,146").Split(",")(0), ini.Read(Secname, "cmb_stylesize", "245,146").Split(",")(1))
                ToolStrip2.Location = New Point(ini.Read(Secname, "ToolStrip2loc", "3,451").Split(",")(0), ini.Read(Secname, "ToolStrip2loc", "3,451").Split(",")(1))
                Me.Size = New Size(ini.Read(Secname, "mesize", "588,632").Split(",")(0), ini.Read(Secname, "mesize", "588,632").Split(",")(1))
            Else
                Me.pDoc.DefaultPageSettings.Landscape = True
                TableLayoutPanel1.Location = New Point(ini.Read(Secname, "tablelayoutpanel1loc", "0,31").Split(",")(0), ini.Read(Secname, "tablelayoutpanel1loc", "0,31").Split(",")(1))
                TableLayoutPanel1.Size = New Size(ini.Read(Secname, "tablelayoutpanel1size", "710,292").Split(",")(0), ini.Read(Secname, "tablelayoutpanel1size", "710,292").Split(",")(1))
                PictureBox1.Location = New Point(ini.Read(Secname, "PictureBox1loc", "325,3").Split(",")(0), ini.Read(Secname, "PictureBox1loc", "325,3").Split(",")(1))
                PictureBox1.Size = New Size(ini.Read(Secname, "PictureBox1size", "355,200").Split(",")(0), ini.Read(Secname, "PictureBox1size", "355,200").Split(",")(1))
                TabControl1.Location = New Point(ini.Read(Secname, "TabControl1loc", "3,326").Split(",")(0), ini.Read(Secname, "TabControl1loc", "3,326").Split(",")(1))
                TabControl1.Size = New Size(ini.Read(Secname, "TabControl1size", "711,228").Split(",")(0), ini.Read(Secname, "TabControl1size", "711,228").Split(",")(1))
                TabControl2.Location = New Point(ini.Read(Secname, "TabControl2loc", "265,1").Split(",")(0), ini.Read(Secname, "TabControl2loc", "265,1").Split(",")(1))
                'TabControl2.Size = New Size(ini.Read(Secname, "TabControl2size", "239,228").Split(",")(0), ini.Read(Secname, "TabControl2size", "239,228").Split(",")(1))
                GroupBox3.Location = New Point(ini.Read(Secname, "GroupBox3loc", "513,6").Split(",")(0), ini.Read(Secname, "GroupBox3loc", "513,6").Split(",")(1))
                GroupBox3.Size = New Size(ini.Read(Secname, "GroupBox3size", "184,78").Split(",")(0), ini.Read(Secname, "GroupBox3size", "184,78").Split(",")(1))
                GroupBox2.Location = New Point(ini.Read(Secname, "GroupBox2loc", "262,6").Split(",")(0), ini.Read(Secname, "GroupBox2loc", "262,6").Split(",")(1))
                GroupBox2.Size = New Size(ini.Read(Secname, "GroupBox2size", "245,192").Split(",")(0), ini.Read(Secname, "GroupBox2size", "245,192").Split(",")(1))
                cmb_style.Location = New Point(ini.Read(Secname, "cmb_styleloc", "11,18").Split(",")(0), ini.Read(Secname, "cmb_styleloc", "11,18").Split(",")(1))
                cmb_style.Size = New Size(ini.Read(Secname, "cmb_stylesize", "245,139").Split(",")(0), ini.Read(Secname, "cmb_stylesize", "245,139").Split(",")(1))
                ToolStrip2.Location = New Point(ini.Read(Secname, "ToolStrip2loc", "3,159").Split(",")(0), ini.Read(Secname, "ToolStrip2loc", "3,159").Split(",")(1))
                Me.Size = New Size(ini.Read(Secname, "mesize", "730,643").Split(",")(0), ini.Read(Secname, "mesize", "730,643").Split(",")(1))
            End If
        End If
    End Sub

    Public Sub SAVE_PATTERNII(ByVal labels() As MyControlOLEDBv2.MyLabel, ByVal SRCSTR As String, ExceptH As Boolean, Optional ByVal LOGFILENAME As String = "\패턴.TXT", Optional ByVal BlineNum As String = "")   '패턴을 저장합니다. 패턴역시 위치/크기/장평등이 저장됩니다.
        Dim Arinini As New MyINI2(drstyle.File)
        Dim BUF() As Char = SRCSTR.ToCharArray
        Dim mb As String = PATTERN_ENC(SRCSTR, ExceptH)
        Dim MidName As String = labels(0).Pattern
        If BlineNum <> "" Then MidName = "LNUM" & BlineNum & MidName
        '선로명 패턴 저장
        Dim TOBJ As MyControlOLEDBv2.MyLabel
        Dim Pname As String = MidName & "II" & mb.ToString

        WLog2(Auto_Log, " save_pattern2 를 실행한다.", "\지중(케이블라벨)순차로그.txt")
        For i As Integer = 0 To labels.GetUpperBound(0)
            TOBJ = labels(i)
            WLog2(Auto_Log, MidName & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
            Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MidName)
            WLog2(Auto_Log, "최종선택완료=" & Pname & "      " & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
            Arinini.Write(Pname, TOBJ.Name & "pos", TOBJ.Left & "," & TOBJ.Top & "," & TOBJ.Width & "," & TOBJ.Height)
            Arinini.Write(Pname, TOBJ.Name & "font", TOBJ.MyFont.Name & "," & TOBJ.MyFont.Size & "," & TOBJ.MyFont.Underline & "," & TOBJ.MyFont.Bold & "," & TOBJ.MyFont.Italic & "," & TOBJ.장평 & "," & TOBJ.장높이)
            Arinini.Write(Pname, TOBJ.Name & "visible", TOBJ.Visible)
            Arinini.Write(Pname, TOBJ.Name & "space", TOBJ.공백)
            Arinini.Write(Pname, TOBJ.Name & "repeat", TOBJ.Repeat & "," & TOBJ.RepeatX & "," & TOBJ.RepeatY)  '//반복출력정보저장
        Next
        Arinini.Write(Pname, "LineType", Me.tb_ntype.Text)
        Arinini.Write(Pname, "nseparate", Me.cmb_sep.SelectedIndex)
        WLog2(Auto_Log, "save_patter2 ㅔ서 데이터테이블 갱신을 ㅎ호출한다ㅣㅣ ", "\지중(케이블라벨)순차로그.txt")
        Me.데이터테이블갱신()
    End Sub



    '---------------------------------
    Public Function PARSE(ByVal srcstr As String, ByVal Mylabels() As MyControlOLEDBv2.MyLabel) As Boolean
        '/선로명의 길이는 예측되지 않는다 동적 컨트롤 생성을 사용한다.
        ' MsgBox("PARSET_관리구")
        Me.CLEAR_ITEM(Mylabels)
        Dim Log As String = "\Parse_" & Mylabels(0).Name & ".txt"
        If srcstr = "" OrElse Not Mylabels(0).CheckBox.Checked Then
            WLog2(Auto_Log, "Zero Length - Return", Log)
            Return False
        End If
        WLog2(Auto_Log, "pase 시작", Log)

        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SRC() As Char = srcstr.ToCharArray

        WLog2(Auto_Log, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        If Mylabels.GetUpperBound(0) = 0 Then
            Mylabels(0).MyText = srcstr
            Mylabels(0).Visible = True
        Else
            For i As Integer = 0 To Wlen - 1   '//모든문자를 할당한다.
                Try
                    Select Case SRC(i)
                        Case ";"
                            Mylabels(i).MyText = "---"
                            Mylabels(i).Visible = True
                        Case ":"
                            Mylabels(i).MyText = ""
                            Mylabels(i).Visible = True
                        Case Else
                            Mylabels(i).MyText = SRC(i)
                            Mylabels(i).Visible = True
                    End Select
                Catch ex As Exception
                    Exit For
                End Try
            Next
        End If
        Return True
    End Function

    Public Sub PARSE_PATTERN(ByVal Srcstr As String, ByVal labels() As MyControlOLEDBv2.MyLabel, Optional ByVal BlineNum As String = "")
        Dim Wlen As Short = Srcstr.Length : If Wlen <= 0 Then Return '//없는 글귀가 왓을때 턴해버린다.
        Dim Log As String = "\PATTERN_" & labels(0).Name & ".txt"
        '//먼저패턴이 존재하는지 확인해본다.
        '길이패턴여부를 확인했으므로 패턴을적용한다.[STYLE1LINEPATTERN9]
        Dim Pname As String = labels(0).Pattern & Wlen
        If BlineNum <> "" Then '//줄그룹
            '  Me.길이패턴연습(Srcstr, "LNUM" & BlineNum & Pname, Log, labels(0).Tag, labels)
            Pname = labels(0).Pattern & "II" & PATTERN_ENC(Srcstr, True)
            If Not Me.문자패턴연습(Srcstr, "LNUM" & BlineNum & Pname, Log, labels) Then
                Pname = labels(0).Pattern & "II" & PATTERN_ENC(Srcstr)
                Me.문자패턴연습(Srcstr, "LNUM" & BlineNum & Pname, Log, labels)
            End If
        Else
            ' Me.길이패턴연습(Srcstr, Pname, Log, labels(0).Tag, labels)
            Pname = labels(0).Pattern & "II" & PATTERN_ENC(Srcstr, True)
            If Not Me.문자패턴연습(Srcstr, Pname, Log, labels) Then
                Pname = labels(0).Pattern & "II" & PATTERN_ENC(Srcstr)
                Me.문자패턴연습(Srcstr, Pname, Log, labels)
            End If
        End If
        '//패턴1이 끝났다 패턴2를 찾는다.
        '//패턴2는 style1LInepatternII문자숫자형식
    End Sub


    Private Sub cmb_controls_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_controls.SelectedIndexChanged
        '//개체가 선택되면 해당 개체의 내역을 보여준다.
        'Me.Timer1.Enabled = False
        WLog2(Auto_Log, "개체목록 콤보박스에서 특정 개체가 선택되었다 view property 호출", "\가로등순차로그.txt")
        ViewProperty(AllLabels(Me.cmb_controls.SelectedIndex).ctl)
    End Sub
    Private Sub cb_visible_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_visible.CheckedChanged
        WLog2(Auto_Log, "표시 체크박스 선택 ", "\가로등순차로그.txt")
        For Each a As Control In SelCon
            a.Visible = Me.cb_visible.Checked
        Next
        WLog2(Auto_Log, "[표시] 체크박스 선택에서 pewview를 호출 ", "\가로등순차로그.txt")
        Me.preview_window()
    End Sub
    Private Sub tb_foncol_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb_foncol.DoubleClick
        WLog2(Auto_Log, " 글씨색깔 변경 클릭됨", "\가로등순차로그.txt")
        Dim A As New ColorDialog
        If A.ShowDialog() = Windows.Forms.DialogResult.OK Then
            For Each Onlyone As MyControlOLEDBv2.MyLabel In SelCon
                Onlyone.MyForeColor = A.Color
            Next
            Me.tb_foncol.BackColor = A.Color
        End If
        Me.preview_window()
    End Sub
    Private Sub cb_bold_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_bold.CheckedChanged
        WLog2(Auto_Log, "글씨꿁게 선택됨 setfont 호출 ", "\가로등순차로그.txt")
        SetFont()
    End Sub
    Private Sub UpdateFontSize(ByVal newsize As Integer, Optional ByVal Src As MyControlOLEDBv2.MyLabel = Nothing) '
        WLog2(Auto_Log, "updatefont :  ", "\가로등순차로그.txt")
        Dim A As Font
        For Each Tobj As MyControlOLEDBv2.MyLabel In SelCon
            A = New Font(Tobj.MyFont.FontFamily, newsize, FontStyle.Regular, GraphicsUnit.Point)
            Tobj.MyFont = A
        Next
        Me.SetFont()
    End Sub
    Public Sub CtrSize(ByVal vertical As Boolean, ByVal offset As Short)
        If SelCon Is Nothing OrElse SelCon.Count < 1 Then Exit Sub

        For Each sender As MyControlOLEDBv2.MyLabel In SelCon
            If vertical Then    '//상하
                If My.Computer.Keyboard.AltKeyDown Then
                    If offset < 0 Then
                        sender.장높이 -= 1
                    Else
                        sender.장높이 += 1
                    End If
                ElseIf My.Computer.Keyboard.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.장높이 -= 10
                    Else
                        sender.장높이 += 10
                    End If
                Else
                    sender.장높이 += offset
                End If
            Else    '//좌우
                If My.Computer.Keyboard.AltKeyDown Then
                    If offset < 0 Then
                        sender.장평 -= 1
                    Else
                        sender.장평 += 1
                    End If
                ElseIf My.Computer.Keyboard.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.장평 -= 10
                    Else
                        sender.장평 += 10
                    End If
                Else
                    sender.장평 += offset
                End If
            End If
        Next

        Me.preview_window()
    End Sub
    Public Sub LOAD_STYLEC(ByVal StyleName As String, ByVal Div As String)
        '//기타스타일은 빈도가 적으니 파일에서 불러오기로한다.;;메모리는 싫타.
        Dim Arinini As New MyINI2(FileC)
        If Not IO.File.Exists(FileC) Then
            MsgBox("기타스타일설정 파일이 존재하지 않습니다\n\n관리자에 문의하세요", MsgBoxStyle.Critical, "오류")
            Return
        End If
        Dim pos(), font(), visible As String '//구전산번호를 구현해본다.
        Dim Tobj As MyControlOLEDBv2.MyLabel

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            Tobj = Me.AllLabels(i).ctl
            Try
                If Div.ToUpper = "Z" Then '//모든아이템을 가져오고
                    pos = Arinini.Read(StyleName, Tobj.Name & "pos").Split(",")
                    font = Arinini.Read(StyleName, Tobj.Name & "font").Trim(Chr(0)).Split(",")
                    visible = Arinini.Read(StyleName, Tobj.Name & "visible")
                    '//상태를 읽어서 바로 적용한다.
                    Tobj.Location = New Point(pos(0), pos(1))
                    Tobj.Size = New Size(pos(2), pos(3))
                    Tobj.MyFont = New Font(font(0), font(1), IIf(font(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                    Tobj.장평 = font(5)
                    Tobj.장높이 = font(6)
                    Tobj.공백 = Arinini.Read(StyleName, Tobj.Name & "space", 0)
                    Tobj.Visible = CType(visible, Boolean)
                Else '이곳에 O가올것이다.
                    If Tobj.Name.ToUpper.Substring(0, 1) = Div Then
                        pos = Arinini.Read(StyleName, Tobj.Name & "pos").Split(",")
                        font = Arinini.Read(StyleName, Tobj.Name & "font").Trim(Chr(0)).Split(",")
                        visible = Arinini.Read(StyleName, Tobj.Name & "visible")
                        '//상태를 읽어서 바로 적용한다.
                        Tobj.Location = New Point(pos(0), pos(1))
                        Tobj.Size = New Size(pos(2), pos(3))
                        Tobj.MyFont = New Font(font(0), font(1), IIf(font(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                        Tobj.장평 = font(5)
                        Tobj.장높이 = font(6)
                        Tobj.공백 = Arinini.Read(StyleName, Tobj.Name & "space", 0)
                        Tobj.Visible = CType(visible, Boolean)
                    End If
                End If
            Catch ex As Exception
                WLog2(Auto_Log, "LOAD_STYLE_CUSTOM 오류:" & ex.Message.ToString, "LOAD_STYLEC")
            End Try
        Next
        NOTICE(StyleName & "기타스타일을 불러왔습니다.", Me.lb_msg)
        Me.preview_window()
    End Sub
    Public Sub SAVE_STYLEC(ByVal stylename As String, ByVal div As String) '//기타스타일 저장한다.
        Dim Arinini As New MyINI2(FileC)
        '//현재 선택된 스타일을 저장합니다.
        Arinini.Write(stylename, "DESC", stylename)
        Dim Tobj As MyControlOLEDBv2.MyLabel

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            Tobj = Me.AllLabels(i).ctl
            Arinini.Write(stylename, Tobj.Name & "pos", Tobj.Left & "," & Tobj.Top & "," & Tobj.Width & "," & Tobj.Height)
            Arinini.Write(stylename, Tobj.Name & "font", Tobj.MyFont.Name & "," & Tobj.MyFont.Size & "," & Tobj.MyFont.Underline & "," & Tobj.MyFont.Bold & "," & Tobj.MyFont.Italic & "," & Tobj.장평 & "," & Tobj.장높이)
            Arinini.Write(stylename, Tobj.Name & "visible", Tobj.Visible)
            Arinini.Write(stylename, Tobj.Name & "space", Tobj.공백)
        Next
        NOTICE("기타스타일을 저장했습니다", Me.lb_msg)
    End Sub
    Private Sub Button30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button30.Click
        Me.CtrSize(False, -5)
    End Sub
    Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button29.Click
        Me.CtrSize(False, 5)
    End Sub
    Private Sub Button32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button32.Click
        Me.CtrSize(True, -5)
    End Sub
    Private Sub Button31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button31.Click
        Me.CtrSize(True, 5)
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Me.CtrPos(False, -5)
    End Sub
    Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.CtrPos(False, 5)
    End Sub
    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        Me.CtrPos(True, -5)
    End Sub
    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        Me.CtrPos(True, 5)
    End Sub
    Private Sub BindingNavigatorPositionItem_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles BindingNavigatorPositionItem.KeyUp
        '//현재위치에서 엔터켯을경우 데이터베이스 위치값을 변경한다.(position)
        If e.KeyCode = Keys.Enter Then
            If IsNumeric(Me.BindingNavigatorPositionItem.Text) Then Me.GeTviewData(Me.BindingNavigatorPositionItem.Text - 1, True)
        End If
    End Sub
    Private Sub NPartternCheck()
        Dim 번호패턴검사 As Integer = 0

        '//패턴검사시작
        ' Me.PictureBox1.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\image\start.png")


        Dim endcnt As Integer = Me.textbox2.Text

        For i As Integer = Me.textbox1.Text To Me.textbox2.Text
            '  If chkFlag Then Exit For
            showcnt(i, endcnt, "패턴검사중")
            Me.textbox1.Text = i
            번호패턴검사 = ChkNumPattern(i)
            '  MsgBox(번호패턴검사)

            If 번호패턴검사 = 0 Then    '1은 길이패턴이 없고 3이나 2는 문자패턴이다
                NOTICE("일련번호=" & i + 1 & "번 문자,길이 패턴이 존재하지 않습니다", Me.lb_msg)
                My.Computer.Audio.Play(My.Application.Info.DirectoryPath & "\sound\ding.wav", AudioPlayMode.Background)
                'If MsgBox("Sdf", MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
                Me.BindingSource1.Position = i
                Exit For
            End If
        Next
        If Me.textbox1.Text = Me.textbox2.Text Then  '//완료되었다면
            My.Computer.Audio.Play(My.Application.Info.DirectoryPath & "\sound\notify.wav", AudioPlayMode.Background)
            NOTICE("패턴검사가 완료되었습니다", Me.lb_msg)
        End If
        Me.bt_chkpattern.Text = "시작(&S)"
    End Sub
    Private Sub showcnt(ByVal cnt1 As Integer, ByVal cnt2 As Integer, Optional ByVal tag As String = "")
        Me.lb_msg.Text = cnt1 & "/" & cnt2 & Space(1) & tag
        My.Application.DoEvents()
    End Sub
    Private Sub tb_printrange_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb_printrange.TextChanged
        If Me.rad_repeat.Checked = False Then Me.RadioButton3.Checked = True
    End Sub

    Private Sub cmb_landscape_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_landscape.SelectedIndexChanged
        Me.SaveReadLayOut(True)
    End Sub

    Private Sub GetPrintersName()
        WLog2(Auto_Log, "GetPrinterName()", "\정액등순차로그.txt")
        Dim value As PrinterSettings.StringCollection = System.Drawing.Printing.PrinterSettings.InstalledPrinters
        Me.combobox5.Items.Clear()
        For i As Integer = 0 To value.Count - 1
            Me.combobox5.Items.Add(value(i))
        Next
    End Sub


    Private Sub printform_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
        If e.Delta < 0 Then
            'If Me.BindingNavigatorPositionItem.Text < Me.BindingNavigatorCountItem.Text Then
            Me.BindingNavigatorMoveNextItem.PerformClick()
            Me.BindingNavigatorPositionItem.Focus()
            'End If
        Else
            If Me.BindingNavigatorPositionItem.Text > 0 Then
                Me.BindingNavigatorMovePreviousItem.PerformClick()
                Me.BindingNavigatorPositionItem.Focus()
            End If

        End If
    End Sub

    Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Me.Text = e.X & "/" & e.Y
    End Sub


    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_chkpattern.Click
        If Me.bt_chkpattern.Text = "중지(&S)" Then
            ' If BackWork.IsAlive Then BackWork.Abort()
            Me.bt_chkpattern.Text = "시작(&S)"
        Else
            Me.bt_chkpattern.Text = "중지(&S)"
            'BackWork = New Threading.Thread(AddressOf NPartternCheck)
            'BackWork.Start()
            NPartternCheck()
        End If

    End Sub


    Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Me.SetFont()
        If Not IsNumeric(Me.tb_space.Text) Then
            MsgBox("숫자만 입력하세요", MsgBoxStyle.Critical, "확인")
            Return
        End If
        For Each A As Control In SelCon
            CType(A, MyControlOLEDBv2.MyLabel).공백 = CInt(Me.tb_space.Text)
            'Me.UpdateFontSize(Me.tb_space.Text, A)
        Next
        Me.preview_window()
    End Sub

    Private Sub tb_picfile_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb_picfile.TextChanged
        If Not IO.File.Exists(Me.tb_picfile.Text) Then
            Me.erp.SetError(Me.tb_picfile, "그림파일이 존재하지 않습니다")
        Else
            Me.erp.SetError(Me.tb_picfile, "")
        End If
    End Sub

    Private Sub bt_canvasL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_canvasL.Click
        Me.PictureBox1.Width -= 2
    End Sub

    Private Sub bt_canvasR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_canvasR.Click
        Me.PictureBox1.Width += 2
    End Sub

    Private Sub bt_canvasU_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_canvasU.Click
        Me.PictureBox1.Height -= 2
    End Sub

    Private Sub bt_canvasD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_canvasD.Click
        Me.PictureBox1.Height += 2
    End Sub

    Private Sub tb_space_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Enter Then Me.Button3.PerformClick()
    End Sub

    Private Sub preview_window()    '//미리보기화면을 생성합니다.

        Dim MyFont As Font
        Dim NewFontSize As Int16 = 10
        Dim dummy As Boolean = False    '//이값이 true 이면 출력시 변위를 지정해서 출력한다.
        Dim BackScr As New Bitmap(Me.PictureBox1.Width, Me.PictureBox1.Height, Me.PictureBox1.CreateGraphics)
        Dim Ga As Graphics = Graphics.FromImage(BackScr)
        Dim Brush As SolidBrush
        Dim obj As MyControlOLEDBv2.MyLabel


        '페이지 구분을 이해하고 몇개를 찍을지 결정한다.
        'Debug.Print("프린터인덱스=" & Me.printindex)
        'Debug.Print("프린터배열=" & Me.PrintArray.GetUpperBound(0))

        ' If Me.printindex <> -1 Then Me.GeTviewData(Me.PrintArray(Me.printindex)) '//페이지를 갱신하고 출력을 시작한다.
        'Dummyflag:  '//--2장출력일경우 이부분에서 다시 시작한다.

        'If Not Me.PictureBox1.BackgroundImage Is Nothing Then
        ' Ga.DrawImage(Me.PictureBox1.BackgroundImage, 0, 0, Me.PictureBox1.Width, Me.PictureBox1.Height)
        ' End If

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)   '//모든 개체들에 대해서 인쇄를 설정한다.
            obj = Me.AllLabels(i).ctl
            If obj.Visible AndAlso obj.MyText <> "" Then   '//화면에 보이는것만 한다.                
                NewFontSize = obj.MyFont.Size + Me.tb_myfontsize.Text
                If NewFontSize < 0 Then NewFontSize = 0
                Brush = New SolidBrush(obj.MyForeColor) '//전경색으로 브러쉬를 만든다.

                MyFont = New Font(obj.MyFont.FontFamily, NewFontSize, obj.MyFont.Style)
                If obj.장평 = 100 AndAlso obj.장높이 = 100 Then '//장평미사용 문자열 처리
                    'Ga.RotateTransform(45)
                    Ga.DrawString(obj.최종문자, MyFont, Brush, obj.Location)
                Else    '//장평사용 이미지 처리
                    Dim NewX, Newy As Integer
                    Dim SrcDpix, SrcDPiY As Single
                    'MsgBox(Tobj.장높이)
                    SrcDpix = obj.CreateGraphics.DpiX
                    SrcDPiY = obj.CreateGraphics.DpiY

                    NewX = obj.GetSize(MyFont).Width * (obj.장평 / 100) * (Ga.DpiX / SrcDpix)
                    Newy = obj.GetSize(MyFont).Height * (obj.장높이 / 100) * (Ga.DpiY / SrcDPiY)

                    Dim BMP As New Bitmap(NewX, Newy, Ga)
                    Dim G As Graphics = Graphics.FromImage(BMP)

                    G.ResetTransform()
                    G.ScaleTransform((obj.장평 / 100), (obj.장높이 / 100))
                    G.DrawString(obj.최종문자, MyFont, Brush, 0, 0)
                    G.Dispose()
                    Ga.DrawImage(BMP, New Point(obj.Left, obj.Top)) ', CInt(GetSize.Width * (v장평 / 100)), GetSize.Height)
                    'Ga.RotateTransform(20



                End If
            End If
        Next

        If Me.cb_dummy.Checked Then '//복사가 선택되어있으며 ㄴ한번더 출력한다.
            For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)   '//모든 개체들에 대해서 인쇄를 설정한다.
                obj = Me.AllLabels(i).ctl
                If obj.Visible AndAlso obj.MyText <> "" Then   '//화면에 보이는것만 한다.                
                    NewFontSize = obj.MyFont.Size + Me.tb_myfontsize.Text
                    If NewFontSize < 0 Then NewFontSize = 0
                    Brush = New SolidBrush(obj.MyForeColor) '//전경색으로 브러쉬를 만든다.

                    MyFont = New Font(obj.MyFont.FontFamily, NewFontSize, obj.MyFont.Style)
                    If obj.장평 = 100 AndAlso obj.장높이 = 100 Then '//장평미사용 문자열 처리
                        Ga.DrawString(obj.최종문자, MyFont, Brushes.Gray, (obj.Left + Me.tb_secX.Text), (obj.Top + Me.tb_secY.Text))
                    Else    '//장평사용 이미지 처리
                        Dim NewX, Newy As Integer
                        Dim SrcDpix, SrcDPiY As Single
                        'MsgBox(Tobj.장높이)
                        SrcDpix = obj.CreateGraphics.DpiX
                        SrcDPiY = obj.CreateGraphics.DpiY

                        NewX = obj.GetSize(MyFont).Width * (obj.장평 / 100) * (Ga.DpiX / SrcDpix)
                        Newy = obj.GetSize(MyFont).Height * (obj.장높이 / 100) * (Ga.DpiY / SrcDPiY)
                        Dim BMP As New Bitmap(NewX, Newy, Ga)
                        Dim G As Graphics = Graphics.FromImage(BMP)

                        G.ResetTransform()
                        G.ScaleTransform((obj.장평 / 100), (obj.장높이 / 100))
                        G.DrawString(obj.최종문자, MyFont, Brushes.Gray, 0, 0)
                        G.Dispose()
                        Ga.DrawImage(BMP, CSng(obj.Left + Me.tb_secX.Text), CSng(obj.Top + Me.tb_secY.Text)) ', CInt(GetSize.Width * (v장평 / 100)), GetSize.Height)
                    End If
                End If
            Next
        End If


        Ga.Dispose()
        Me.PictureBox1.Image = BackScr
    End Sub


    Private Sub cb_bold_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
        SetFont()
    End Sub


    Private Sub Button1_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If SelCon Is Nothing Then Return

        Dim B As New FontDialog
        B.Font = CType(SelCon(0), MyControlOLEDBv2.MyLabel).MyFont
        If B.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return

        For Each a As MyControlOLEDBv2.MyLabel In SelCon
            a.MyFont = B.Font
        Next
        Me.ViewProperty(CType(SelCon(0), MyControlOLEDBv2.MyLabel))
        Me.preview_window()
    End Sub

    Private Sub TextBox3_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_left.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button5.PerformClick()
    End Sub



    Private Sub TextBox4_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_top.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button9.PerformClick()
    End Sub



    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

        For Each A As Control In SelCon
            A.Top = IIf(IsNumeric(Me.tb_top.Text), Val(Me.tb_top.Text), A.Top)
        Next
        Me.preview_window()
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

        If Not IsNumeric(Me.tb_wordwidth.Text) Then Return
        For Each A As Control In SelCon
            'Me.UpdateFontWidth(CType(A, MyControlOLEDBv2.MyLabel).장평 - Val(Me.tb_pixelsize.Text))
            CType(A, MyControlOLEDBv2.MyLabel).장평 = CInt(Me.tb_wordwidth.Text)
            ViewProperty(A)
        Next
        Me.preview_window()

    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        If Not IsNumeric(Me.tb_wordheight.Text) Then Return

        For Each A As Control In SelCon
            'Me.UpdateFontWidth(CType(A, MyControlOLEDBv2.MyLabel).장평 - Val(Me.tb_pixelsize.Text))
            CType(A, MyControlOLEDBv2.MyLabel).장높이 = CInt(Me.tb_wordheight.Text)
            ViewProperty(A)
        Next
        Me.preview_window()
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        If Not IsNumeric(Me.tb_fsize.Text) Then
            MsgBox("숫자만 입력하세요", MsgBoxStyle.Critical, "확인")
            Return
        End If
        For Each A As Control In SelCon
            Me.UpdateFontSize(Me.tb_fsize.Text, A)
        Next
        Me.preview_window()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        For Each A As Control In SelCon
            A.Left = IIf(IsNumeric(Me.tb_left.Text), Val(Me.tb_left.Text), A.Left)
        Next
        Me.preview_window()
    End Sub

    Private Sub TextBox5_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_wordwidth.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button10.PerformClick()
    End Sub


    Private Sub TextBox6_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_wordheight.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button11.PerformClick()
    End Sub



    Private Sub TextBox7_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_fsize.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button12.PerformClick()
    End Sub


    Private Sub TextBox8_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_space.KeyUp, TextBox3.KeyUp
        If e.KeyCode = Keys.Enter Then Me.Button3.PerformClick()
    End Sub



    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If SelCon Is Nothing Then Return
        Dim B As New FontDialog
        B.Font = CType(SelCon(0), MyControlOLEDBv2.MyLabel).MyFont
        For Each a As MyControlOLEDBv2.MyLabel In SelCon
            a.MyFont = B.Font
        Next
        Me.ViewProperty(CType(SelCon(0), MyControlOLEDBv2.MyLabel))
        Me.preview_window()
    End Sub


    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.preview_window()
    End Sub

    Private Sub BindingSource1_PositionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles BindingSource1.PositionChanged
        'MsgBox("BindingSource1_PositionChanged=" & Now.ToString & "current=" & Me.BindingNavigatorPositionItem.Text & "mnoview=" & NoView)
        Debug.Print("BindingSource1_PositionChanged : " & Me.BindingSource1.Position)
        Debug.Print("스크롤바값 범위값 " & Me.VScrollBar1.Minimum & "/" & Me.VScrollBar1.Maximum)
        If Me.BindingSource1.Position >= 0 Then Me.VScrollBar1.Value = Me.BindingSource1.Position
        If Me.NoView Then
            Me.NoView = False
        Else
            Me.GeTviewData(Me.BindingNavigatorPositionItem.Text - 1, True)
        End If

    End Sub

    Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
        Debug.Print("Scroll Old:" & e.OldValue & "/ New :" & e.NewValue & "/ Current : " & Me.VScrollBar1.Value)
        Debug.Print("스크롤바값 범위값 " & Me.VScrollBar1.Minimum & "/" & Me.VScrollBar1.Maximum)
        If e.NewValue > 0 Then
            Me.BindingSource1.Position = e.NewValue
        Else
            Debug.Print("스크롤바value값이 0보다 작습니다. 소스의 위치를 0으로 설정합니다")
            Me.BindingSource1.Position = 0
        End If
    End Sub

    Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
        Dim Tobj As MyControlOLEDBv2.MyLabel
        Dim selitem As New ArrayList

        Tobj = Nothing

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            If Me.AllLabels(i).ctl.Visible AndAlso Me.AllLabels(i).ctl.MyText <> "" AndAlso _
                ((e.X >= Me.AllLabels(i).ctl.Left) And e.X <= (Me.AllLabels(i).ctl.Left + Me.AllLabels(i).ctl.GetSize.Width)) _
                AndAlso ((e.Y >= Me.AllLabels(i).ctl.Top) AndAlso (e.Y <= (Me.AllLabels(i).ctl.Top + Me.AllLabels(i).ctl.GetSize.Height))) Then
                Tobj = Me.AllLabels(i).ctl
                selitem.Add(Me.AllLabels(i).ctl)
                'Exit For
            End If
        Next

        If Tobj Is Nothing Then Return '//선택된게 없으면 날린다

        'If Me.chk_multisel.Checked Then '//다중목록에서 선택시가 체크되어있으면 목록을 표시해준다.
        If selitem.Count > 1 Then
            Dim A As New selitem
            For si As Short = 1 To selitem.Count
                A.ListBox1.Items.Add(CType(selitem.Item(si - 1), MyControlOLEDBv2.MyLabel).설명)
            Next
            If A.ShowDialog() = Windows.Forms.DialogResult.OK Then
                Tobj = selitem.Item(A.ListBox1.SelectedIndex)
            Else   '//캔슬시에는 첫번째 아템으로 한다.
                Tobj = selitem.Item(0)
            End If
        End If
        'End If

        Dim Exist As Boolean = False   '//선택개체에 존재여부
        If SelCon Is Nothing Then
            SelCon.Add(Tobj)
        Else
            If e.Button = Windows.Forms.MouseButtons.Right Then
                For Each obj As MyControlOLEDBv2.MyLabel In SelCon
                    If obj.Name = Tobj.Name Then    '//삭제된다.
                        obj.MyForeColor = Color.Black
                        SelCon.Remove(obj)
                        Exist = True
                        Exit For
                    End If
                Next
                If Exist = False Then
                    SelCon.Add(Tobj)
                    Tobj.MyForeColor = Color.Tomato
                End If
            ElseIf e.Button = Windows.Forms.MouseButtons.Left Then '왼쪽클리이면 지우고 다시 셋팅
                For Each SC As MyControlOLEDBv2.MyLabel In SelCon
                    SC.MyForeColor = Color.Black
                Next
                SelCon.Clear()
                SelCon.Add(Tobj)
                Tobj.MyForeColor = Color.DodgerBlue

                If My.Computer.Keyboard.CtrlKeyDown Then   '//컨트롤이 눌러졋으면 해당 그룹을 전부 찾는다.
                    'MsgBox(Tobj.Name)
                    SelCon.Clear()
                    For z As Short = 0 To Me.AllLabels.GetUpperBound(0)
                        If Me.AllLabels(z).ctl.Name.Substring(0, 1) = Tobj.Name.Substring(0, 1) Then
                            Me.AllLabels(z).ctl.MyForeColor = Color.Blue
                            SelCon.Add(Me.AllLabels(z).ctl)
                        End If
                    Next
                End If

            Else
                Me.Button1.PerformClick()
            End If
        End If
        'onlyOne = sender
        'CType(sender, MyControlOLEDBv2.MyLabel).
        Me.cmb_controls.Text = Tobj.설명
        ViewProperty(Tobj)

        'For Each A As MyControlOLEDBv2.MyLabel In SelCon
        ' A.MyForeColor = Color.DodgerBlue
        '  Next

        Me.tb_left.Focus()
        Me.preview_window()
    End Sub

    Private Sub PictureBox1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDoubleClick
        Dim Tobj As MyControlOLEDBv2.MyLabel
        Tobj = Nothing

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            If Me.AllLabels(i).ctl.Visible AndAlso Me.AllLabels(i).ctl.MyText <> "" AndAlso _
                ((e.X >= Me.AllLabels(i).ctl.Left) And e.X <= (Me.AllLabels(i).ctl.Left + Me.AllLabels(i).ctl.GetSize.Width)) _
                AndAlso ((e.Y >= Me.AllLabels(i).ctl.Top) AndAlso (e.Y <= (Me.AllLabels(i).ctl.Top + Me.AllLabels(i).ctl.GetSize.Height))) Then
                Tobj = Me.AllLabels(i).ctl
                Exit For
            End If
        Next

        If Tobj Is Nothing Then Return '//선택된게 없으면 날린다

        Dim Msg As New System.Text.StringBuilder("변경할 값을 입력하세요")
        Msg.AppendLine("줄바꿈을하려면 \n 을 입력하세요")
        Msg.AppendLine("예) 세로로 12를 출력하려면 1\n2 을 입력하세요")
        Msg.AppendLine()
        Msg.AppendLine("변경한 값은 현재페이지에만 적용됩니다")


        Dim Val As String = InputBox(Msg.ToString, "변경", Tobj.MyText)
        If Val = "" Then Return
        Val = Val.Replace("\n", vbCrLf)
        Tobj.MyText = Val

        Me.preview_window()
    End Sub

    Private Sub cmb_controls_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb_controls.SelectionChangeCommitted
        For Each A As MyControlOLEDBv2.MyLabel In Me.SelCon
            A.MyForeColor = Color.Black
        Next
        SelCon.Clear()
        SelCon.Add(AllLabels(Me.cmb_controls.SelectedIndex).ctl)
        AllLabels(Me.cmb_controls.SelectedIndex).ctl.MyForeColor = Color.DodgerBlue
        ViewProperty(AllLabels(Me.cmb_controls.SelectedIndex).ctl)
        Me.preview_window()
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Me.Close()
    End Sub

    Private Function 문자패턴연습(ByVal srcstr As String, ByVal pname As String, ByVal log As String, ByVal S라벨() As MyControlOLEDBv2.MyLabel) As Boolean
        Dim Wlen As Short = srcstr.Length : If Wlen <= 0 Then Return False '//없는 글귀가 왓을때 턴해버린다.
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim DR() As DataRow
        Dim CTLPOS() As String
        Dim CTLFONT() As String
        Dim CTLVISIBLE As Boolean

        DR = dtpattern.Select("NAME = '" & pname & "DESC'")
        If DR.GetUpperBound(0) = 0 Then '//길이패턴이 있으면
            WLog2(Auto_Log, "문자패턴 검색 길이=" & Wlen & " 구분자위치=" & SepPos & " 미들네임=" & pname, log)
            For Each C As MyControlOLEDBv2.MyLabel In S라벨
                Try
                    DR = dtpattern.Select("NAME = '" & pname & C.Name & "POS'")
                    If DR.GetUpperBound(0) = 0 Then
                        CTLPOS = DR(0)(1).ToString.Split(",")
                        C.Location = New Point(CTLPOS(0), CTLPOS(1))
                        C.Size = New Size(CTLPOS(2), CTLPOS(3))
                    End If

                    DR = dtpattern.Select("NAME = '" & pname & C.Name & "FONT'")
                    If DR.GetUpperBound(0) = 0 Then
                        CTLFONT = DR(0)(1).ToString.Split(",")
                        C.MyFont = New Font(CTLFONT(0), CTLFONT(1), IIf(CTLFONT(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                        C.장평 = CTLFONT(5)
                        C.장높이 = CTLFONT(6)
                    End If

                    DR = dtpattern.Select("NAME = '" & pname & C.Name & "VISIBLE'")
                    If DR.GetUpperBound(0) = 0 Then
                        CTLVISIBLE = DR(0)(1).ToString
                        C.Visible = CType(CTLVISIBLE, Boolean)
                    End If

                    DR = dtpattern.Select("NAME = '" & pname & C.Name & "SPACE'")
                    If DR.GetUpperBound(0) = 0 Then
                        C.공백 = DR(0)(1).ToString
                    End If

                    '//반복정보확인  Arinini.Write(Pname, TOBJ.Name & "repeat", TOBJ.Repeat & "," & TOBJ.RepeatX & "," & TOBJ.RepeatY)  '//반복출력정보저장
                    AddLog(Auto_Log, "반복문자셋트 : " & pname & C.Name & "REPEAT" & "  를 검색합니다")
                    DR = dtpattern.Select("NAME = '" & pname & C.Name & "REPEAT'")
                    If DR.GetUpperBound(0) = 0 Then
                        AddLog(Auto_Log, "해당반복문자를 찾았습니다")
                        CTLFONT = DR(0)(1).ToString.Split(",")
                        AddLog(Auto_Log, "해당반복문자를 콤마로 쪼개어서 CTLFONT 배열에 저장하였습니다.")
                        C.Repeat = CTLFONT(0)
                        AddLog(Auto_Log, "해당반복문자중 0번째위치값을 적용")
                        C.RepeatX = CTLFONT(1)
                        AddLog(Auto_Log, "해당반복문자중 1번째위치값을 적용")
                        C.RepeatY = CTLFONT(2)
                        AddLog(Auto_Log, "해당반복문자중 2번째위치값을 적용")
                        'C.MyFont = New Font(CTLFONT(0), CTLFONT(1), IIf(CTLFONT(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                        ' C.장평 = CTLFONT(5)
                        '  C.장높이 = CTLFONT(6)
                    Else
                        AddLog(Auto_Log, "해당반복문자를 찾지못했습니다.")
                    End If

                    C.Tag = "L"
                Catch ex As Exception
                    WLog2(Auto_Log, "문자패턴오류 길이=" & Wlen & " Message=" & ex.Message.ToString, log)
                End Try
            Next
            Return True
        Else
            WLog2(Auto_Log, "문자패턴불일치 길이=" & Wlen & " 문자열=" & srcstr, log)
            Me.LOAD_STYLE(S라벨(0).DIV)
            Return False
        End If
    End Function

    Private Sub cmb_style_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb_style.SelectionChangeCommitted
        '//스타일을 직접 선택햇을때 기본idx값을 0 으로한다.
        ' MsgBox("스타일직접선택")
        FirstIdx = 0
    End Sub

    Private Sub tb_ntype_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb_ntype.MouseEnter
        Me.tb_ntype.Focus()
        Me.tb_ntype.SelectAll()
    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        If MsgBox("현재 스타일(기본)을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "스타일저장") = MsgBoxResult.Yes Then
            SAVE_STYLE()
        Else
            NOTICE("스타일(기존)저장이 취소되었습니다", Me.lb_msg)
        End If
    End Sub

    Private Sub BindingNavigatorPositionItem_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles BindingNavigatorPositionItem.MouseEnter
        Me.BindingNavigatorPositionItem.Focus()
        Me.BindingNavigatorPositionItem.SelectAll()
    End Sub

    Private Sub ToolStripButton2_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_print.ButtonClick
        Me.Print()
    End Sub

    Private Sub bt_prnpreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_prnpreview.Click
        Me.Print_Preview()
    End Sub

    Private Sub cm_styleedit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cm_styleedit.Click
        StyleEdit.ListIndex = Me.cmb_style.SelectedIndex
        StyleEdit.Path = Me.StyleDir
        StyleEdit.Show()
    End Sub

    Private Sub bt_canvasD_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles bt_canvasD.MouseDown, bt_canvasL.MouseDown, bt_canvasR.MouseDown, bt_canvasU.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Right Then
            Select Case sender.name.ToString.ToUpper
                Case "BT_CANVASD"
                    Me.PictureBox1.Top += 5
                Case "BT_CANVASU"
                    Me.PictureBox1.Top -= 5
                Case "BT_CANVASR"
                    Me.PictureBox1.Left += 5
                Case "BT_CANVASL"
                    Me.PictureBox1.Left -= 5
            End Select
        End If

    End Sub


    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        'Me.Text = e.X & "/" & e.Y

        If My.Computer.Keyboard.CtrlKeyDown = True AndAlso My.Computer.Keyboard.AltKeyDown = True Then
            '//선택된 컨트롤을 마우스위치로 이동한다.
            If SelCon Is Nothing OrElse SelCon.Count < 1 Then Exit Sub
            For Each sender1 As MyControlOLEDBv2.MyLabel In SelCon
                sender1.Left = e.X - (sender1.Width / 2)
                sender1.Top = e.Y + (sender1.Height / 2)
            Next
            Me.preview_window()
        End If
    End Sub
    Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
        If Me.cmb_style.Items.Count < 1 Then
            Me.cm_styleedit.Enabled = False
        End If
    End Sub

    Private Sub yoolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yoolStripMenuItem.Click
        SAVE_PATTERNII(Me.S고객번호, Me.고객번호, False, "\고객번호패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub fyripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles fyripMenuItem.Click
        SAVE_PATTERNII(Me.S관리번호1, Me.관리번호1, False, "\관리번호1패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub dfgdfoolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dfgdfoolStripMenuItem.Click
        SAVE_PATTERNII(Me.S관리번호2, Me.관리번호2, False, "\관리번호2패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub fdaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles fdaToolStripMenuItem.Click
        SAVE_PATTERNII(Me.S관리번호3, Me.관리번호3, False, "\관리번호3패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub pbt_jijunm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbt_jijunm.Click
        SAVE_PATTERNII(Me.S지점명, Me.지점명, False, "\지점명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub pbt_junju_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbt_junju.Click
        SAVE_PATTERNII(Me.S전주번호, Me.전주번호, False, "\전주번호패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub pbt_sunlo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbt_sunlo.Click
        SAVE_PATTERNII(Me.S선로명, Me.선로명, False, "\선로명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub pbt_junsan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbt_junsan.Click
        SAVE_PATTERNII(Me.S전산화번호, Me.전산화번호, False, "\전산화번호패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub ToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripMenuItem1.Click
        SAVE_PATTERNII(Me.S전주번호, Me.전주번호, True, "\전주번호패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub
End Class


