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

Imports ThoughtWorks.QRCode.Codec '//QR코드
Imports ThoughtWorks.QRCode.Codec.Util
Imports ThoughtWorks.QRCode.Codec.Data
Public Class printformkiki

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

    '//이 스트럭처로 콤보박스를 갱신하며 이것저것 검색할때 사용한다.
    Dim AllLabels() As Str_Alllabels    '//전체갯수는 추가할대 셋팅한다.
    Dim S관리구(4) As MyControlOLEDBv2.MyLabel
    Dim S전산번호(2) As MyControlOLEDBv2.MyLabel
    Dim S선로명(10) As MyControlOLEDBv2.MyLabel
    Dim S전주번호(30) As MyControlOLEDBv2.MyLabel
    Dim S일련번호(0) As MyControlOLEDBv2.MyLabel
    Dim S관리구전산화번호 As MyControlOLEDBv2.MyLabel
    Dim s비고1 As MyControlOLEDBv2.MyLabel
    Dim s비고2 As MyControlOLEDBv2.MyLabel
    Dim s비고3 As MyControlOLEDBv2.MyLabel
    Dim s비고4 As MyControlOLEDBv2.MyLabel

    '//각각의 필드가 한줄로변해서 이곳에 들어가도록한다.
    Dim SDL11(1) As MyControlOLEDBv2.MyLabel
    Dim SDL12(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL13(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL14(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL15(1) As MyControlOLEDBv2.MyLabel

    Dim SDL21(1) As MyControlOLEDBv2.MyLabel
    Dim SDL22(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL23(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL24(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL25(1) As MyControlOLEDBv2.MyLabel

    Dim SDL31(1) As MyControlOLEDBv2.MyLabel
    Dim SDL32(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL33(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL34(1) As MyControlOLEDBv2.MyLabel
    'Dim SDL35(1) As MyControlOLEDBv2.MyLabel

    '//사용자문자
    Dim S사용자1 As MyControlOLEDBv2.MyLabel 'U
    Dim S사용자2 As MyControlOLEDBv2.MyLabel 'A
    Dim S사용자3 As MyControlOLEDBv2.MyLabel 'B
    Dim S사용자4 As MyControlOLEDBv2.MyLabel 'D
    Dim S사용자5 As MyControlOLEDBv2.MyLabel 'E

    Dim 관리구 As String = vbNullString
    Dim 전산번호 As String = vbNullString
    Dim 선로명 As String = vbNullString
    Dim 번호 As String = vbNullString

    Dim Dl11 As String = vbNullString
    Dim Dl12 As String = vbNullString
    'Dim Dl13 As String = vbNullString
    'Dim Dl14 As String = vbNullString
    'Dim Dl15 As String = vbNullString

    Dim Dl21 As String = vbNullString
    Dim Dl22 As String = vbNullString
    'Dim Dl23 As String = vbNullString
    'Dim Dl24 As String = vbNullString
    'Dim Dl25 As String = vbNullString

    Dim Dl31 As String = vbNullString
    Dim Dl32 As String = vbNullString
    'Dim Dl33 As String = vbNullString
    'Dim Dl34 As String = vbNullString
    'Dim Dl35 As String = vbNullString
    
    Dim 비고1 As String
    Dim 비고2 As String
    Dim 비고3 As String
    Dim 비고4 As String

    Dim 전주번호한줄 As String = ""

    Dim NoView As Boolean = False   '//LOAD_STYLE 을 잠시 실행하지 않기위햇(중복실행방지)서 둔다.
    Dim 관리구조작됨 As Boolean = True
    Dim 전산번호조작됨 As Boolean = True
    Dim 선로명조작됨 As Boolean = True
    Dim 전주번호조작됨 As Boolean = True
    Dim 시공년월조작됨 As Boolean = True

    Dim SrcIdx As Integer = -1  '//원본 리뷰에서 클릭된 인덱스
    Dim Srcnum As Integer = -1  '//원본 리뷴에서 클릭된 번호값
    Dim Srcrow As ireaDataSet.Detail_kikiRow
    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 & "\styleKK")
    Public FileC As String = My.Application.Info.DirectoryPath & "\styleCK.ini" '//사용자 스타일 파일

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

    Dim srcTable As ireaDataSet.Detail_kikiDataTable    '//데이터가 저장될 테이블
    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  '//실제출력일때는 true 을 가진다.

    Public Sub New()
        InitializeComponent()
        AddLog(Admin, "New()", "\Alllog.txt")
    End Sub

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

    Private Sub printform_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Me.dataview.Setting_Save(False, "printkiki", "\viewConfig\main_")
        AddLog(Admin, "Form_Closk", "\Alllog.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, "printkiki", "\viewConfig\main_")
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True) '//더블버퍼링
        AddLog(Admin, "Form_Load()", "\Alllog.txt")
        GetPrintersName()   '//프린터명을 가져옵니다.
        Load_Setting()
        SetControls()   '//컨트롤을 초기화하고 셋팅한다.
        Me.SETTOOLTIP()
        GetStyleList()  '//style.ini 에서 스타일목록명만 가져온다.

        If srcTable Is Nothing Then
            MsgBox("원본데이터소스가 정의되지 않았습니다", MsgBoxStyle.Critical, "확인")
            AddLog(Admin, "개발자 기본셋팅으로 전환()", "\Alllog.txt")
            Common.Admin = True
            Me.NoView = True
            Admin = True
        End If

        AddLog(Admin, "개발자모드=" & Admin.ToString, "\Alllog.txt")
        If Admin Then   '//개발자모드는 체크박스를 사용할수 있게한다.
            showlog()
            For Each A As Control In Me.TabPage3.Controls
                If A.GetType.Name.ToUpper = "CHECKBOX" Then
                    A.Visible = True
                End If
            Next
        End If

        If Srcrow Is Nothing Then '//가져온 행값이인덱스가 없으므로 1번째 스타일을 지정한다.
            AddLog(Admin, "가져온 행값이 없습니다. firstidx=0 / 일반용으로 셋팅합니다()", "\Alllog.txt")
            FirstIdx = 0 '//또한 맨 처음 데이터를 표시하게된다.
            Me.cmb_style.Text = "일반용"  '//여기서 데이터가 걸러지게된다.
            Return
        End If

        '//여기서 행값을 분석해서 콤보밗를 셋팅해준다; '//전부 셋팅된후 해당 값을 또 찾아야 한다.
        Srcnum = Srcrow.번호 ' Srcrow("번호") 'srcTable.Rows(SrcIdx).Item("번호")
        AddLog(Admin, "선택되서 넘오온데이터의 번호를 찾습니다=" & Srcnum, "\Alllog.txt")

        If Srcrow.회선10 <> "" AndAlso Srcrow.회선20 <> "" AndAlso Srcrow.회선30 <> "" Then
            AddLog(Admin, "3회선 판별()", "\Alllog.txt")
            Me.cmb_style.Text = "기기주(3회선)"  '//여기서 데이터가 걸러지게된다.

        ElseIf Srcrow.회선10 <> "" AndAlso Srcrow.회선20 <> "" Then
            AddLog(Admin, "2회선 판별()", "\Alllog.txt")
            Me.cmb_style.Text = "기기주(2회선)"  '//여기서 데이터가 걸러지게된다.

        ElseIf Srcrow.회선10 <> "" Then
            AddLog(Admin, "1회선 판별()", "\Alllog.txt")
            Me.cmb_style.Text = "기기주(1회선)"  '//여기서 데이터가 걸러지게된다.        
        Else
            AddLog(Admin, "기타회선으로셋팅한다.()", "\Alllog.txt")
            Me.cmb_style.Text = "기기주(표준용)"  '//여기서 데이터가 걸러지게된다.
        End If

        If Me.cmb_style.SelectedIndex = -1 Then
            Me.cmb_style.SelectedIndex = 0
        End If
    End Sub

    Private Sub SetControls()
        AddLog(Admin, "SetControls()", "\Alllog.txt")
        Dim CtlCnt As Short = 0

        For i As Integer = 0 To S관리구.GetUpperBound(0)  '//모든문자를 할당한다.
            S관리구(i) = New MyControlOLEDBv2.MyLabel
            S관리구(i).설명 = "관리구" & i + 1
            S관리구(i).Name = "H" & i + 1
            S관리구(i).DIV = "H"
            S관리구(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = S관리구(i)
            Me.cmb_controls.Items.Add(S관리구(i).설명)
            CtlCnt += 1
        Next

        '//////////////////////////
        For i As Integer = 0 To SDL11.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL11(i) = New MyControlOLEDBv2.MyLabel
            SDL11(i).설명 = "D/L 1회선(1)" & i + 1
            SDL11(i).Name = "I" & i + 1
            SDL11(i).DIV = "I"
            SDL11(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL11(i)
            Me.cmb_controls.Items.Add(SDL11(i).설명)
            CtlCnt += 1
        Next

        For i As Integer = 0 To SDL12.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL12(i) = New MyControlOLEDBv2.MyLabel
            SDL12(i).설명 = "D/L 1회선(2)" & i + 1
            SDL12(i).Name = "C" & i + 1
            SDL12(i).DIV = "C"
            SDL12(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL12(i)
            Me.cmb_controls.Items.Add(SDL12(i).설명)
            CtlCnt += 1
        Next

        'For i As Integer = 0 To SDL13.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL13(i) = New MyControlOLEDBv2.MyLabel
        '    SDL13(i).설명 = "D/L 1회선(3)" & i + 1
        '    SDL13(i).Name = "PA" & i + 1
        '    SDL13(i).DIV = "PA"
        '    SDL13(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL13(i)
        '    Me.cmb_controls.Items.Add(SDL13(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL14.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL14(i) = New MyControlOLEDBv2.MyLabel
        '    SDL14(i).설명 = "D/L 1회선(4)" & i + 1
        '    SDL14(i).Name = "PB" & i + 1
        '    SDL14(i).DIV = "PB"
        '    SDL14(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL14(i)
        '    Me.cmb_controls.Items.Add(SDL14(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL15.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL15(i) = New MyControlOLEDBv2.MyLabel
        '    SDL15(i).설명 = "D/L 1회선(5)" & i + 1
        '    SDL15(i).Name = "PC" & i + 1
        '    SDL15(i).DIV = "PC"
        '    SDL15(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL15(i)
        '    Me.cmb_controls.Items.Add(SDL15(i).설명)
        '    CtlCnt += 1
        'Next

        For i As Integer = 0 To SDL21.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL21(i) = New MyControlOLEDBv2.MyLabel
            SDL21(i).설명 = "D/L 2회선(1)" & i + 1
            SDL21(i).Name = "J" & i + 1
            SDL21(i).DIV = "J"
            SDL21(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL21(i)
            Me.cmb_controls.Items.Add(SDL21(i).설명)
            CtlCnt += 1
        Next

        For i As Integer = 0 To SDL22.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL22(i) = New MyControlOLEDBv2.MyLabel
            SDL22(i).설명 = "D/L 2회선(2)" & i + 1
            SDL22(i).Name = "F" & i + 1
            SDL22(i).DIV = "F"
            SDL22(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL22(i)
            Me.cmb_controls.Items.Add(SDL22(i).설명)
            CtlCnt += 1
        Next

        'For i As Integer = 0 To SDL23.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL23(i) = New MyControlOLEDBv2.MyLabel
        '    SDL23(i).설명 = "D/L 2회선(3)" & i + 1
        '    SDL23(i).Name = "QA" & i + 1
        '    SDL23(i).DIV = "QA"
        '    SDL23(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL23(i)
        '    Me.cmb_controls.Items.Add(SDL23(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL24.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL24(i) = New MyControlOLEDBv2.MyLabel
        '    SDL24(i).설명 = "D/L 2회선(4)" & i + 1
        '    SDL24(i).Name = "QB" & i + 1
        '    SDL24(i).DIV = "QB"
        '    SDL24(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL24(i)
        '    Me.cmb_controls.Items.Add(SDL24(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL25.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL25(i) = New MyControlOLEDBv2.MyLabel
        '    SDL25(i).설명 = "D/L 2회선(5)" & i + 1
        '    SDL25(i).Name = "QC" & i + 1
        '    SDL25(i).DIV = "QC"
        '    SDL25(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL25(i)
        '    Me.cmb_controls.Items.Add(SDL25(i).설명)
        '    CtlCnt += 1
        'Next

        For i As Integer = 0 To SDL31.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL31(i) = New MyControlOLEDBv2.MyLabel
            SDL31(i).설명 = "D/L 3회선(1)" & i + 1
            SDL31(i).Name = "K" & i + 1
            SDL31(i).DIV = "K"
            SDL31(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL31(i)
            Me.cmb_controls.Items.Add(SDL31(i).설명)
            CtlCnt += 1
        Next

        For i As Integer = 0 To SDL32.GetUpperBound(0)  '//모든문자를 할당한다.
            SDL32(i) = New MyControlOLEDBv2.MyLabel
            SDL32(i).설명 = "D/L 3회선(2)" & i + 1
            SDL32(i).Name = "M" & i + 1
            SDL32(i).DIV = "M"
            SDL32(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = SDL32(i)
            Me.cmb_controls.Items.Add(SDL32(i).설명)
            CtlCnt += 1
        Next

        'For i As Integer = 0 To SDL33.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL33(i) = New MyControlOLEDBv2.MyLabel
        '    SDL33(i).설명 = "D/L 3회선(3)" & i + 1
        '    SDL33(i).Name = "RA" & i + 1
        '    SDL33(i).DIV = "RA"
        '    SDL33(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL33(i)
        '    Me.cmb_controls.Items.Add(SDL33(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL34.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL34(i) = New MyControlOLEDBv2.MyLabel
        '    SDL34(i).설명 = "D/L 3회선(4)" & i + 1
        '    SDL34(i).Name = "RB" & i + 1
        '    SDL34(i).DIV = "RB"
        '    SDL34(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL34(i)
        '    Me.cmb_controls.Items.Add(SDL34(i).설명)
        '    CtlCnt += 1
        'Next

        'For i As Integer = 0 To SDL35.GetUpperBound(0)  '//모든문자를 할당한다.
        '    SDL35(i) = New MyControlOLEDBv2.MyLabel
        '    SDL35(i).설명 = "D/L 3회선(5)" & i + 1
        '    SDL35(i).Name = "RC" & i + 1
        '    SDL35(i).DIV = "RC"
        '    SDL35(i).Visible = False
        '    ReDim Preserve AllLabels(CtlCnt)
        '    Me.AllLabels(CtlCnt).ctl = SDL35(i)
        '    Me.cmb_controls.Items.Add(SDL35(i).설명)
        '    CtlCnt += 1
        'Next
        '//////////////////////////

        For i As Integer = 0 To S전산번호.GetUpperBound(0)  '//모든문자를 할당한다.
            S전산번호(i) = New MyControlOLEDBv2.MyLabel
            S전산번호(i).설명 = "전산번호" & i + 1
            S전산번호(i).Name = "S" & i + 1
            S전산번호(i).DIV = "S"
            S전산번호(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = S전산번호(i)
            Me.cmb_controls.Items.Add(S전산번호(i).설명)
            CtlCnt += 1
        Next
        For i As Integer = 0 To S선로명.GetUpperBound(0)  '//모든문자를 할당한다.
            S선로명(i) = New MyControlOLEDBv2.MyLabel
            S선로명(i).설명 = "선로명" & i + 1
            S선로명(i).Name = "L" & i + 1
            S선로명(i).DIV = "L"
            S선로명(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = S선로명(i)
            Me.cmb_controls.Items.Add(S선로명(i).설명)
            CtlCnt += 1
        Next
        For i As Integer = 0 To S전주번호.GetUpperBound(0)  '//모든문자를 할당한다.
            S전주번호(i) = New MyControlOLEDBv2.MyLabel
            S전주번호(i).설명 = "전주번호" & i + 1
            S전주번호(i).Name = "X" & i + 1
            S전주번호(i).DIV = "X"
            S전주번호(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = S전주번호(i)
            Me.cmb_controls.Items.Add(S전주번호(i).설명)
            CtlCnt += 1
        Next

        For i As Integer = 0 To S일련번호.GetUpperBound(0)  '//모든문자를 할당한다.
            S일련번호(i) = New MyControlOLEDBv2.MyLabel
            S일련번호(i).설명 = "일련번호" & i + 1
            S일련번호(i).Name = "N" & i + 1
            S일련번호(i).DIV = "N"
            S일련번호(i).Visible = False
            ReDim Preserve AllLabels(CtlCnt)
            Me.AllLabels(CtlCnt).ctl = S일련번호(i)
            Me.cmb_controls.Items.Add(S일련번호(i).설명)
            CtlCnt += 1
        Next

        S사용자1 = New MyControlOLEDBv2.MyLabel
        S사용자1.설명 = "사용자문자1"
        S사용자1.MyText = ""
        S사용자1.Name = "U"
        S사용자1.DIV = "U"
        S사용자1.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S사용자1
        Me.cmb_controls.Items.Add(S사용자1.설명)
        CtlCnt += 1

        S사용자2 = New MyControlOLEDBv2.MyLabel
        S사용자2.설명 = "사용자문자2"
        S사용자2.Name = "A"
        S사용자2.DIV = "A"
        S사용자2.MyText = ""
        S사용자2.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S사용자2
        Me.cmb_controls.Items.Add(S사용자2.설명)
        CtlCnt += 1

        S사용자3 = New MyControlOLEDBv2.MyLabel
        S사용자3.설명 = "사용자문자3"
        S사용자3.Name = "B"
        S사용자3.DIV = "B"
        S사용자3.MyText = ""
        S사용자3.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S사용자3
        Me.cmb_controls.Items.Add(S사용자3.설명)
        CtlCnt += 1

        S사용자4 = New MyControlOLEDBv2.MyLabel
        S사용자4.설명 = "사용자문자4"
        S사용자4.Name = "D"
        S사용자4.DIV = "D"
        S사용자4.MyText = ""
        S사용자4.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S사용자4
        Me.cmb_controls.Items.Add(S사용자4.설명)
        CtlCnt += 1

        S사용자5 = New MyControlOLEDBv2.MyLabel
        S사용자5.설명 = "사용자문자5"
        S사용자5.Name = "E"
        S사용자5.DIV = "E"
        S사용자5.MyText = ""
        S사용자5.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S사용자5
        Me.cmb_controls.Items.Add(S사용자5.설명)
        CtlCnt += 1

        S관리구전산화번호 = New MyControlOLEDBv2.MyLabel
        S관리구전산화번호.설명 = "관리구전산화번호"
        S관리구전산화번호.Name = "G"
        S관리구전산화번호.DIV = "G"
        S관리구전산화번호.MyText = ""
        S관리구전산화번호.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = S관리구전산화번호
        Me.cmb_controls.Items.Add(S관리구전산화번호.설명)
        CtlCnt += 1

        s비고1 = New MyControlOLEDBv2.MyLabel
        s비고1.설명 = "비고1"
        s비고1.Name = "V"
        s비고1.DIV = "V"
        s비고1.MyText = ""
        s비고1.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = s비고1
        Me.cmb_controls.Items.Add(s비고1.설명)
        CtlCnt += 1

        s비고2 = New MyControlOLEDBv2.MyLabel
        s비고2.설명 = "비고2"
        s비고2.Name = "W"
        s비고2.DIV = "W"
        s비고2.MyText = ""
        s비고2.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = s비고2
        Me.cmb_controls.Items.Add(s비고2.설명)
        CtlCnt += 1

        s비고3 = New MyControlOLEDBv2.MyLabel
        s비고3.설명 = "비고3"
        s비고3.Name = "Y"
        s비고3.DIV = "Y"
        s비고3.MyText = ""
        s비고3.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = s비고3
        Me.cmb_controls.Items.Add(s비고3.설명)
        CtlCnt += 1

        s비고4 = New MyControlOLEDBv2.MyLabel
        s비고4.설명 = "비고4"
        s비고4.Name = "Z"
        s비고4.DIV = "Z"
        s비고4.MyText = ""
        s비고4.Visible = False
        ReDim Preserve AllLabels(CtlCnt)
        Me.AllLabels(CtlCnt).ctl = s비고4
        Me.cmb_controls.Items.Add(s비고4.설명)
        CtlCnt += 1
    End Sub

    Private Sub SETTOOLTIP()
        AddLog(Admin, "Settooltip()", "\Alllog.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("<화명 중앙의 1/2 미리보기 창의 활성화 여부>")
        TMSG.AppendLine()
        TMSG.AppendLine("클릭해제시 중앙 미리보기 화면이 표시되지 않습니다")
        TMSG.AppendLine()
        'Me.ToolTip1.SetToolTip(Me.chb_preview, 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("<1장에 두번의 데이터가 표시됩니다.>")
        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)
        AddLog(Admin, "개체를 더블클릭했습니다.(이것은 사용되지 않음)", "\Alllog.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()
        AddLog(Admin, "현재 설정(스타일)을 저장합니다.", "\Alllog.txt")
        Dim A As New MyINI2(SettingFile)
        A.Write("PRINTFORM", "printername", Me.combobox5.Text)   '//패턴검사조건 콤보박스      
    End Sub
    Private Sub Load_Setting()
        AddLog(Admin, "현재설정(스타일)을 가져옵니다.()", "\Alllog.txt")
        AddLog(Admin, "Load_Setting()", "\Alllog.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)

        AddLog(Admin, "GetviewData 진입()", "\Alllog.txt")
        'MsgBox("getview = " & index)

        If Dv.Count <= 0 OrElse index < 0 OrElse index > Dv.Count Then
            AddLog(Admin, "GetViewData : 인덱스가 없거나 문제가 잇어서 리턴합니다.(" & index & ")", "\Alllog.txt")
            'MsgBox("GETVIEWDATA : 데이터가 없거나 잘못된 인덱스 입니다", MsgBoxStyle.Information, "확인") ' & index & "/" & Me.CustFP1.ActiveSheet.RowCount & ")", MsgBoxStyle.Critical, "확인")
            Return '//잘못된 인덱스는 리턴
        End If

        Dim 전주번호한줄 As String = ""

        관리구 = GetSpread(Me.Dv, index, "관리구")
        전산번호 = GetSpread(Me.Dv, index, "전주번호")
        선로명 = GetSpread(Me.Dv, index, "선로명")
        번호 = 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")

        Dl11 = GetSpread(Me.Dv, index, "회선11")
        Dl12 = GetSpread(Me.Dv, index, "회선12")
        'Dl13 = GetSpread(Me.Dv, index, "회선13")
        'Dl14 = GetSpread(Me.Dv, index, "회선14")
        'Dl15 = GetSpread(Me.Dv, index, "회선15")

        Dl21 = GetSpread(Me.Dv, index, "회선21")
        Dl22 = GetSpread(Me.Dv, index, "회선22")
        'Dl23 = GetSpread(Me.Dv, index, "회선23")
        'Dl24 = GetSpread(Me.Dv, index, "회선24")
        'Dl25 = GetSpread(Me.Dv, index, "회선25")

        Dl31 = GetSpread(Me.Dv, index, "회선31")
        Dl32 = GetSpread(Me.Dv, index, "회선32")
        'Dl33 = GetSpread(Me.Dv, index, "회선33")
        'Dl34 = GetSpread(Me.Dv, index, "회선34")
        'Dl35 = GetSpread(Me.Dv, index, "회선35")

        Me.비고1 = GetSpread(Me.Dv, index, "비고1")
        Me.비고2 = GetSpread(Me.Dv, index, "비고2")
        Me.비고3 = GetSpread(Me.Dv, index, "비고3")
        Me.비고4 = GetSpread(Me.Dv, index, "비고4")

        AddLog(Admin, "Complete : Load Data From Dataview", "\Alllog.txt")
        Me.Text = "기기용번호찰 출력작업(" & 번호 & ")"

        AddLog(Admin, "PASE구문을 실행합니다.()", "\Alllog.txt")
        AddLog(Admin, "패턴이있는 PASE 구문을 실행합니다.()", "\Alllog.txt")

        If PARSE_관리구(관리구) Then Me.PARSE_관리구패턴(관리구) '//선로명을 해석후 가져온후 패턴분석후 적용
        If PARSE_선로명(선로명) Then Me.PARSE_선로명패턴(선로명) '//선로명을 해석후 가져온후 패턴분석후 적용
        If PARSE_전산번호(전산번호) Then Me.PARSE_전산번호패턴(전산번호) '//선로명을 해석후 가져온후 패턴분석후 적용  

        If PARSE_DL11(Dl11) Then Me.PARSE_DL11명패턴(Dl11) '/DL명 추가했다.     
        If PARSE_DL12(Dl12) Then Me.PARSE_DL12명패턴(Dl12) '/DL명 추가했다.     
        'If PARSE_DL12(Dl13) Then Me.PARSE_DL13명패턴(Dl13) '/DL명 추가했다.     
        'If PARSE_DL12(Dl14) Then Me.PARSE_DL14명패턴(Dl14) '/DL명 추가했다.     
        'If PARSE_DL12(Dl15) Then Me.PARSE_DL15명패턴(Dl15) '/DL명 추가했다.     

        If PARSE_DL21(Dl21) Then Me.PARSE_DL21명패턴(Dl21) '/DL명 추가했다.     
        If PARSE_DL22(Dl22) Then Me.PARSE_DL22명패턴(Dl22) '/DL명 추가했다.     
        'If PARSE_DL12(Dl23) Then Me.PARSE_DL23명패턴(Dl23) '/DL명 추가했다.     
        'If PARSE_DL12(Dl24) Then Me.PARSE_DL24명패턴(Dl24) '/DL명 추가했다.     
        'If PARSE_DL12(Dl25) Then Me.PARSE_DL25명패턴(Dl25) '/DL명 추가했다.     

        If PARSE_DL31(Dl31) Then Me.PARSE_DL31명패턴(Dl31) '/DL명 추가했다.     
        If PARSE_DL32(Dl32) Then Me.PARSE_DL32명패턴(Dl32) '/DL명 추가했다.   
        'If PARSE_DL12(Dl33) Then Me.PARSE_DL33명패턴(Dl33) '/DL명 추가했다.     
        'If PARSE_DL12(Dl34) Then Me.PARSE_DL34명패턴(Dl34) '/DL명 추가했다.     
        'If PARSE_DL12(Dl35) Then Me.PARSE_DL35명패턴(Dl35) '/DL명 추가했다.     

        ' addlog(admin, "New()", "\Alllog.txt")
        If PARSE_번호(번호) Then    '//여기서 False 는 출력의의미가 없다
            번호패턴검사 = Me.PARSE_번호패턴(번호) '//선로명을 해석후 패턴분석 적용   
            AddLog(Admin, "번호패턴검사가 완료되었습니다.=" & 번호패턴검사, "\Alllog.txt")
            If NUMCOLOR Then    '//환경설정에서 색상보기가 선택되어있다면
                If 번호패턴검사 = 3 Then   '//둘다없다.
                    '//둘다없는 부분이라서 여기서는 디폴트를 잡아준다.
                    For i As Short = 0 To Me.S전주번호.GetUpperBound(0)
                        Me.S전주번호(i).MyForeColor = Drawing.Color.Red
                    Next
                ElseIf 번호패턴검사 = 2 Then    '//문자가없고 길이만 있다.
                    For i As Short = 0 To Me.S전주번호.GetUpperBound(0)
                        Me.S전주번호(i).MyForeColor = Drawing.Color.Green
                    Next
                Else '//문자만 있거나 둘다있다. '//0이면 이면 둘다있다 1이면 문자도 없고 길이도 없다 길이가 없다
                    For i As Short = 0 To Me.S전주번호.GetUpperBound(0)
                        Me.S전주번호(i).MyForeColor = Drawing.Color.Black
                    Next
                End If
            End If
        End If

        AddLog(Admin, "구관리전산,일련번호,관리전산표시여부를 pase 합니다.()", "\Alllog.txt")
        '========================= 기타 =================================================
        '//이러면 표시해야한다.
        'MsgBox(구관리전산)

        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

        If Me.CB_BIGO1.Checked Then
            Me.s비고1.MyText = Me.비고1
            Me.s비고1.Visible = True
        Else
            Me.s비고1.Visible = False
        End If

        If Me.CB_BIGO2.Checked Then
            Me.s비고2.MyText = Me.비고2
            Me.s비고2.Visible = True
        Else
            Me.s비고2.Visible = False
        End If

        If Me.CB_BIGO3.Checked Then
            Me.s비고3.MyText = Me.비고3
            Me.s비고3.Visible = True
        Else
            Me.s비고3.Visible = False
        End If

        If Me.CB_BIGO4.Checked Then
            Me.s비고4.MyText = Me.비고4
            Me.s비고4.Visible = True
        Else
            Me.s비고4.Visible = False
        End If

        If Me.cb_kwanjun.Checked Then
            Me.S관리구전산화번호.MyText = Me.관리구 & "-" & Me.전산번호
            Me.S관리구전산화번호.Visible = True
        Else
            Me.S관리구전산화번호.Visible = False
        End If

        AddLog(Admin, "사용자문자의 표시여부를 결정합니다.()", "\Alllog.txt")
        '사용자문자의 표시여부 u a b d e
        If Not Me.cb_u1.Checked Then Me.S사용자1.Visible = False
        If Not Me.cb_u2.Checked Then Me.S사용자2.Visible = False
        If Not Me.cb_u3.Checked Then Me.S사용자3.Visible = False
        If Not Me.cb_u4.Checked Then Me.S사용자4.Visible = False
        If Not Me.cb_u5.Checked Then Me.S사용자5.Visible = False

        'ENDTIME = Now
        ' Me.Text = "걸린시간 = " & (ENDTIME - STARTTIME).ToString

        '휴 끝났다.......................................................
        AddLog(Admin, "Pewview 윈도우를 실행합니다.()", "\Alllog.txt")
        'Me.preview_window()
        If previewWindow Then Me.preview_window()
    End Sub

    Public Function ChkNumPattern(ByVal index As Integer) As Int16
        AddLog(Admin, "번호패턴을 체크합니다. int16을 반환합니다.()", "\Alllog.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(검사번호)

        '//먼저문자가있는지 확인한다.
        'MsgBox(검사번호 & "/" & PATTERN)

        pname = "JJNUMPATTERNII" & PATTERN

        Dim Dr() As DataRow
        Dr = dtpattern.Select("NAME = '" & pname & "DESC'")
        AddLog(Admin, "문자패턴의 존재여부 = " & Dr.GetUpperBound(0) & ":" & pname, "\Alllog.txt")
        If Dr.GetUpperBound(0) <> -1 Then '//있다.
            retval += 2
            'addlog(admin, "관리구5번 문자를 찾았습니다 (" & pname & "DESC" & ")", Log)
        End If

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

        pname = "JJNUMPATTERN" & Wlen
        Dr = dtpattern.Select("NAME = '" & pname & "DESC'")
        AddLog(Admin, "길이패턴의 존재여부 = " & Dr.GetUpperBound(0) & ";" & pname, "\Alllog.txt")
        If Dr.GetUpperBound(0) <> -1 Then '//있다.
            retval += 1
            'addlog(admin, "관리구5번 문자를 찾았습니다 (" & pname & "DESC" & ")", Log)
        End If
        Return retval '// 0이 리턴될것이다. 패턴이 모두 정상이란 뜻이다
    End Function

    Public Sub CLEAR_ITEM(ByVal DIV As String)
        AddLog(Admin, "Clear_item div=" & DIV, "\Alllog.txt")

        Select Case DIV.ToUpper
            Case "L"
                For i As Short = 0 To S선로명.GetUpperBound(0)
                    S선로명(i).MyText = ""
                    S선로명(i).Visible = False
                Next
            Case "H"
                For i As Short = 0 To S관리구.GetUpperBound(0)
                    S관리구(i).MyText = ""
                    S관리구(i).Visible = False
                Next
            Case "I"
                For i As Short = 0 To SDL11.GetUpperBound(0)
                    SDL11(i).MyText = ""
                    SDL11(i).Visible = False
                Next
            Case "C"
                For i As Short = 0 To SDL12.GetUpperBound(0)
                    SDL12(i).MyText = ""
                    SDL12(i).Visible = False
                Next

                'Case "PA"
                '    For i As Short = 0 To SDL13.GetUpperBound(0)
                '        SDL13(i).MyText = ""
                '        SDL13(i).Visible = False
                '    Next

                'Case "PB"
                '    For i As Short = 0 To SDL14.GetUpperBound(0)
                '        SDL14(i).MyText = ""
                '        SDL14(i).Visible = False
                '    Next

                'Case "PC"
                '    For i As Short = 0 To SDL15.GetUpperBound(0)
                '        SDL15(i).MyText = ""
                '        SDL15(i).Visible = False
                '    Next


            Case "J"
                For i As Short = 0 To SDL21.GetUpperBound(0)
                    SDL21(i).MyText = ""
                    SDL21(i).Visible = False
                Next
            Case "F"
                For i As Short = 0 To SDL22.GetUpperBound(0)
                    SDL22(i).MyText = ""
                    SDL22(i).Visible = False
                Next
                'Case "QA"
                '    For i As Short = 0 To SDL23.GetUpperBound(0)
                '        SDL23(i).MyText = ""
                '        SDL23(i).Visible = False
                '    Next
                'Case "QB"
                '    For i As Short = 0 To SDL24.GetUpperBound(0)
                '        SDL24(i).MyText = ""
                '        SDL24(i).Visible = False
                '    Next
                'Case "QC"
                '    For i As Short = 0 To SDL25.GetUpperBound(0)
                '        SDL25(i).MyText = ""
                '        SDL25(i).Visible = False
                '    Next


            Case "K"
                For i As Short = 0 To SDL31.GetUpperBound(0)
                    SDL31(i).MyText = ""
                    SDL31(i).Visible = False
                Next
            Case "M"
                For i As Short = 0 To SDL32.GetUpperBound(0)
                    SDL32(i).MyText = ""
                    SDL32(i).Visible = False
                Next

                'Case "RA"
                '    For i As Short = 0 To SDL33.GetUpperBound(0)
                '        SDL33(i).MyText = ""
                '        SDL33(i).Visible = False
                '    Next
                'Case "RB"
                '    For i As Short = 0 To SDL34.GetUpperBound(0)
                '        SDL34(i).MyText = ""
                '        SDL34(i).Visible = False
                '    Next
                'Case "RC"
                '    For i As Short = 0 To SDL35.GetUpperBound(0)
                '        SDL35(i).MyText = ""
                '        SDL35(i).Visible = False
                '    Next




            Case "X"
                For i As Short = 0 To S전주번호.GetUpperBound(0)
                    S전주번호(i).MyText = ""
                    S전주번호(i).Visible = False
                Next
            Case "S"
                For i As Short = 0 To S전산번호.GetUpperBound(0)
                    S전산번호(i).MyText = ""
                    S전산번호(i).Visible = False
                Next
            Case "N"
                For i As Short = 0 To S일련번호.GetUpperBound(0)
                    S일련번호(i).MyText = ""
                    S일련번호(i).Visible = False
                Next
            Case "G"
                Me.S관리구전산화번호.MyText = ""
                Me.S관리구전산화번호.Visible = False

            Case "U"
                Me.S사용자1.MyText = ""
                Me.S사용자1.Visible = False

            Case "A"
                Me.S사용자2.MyText = ""
                Me.S사용자2.Visible = False

            Case "B"
                Me.S사용자3.MyText = ""
                Me.S사용자3.Visible = False

            Case "D"
                Me.S사용자4.MyText = ""
                Me.S사용자4.Visible = False

            Case "E"
                Me.S사용자5.MyText = ""
                Me.S사용자5.Visible = False


            Case "V"
                Me.s비고1.MyText = ""
                Me.s비고1.Visible = False

            Case "W"
                Me.s비고2.MyText = ""
                Me.s비고2.Visible = False

            Case "Y"
                Me.s비고3.MyText = ""
                Me.s비고3.Visible = False

            Case "Z"
                Me.s비고4.MyText = ""
                Me.s비고4.Visible = False

            Case Else
                MsgBox("Clear_Item 에 알수없는 문자 ( " & DIV & ") 입니다")
        End Select

    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 데이터테이블갱신()
        AddLog(Admin, "데이터테이블 갱신()", "\Alllog.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 '//범위내의 페이지번호와 일치하는 번호를 찾아서 배열에 할당한다.
        AddLog(Admin, "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()
        AddLog(Admin, "print_preview 미리보기 버튼을 눌렀을때다.()", "\Alllog.txt")
        Me.PrintMode = False
        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)

        If Me.Chk_BgImageprint.Checked AndAlso Me.chk_DisplayBG.Checked AndAlso Not Me.bakimg.BackgroundImage Is Nothing Then
            If Me.PrintMode = False Then    '//미리보기일때  인쇄마진을 넣지않는다.
                e.Graphics.DrawImage(Me.bakimg.BackgroundImage, CInt(Me.tb_bakx.Text), CInt(Me.tb_baky.Text), CInt(Me.tb_bakw.Text), CInt(Me.tb_bakh.Text))   '//배경그림
            Else
                e.Graphics.DrawImage(Me.bakimg.BackgroundImage, CInt(Me.tb_bakx.Text) + CInt(Me.tb_marginx.Text), CInt(Me.tb_baky.Text) + CInt(Me.tb_marginy.Text), CInt(Me.tb_bakw.Text), CInt(Me.tb_bakh.Text))   '//배경그림
            End If
        End If

        If Me.chk_draw.Checked Then
            '//라인을 그린다.
            For Each Rect As S_Line In Draw_Line
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                If Me.PrintMode Then
                    e.Graphics.DrawLine(Pen, Rect.X + CInt(Me.tb_marginx.Text), Rect.Y + CInt(Me.tb_marginy.Text), Rect.X2 + CInt(Me.tb_marginx.Text), Rect.Y2 + CInt(Me.tb_marginy.Text))
                Else
                    e.Graphics.DrawLine(Pen, Rect.X, Rect.Y, Rect.X2, Rect.Y2)
                End If

            Next
            '//박스를 그린다.
            For Each Rect As S_Box In Draw_Box
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                If Me.PrintMode Then
                    e.Graphics.DrawRectangle(Pen, Rect.X + CInt(Me.tb_marginx.Text), Rect.Y + CInt(Me.tb_marginy.Text), Rect.Width, Rect.Height)
                Else
                    e.Graphics.DrawRectangle(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height)
                End If

            Next
            '//원를 그린다.
            For Each Rect As S_Circle In Draw_Circle
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                If Me.PrintMode Then
                    e.Graphics.DrawEllipse(Pen, Rect.X + CInt(Me.tb_marginx.Text), Rect.Y + CInt(Me.tb_marginy.Text), Rect.Width, Rect.Height)
                Else
                    e.Graphics.DrawEllipse(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height)
                End If

            Next

            If 관리구 <> "" Then
                Try
                    '//QR코드를 그린다.
                    For Each Rect As S_QRCode In Draw_QRcode
                        'Dim scale As Int16
                        Dim version As Int16
                        Dim image As Image
                        Dim data As String
                        Dim errorCorrect As String
                        Dim qrCodeEncoder1 As New QRCodeEncoder()
                        Dim encoding As String
                        encoding = cboEncoding.Text
                        If encoding = "3" Then
                            qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.BYTE
                        ElseIf encoding = "1" Then
                            qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC
                        ElseIf encoding = "2" Then
                            qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.NUMERIC
                            Try
                                version = Convert.ToInt16(cboVersion.Text)
                                qrCodeEncoder1.QRCodeVersion = version
                            Catch ex As Exception
                                MessageBox.Show("Invaild Version!")
                            End Try
                        End If

                        errorCorrect = cboCorrectionLevel.Text
                        If errorCorrect = "1" Then
                            qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.L
                        ElseIf errorCorrect = "2" Then
                            qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.M
                        ElseIf errorCorrect = "3" Then
                            qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.Q
                        ElseIf errorCorrect = "4" Then
                            qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.H
                        End If

                        data = 관리구            'data설정
                        If lbQrBg.BackColor <> Drawing.Color.White Then qrCodeEncoder1.QRCodeBackgroundColor = lbQrBg.BackColor
                        If lbQrFG.BackColor <> Drawing.Color.Black Then qrCodeEncoder1.QRCodeForegroundColor = lbQrFG.BackColor
                        image = qrCodeEncoder1.Encode(data, e.Graphics.DpiX, e.Graphics.DpiY)
                        If Me.PrintMode Then
                            e.Graphics.DrawImage(image, Rect.X + CInt(Me.tb_marginx.Text), Rect.Y + CInt(Me.tb_marginy.Text), Rect.Width, Rect.Height)
                        Else
                            e.Graphics.DrawImage(image, Rect.X, Rect.Y, Rect.Width, Rect.Height)
                        End If

                        '   If Rect.Width = 0 OrElse Rect.Height = 0 Then
                        '        Ga.DrawImage(Image, Rect.X + MyProperty_Paper.출력여백X, Rect.Y + MyProperty_Paper.출력여백Y)
                        'e.Graphics.DrawImage(image, Rect.X + CInt(Me.tb_marginx.Text), Rect.Y + CInt(Me.tb_marginy.Text))
                        'Else
                        '        Ga.DrawImage(Image, Rect.X + MyProperty_Paper.출력여백X, Rect.Y + MyProperty_Paper.출력여백Y, Rect.Width, Rect.Height)
                        'e.Graphics.DrawImage(image, Rect.X, Rect.Y, Rect.Width, Rect.Height)
                        'End If
                    Next
                Catch ex As Exception
                    MessageBox.Show(ex.ToString())
                End Try
            End If
        End If



        '//연속페이지 오류정정
        If Me.tb_pagerepeat.Text = "" Or Me.tb_pagerepeat.Text < 1 Then Me.tb_pagerepeat.Text = "1"
        For pi As Short = 0 To Me.tb_pagerepeat.Text - 1  '//페이지당 연속출력할 횟수
Dummyflag:  '//--2장출력일경우 이부분에서 다시 시작한다.
            For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
                C = Me.AllLabels(i).ctl
                If C.Visible = True AndAlso C.MyText <> "" Then
                    For rcnt As Short = 0 To C.Repeat   '//반복기능추가
                        '//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)

                        NewLeft = C.Left + IIf(Me.PrintMode, Me.tb_marginx.Text, 0) + Me.tb_secX.Text * pi + rcnt * C.RepeatX
                        NewTop = C.Top + IIf(Me.PrintMode, Me.tb_marginy.Text, 0) + Me.tb_secY.Text * pi + rcnt * C.RepeatY

                        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
                    Next
                End If
            Next

            '//한데이터출력하고나서 반복페에지횟수가 있는지확인한다.
            If Me.tb_pagerepeat.Text > 1 Then
                ' If Me.cmb_dummy.SelectedIndex <> 0 Then '//다음데이터의 출력이면 여기서 데이터를 갱신해준다.
                If Me.cmb_dummy.SelectedIndex <> 0 Then   '//다음장이있다.
                    If Me.printindex >= 0 AndAlso Me.printindex < Me.PrintArray.GetUpperBound(0) Then

                        '//루프가 끝낫는지 추가체크한다.  170308
                        If pi < Me.tb_pagerepeat.Text - 1 Then
                            Me.printindex += 1  '/1장넘기고 
                            If Me.cmb_dummy.SelectedIndex <> 0 AndAlso Me.rad_repeat.Checked = False Then Me.GeTviewData(Me.PrintArray(Me.printindex), False) '//데이터 바꾸는데..화면은 갱신하지 않는다.
                        End If
                        
                    Else   '//다음장의 출력인데 데이터가없다면 루프를 더이상 돌면안된다.
                        Exit For
                    End If
                End If
            End If
        Next   '//pi 반복할거를 모두 출력했을시에
        If Me.printindex >= 0 AndAlso Me.printindex < Me.PrintArray.GetUpperBound(0) Then   '//다음장이있다.
            If Me.tb_pagerepeat.Text < 2 Then
                Me.printindex += 1 '//페이지번호를 증가
            Else
                Me.printindex += 1 '//페이지번호를 증가
            End If
            e.HasMorePages = True
        Else
            e.HasMorePages = False
        End If
        e.Graphics.Dispose()
    End Sub

    Private Sub Print()
        If MsgBox("인쇄를 하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") = MsgBoxResult.Ok Then
            AddLog(Admin, "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("인쇄가 취소되었습니다", Drawing.Color.Tomato, Me.lb_msg)
        End If

    End Sub

    Private Sub con_Mmove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        AddLog(Admin, "con _move 개체이동할 프로시져인데 현재 안쓴다.()", "\Alllog.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)
        AddLog(Admin, "view properfty  개체의 상태보기()", "\Alllog.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.GetSize.Width & ",H=" & sender.GetSize.Height

        If Not sender.Tag Is Nothing Then   '//여기서 개체의 패턴적용여부를 표시합니다.
            ' MsgBox(sender.Tag.ToString)
            Me.lb_countpattern.ForeColor = IIf(sender.Tag.ToString.IndexOf("L") >= 0, Drawing.Color.Green, Drawing.Color.Black)
            Me.lb_strpattern.ForeColor = IIf(sender.Tag.ToString.IndexOf("C") >= 0, Drawing.Color.Green, Drawing.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 = Drawing.Color.Black
            Me.lb_strpattern.ForeColor = Drawing.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.chk_DisplayBG.Checked = False
        ElseIf Me.chk_DisplayBG.Checked Then
            Me.PictureBox1.BackgroundImage = Image.FromFile(Picimg)
            Me.bakimg.BackgroundImage = Image.FromFile(Picimg)
        End If
    End Sub


    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk_DisplayBG.CheckedChanged
        AddLog(Admin, "배경보기 체크박스를 클릭했다.)", "\Alllog.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
        AddLog(Admin, "파일찾기 버튼이 클릭됨", "\Alllog.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.chk_DisplayBG.Checked = True
        Me.ViewBackImage() '//배경이밎표시

    End Sub

    Public Sub CtrPos(ByVal vertical As Boolean, ByVal offset As Short)
        AddLog(Admin, "ctrpos (선택된 개체들의 위치값을 변경합니다)", "\Alllog.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.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.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.Left -= 10
                    Else
                        sender.Left += 10
                    End If
                Else
                    sender.Left += offset
                End If
            End If

        Next

        AddLog(Admin, "ctrpos =[ preview 호출합니다]", "\Alllog.txt")
        Me.preview_window()
        'Me.ViewProperty(sender)
    End Sub

    Private Sub ShowMsg(ByVal Message As String)
        AddLog(Admin, "showmsg 메세지를 보여줍니다 =" & Message, "\Alllog.txt")
        Me.lb_msg.Text = "▷ " & Message & Space(1) & TimeOfDay.ToString
    End Sub

    Public Sub SetFont()   '//체크박스 상태에따라서 폰트를 변경합니다.
        AddLog(Admin, "set font 체크박스 상태에 따라서 폰트를 변경합니다.", "\Alllog.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
        AddLog(Admin, "setfont = preview 호출합니다.", "\Alllog.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
        AddLog(Admin, "스타일콤보박스에서 keyip 이 감지되었으나 핸들을 true 로 해버린다.", "\Alllog.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
        AddLog(Admin, "→ Change : Style Index...", "\Alllog.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

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

        Dim AlphaPos As Short = 0

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

        If Dv.Count <= 0 Then '//데이터가없다면
            MsgBox(Me.cmb_style.Text & "에 해당하는 데이터가존재하지 않습니다" & vbCrLf & vbCrLf & "다른 스타일을 선택하세요", MsgBoxStyle.Information, "확인")
            Me.PictureBox1.Refresh()
        Else
            AddLog(Admin, "FindData : Count = " & Dv.Count, "\Alllog.txt")
            Me.TB_Pattern_End.Text = Dv.Count - 1 '//패턴검사시 종료카운터이다...
            Me.VScrollBar1.Minimum = 0  '//스크롤바가 잘 안움직인다.(차후에 수정요망)
            Me.VScrollBar1.Maximum = Dv.Count - 1
            Me.LOAD_STYLE()   '//스타일불러오기(여기서 모든컨트롤의 기본 위치와 글꼴이 결정된다)

            Debug.Print("스크롤바값 설정 " & Me.VScrollBar1.Minimum & "/" & Me.VScrollBar1.Maximum)
            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
            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
                AddLog(Admin, "View : First Record // Set = 0", "\Alllog.txt")
            Else    '//index is not first
                AddLog(Admin, "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

        'addlog(admin, "cmb_style selectindexchanged 에서 preview 를 호출함", "\Alllog.txt")
        'Me.preview_window()
    End Sub

    Public Sub LOAD_STYLE(Optional ByVal Div As String = "Z")   '//저장된 스타일을 불러옵니다.     


        AddLog(Admin, "load_style : 스타일을 불러옵니다. div= " & Div, "\Alllog.txt")

        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
                    If Div.ToUpper = "H" Then   '//H의경우는 따로 찾아본다.
                        If Me.관리구조작됨 = True 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
                    Else
                        '//메모리에서 찾는다.
                        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
            End If

        Next

        If Div.ToUpper <> "Z" Then Return '//모든템이아니다
        AddLog(Admin, "load_style 기본값 체크박스등의 값을 불러온다. 이것은 맨첨에만 불러오면 된다. ", "\Alllog.txt")

        Dim Arinini As New MyINI2(drstyle.File)
        '''''''''''''''''''''우측 스타일 체크박스를 가져온다.
        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.ToString, 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.ToString, False)  '//기본값 false
            End If
        Next
        For Each B As Control In Me.TabPage5.Controls
            If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
                CType(B, Windows.Forms.CheckBox).Checked = Arinini.Read("STYLE", B.Name.ToString, 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중
        '//더미는 이제 사용하지않는다.20090729 변경
        'Dim UseDummy As Boolean = drstyle.Dummy 'Arinini.Read("STYLE", "dummy", False)
        'Try
        Me.tb_pagerepeat.Text = drstyle.DummyCnt
        If Me.tb_pagerepeat.Text.Trim = "" OrElse Me.tb_pagerepeat.Text < 1 Then Me.tb_pagerepeat.Text = "1"
        'Catch ex As Exception
        '    If UseDummy Then
        '        Me.tb_pagerepeat.Text = "2"
        '    Else
        '        Me.tb_pagerepeat.Text = "1"
        '    End If
        'End Try


        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")


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

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

        Me.chk_DisplayBG.Checked = drstyle.Viewimage ' Arinini.Read("STYLE", "ViewImage", True)
        Me.Chk_BgImageprint.Checked = drstyle.Printbg
        Me.tb_bakx.Text = drstyle.bakx
        Me.tb_baky.Text = drstyle.baky
        Me.tb_bakw.Text = drstyle.bakw
        Me.tb_bakh.Text = drstyle.bakh

        Try
            Me.cboCorrectionLevel.Text = Arinini.Read("STYLE", "qrlevel", 1)
            Me.cboEncoding.Text = Arinini.Read("STYLE", "qrencoding", 2)
            Me.cboVersion.Text = Arinini.Read("STYLE", "qrvison", 1)
            Dim qrbgstr As String = Arinini.Read("STYLE", "qrbg", "")
            Dim qrfgstr As String = Arinini.Read("STYLE", "qrfg", "")
            If qrbgstr = "" Then
                lbQrBg.BackColor = Drawing.Color.White
            Else
                lbQrBg.BackColor = Drawing.Color.FromArgb(CInt(qrbgstr))
            End If
            If qrfgstr = "" Then
                lbQrFG.BackColor = Drawing.Color.Black
            Else
                lbQrFG.BackColor = Drawing.Color.FromArgb(CInt(qrfgstr))
            End If
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try



        Me.tb_myfontsize.Text = drstyle.PrintFontOffset    ' Arinini.Read("STYLE", "PrintFontOffset", 0)
        NOTICE(Me.cmb_style.Text & "스타일을 불러왔습니다.", Me.lb_msg)

    End Sub

    Public Sub SAVE_STYLE()
        AddLog(Admin, "ini파일에 스타일을 저장합니다. ", "\Alllog.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()


        Dim Div As Char

        For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)
            f.ProgressBar1.Value += 1
            f.Refresh()

            Tobj = Me.AllLabels(i).ctl
            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.공백)
            Select Case Tobj.Name.ToUpper.Substring(0, 1)
                Case "U", "A", "B", "D", "E"
                    Arinini.Write("STYLE", Tobj.Name & "mytext", TextEnc(Tobj.MyText))
            End Select

            Div = Tobj.Name.Substring(0, 1) '1자리만끊어서 체크박스 태그랑 연결한다.
            For Each B As Control In Me.TabPage1.Controls
                If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
                    If B.Tag <> Nothing AndAlso B.Tag.ToString.ToUpper = Div.ToString.ToUpper Then '//해당 체크박스를 찾았으면 체크박스 상태로 저장을한다.
                        Arinini.Write("STYLE", Tobj.Name & "visible", CType(B, Windows.Forms.CheckBox).Checked) 'A.Visible)
                        Exit For
                    End If
                End If
            Next
        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

        'For Each B As Control In Me.TabPage1.Controls
        '    If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
        '        Arinini.Write("STYLE", B.Name.ToString, CType(B, Windows.Forms.CheckBox).Checked) 'A.Visible)
        '    End If
        'Next
        'For Each B As Control In Me.TabPage3.Controls
        '    If B.GetType.Name.ToUpper = "CHECKBOX" Then '//체크박스라면 태그를 저장한다.
        '        Arinini.Write("STYLE", B.Name.ToString, CType(B, Windows.Forms.CheckBox).Checked) 'A.Visible)
        '    End If
        'Next
        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "일반정보")
        f.Show()
        Application.DoEvents()

        Arinini.Write("STYLE", "CanvasX", Me.PictureBox1.Width)  '//캔버스사이즈저장한다.
        Arinini.Write("STYLE", "CanvasY", Me.PictureBox1.Height)

        Arinini.Write("STYLE", "ViewImage", Me.chk_DisplayBG.Checked)
        Arinini.Write("STYLE", "printbg", Me.Chk_BgImageprint.Checked)
        Arininic.Write("printer", "printbg", Me.Chk_BgImageprint.Checked)

        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


        Arininic.Write("printer", "bakx", Me.tb_bakx.Text)
        Arininic.Write("printer", "baky", Me.tb_baky.Text)
        Arininic.Write("printer", "bakw", Me.tb_bakw.Text)
        Arininic.Write("printer", "bakh", Me.tb_bakh.Text)

        Arinini.Write("STYLE", "bakx", Me.tb_bakx.Text)
        Arinini.Write("STYLE", "baky", Me.tb_baky.Text)
        Arinini.Write("STYLE", "bakw", Me.tb_bakw.Text)
        Arinini.Write("STYLE", "bakh", Me.tb_bakh.Text)

        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", "dummycnt", Me.tb_pagerepeat.Text)
        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)

        '//QR코드
        Arinini.Write("STYLE", "qrencoding", Me.cboEncoding.Text)
        Arinini.Write("STYLE", "qrlevel", Me.cboCorrectionLevel.Text)
        Arinini.Write("STYLE", "qrvison", Me.cboVersion.Text)
        Arinini.Write("STYLE", "qrfg", Me.lbQrFG.BackColor.ToArgb().ToString())
        Arinini.Write("STYLE", "qrbg", Me.lbQrBg.BackColor.ToArgb().ToString())

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


        SaveReadLayOut(False)

        f.Label1.Text = String.Format("스타일을 저장합니다" + vbCrLf + "그리기개체")
        f.Show()
        Application.DoEvents()

        Me.SaveDrawData(False)
        NOTICE("기본스타일을 저장했습니다", Me.lb_msg)
        AddLog(Admin, "save style 완료후 데이터테이블 갱신을 호춣 ", "\Alllog.txt")

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


        Me.데이터테이블갱신()
        Me.preview_window()
    End Sub



    Public Sub SAVE_PATTERNII(ByVal SRCSTR As String, ByVal MIDNAME As String, ByVal DIV As Char, Optional ByVal LOGFILENAME As String = "\패턴.TXT")   '패턴을 저장합니다. 패턴역시 위치/크기/장평등이 저장됩니다.
        '//이곳은 문자패턴을 저장한다.
        Dim Arinini As New MyINI2(drstyle.File)
        Dim BUF() As Char = SRCSTR.ToCharArray
        Dim mb As String = PATTERN_ENC(SRCSTR)
        Dim TOBJ As MyControlOLEDBv2.MyLabel
        Dim Pname As String = MIDNAME & mb.ToString



        AddLog(Admin, " save_pattern2 를 실행한다.", "\Alllog.txt")

        Select Case DIV.ToString.ToUpper

            Case "L"    '//선로명
                For i As Integer = 0 To Me.S선로명.GetUpperBound(0)
                    TOBJ = Me.S선로명(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
            Case "I"    '//dl명
                For i As Integer = 0 To Me.SDL11.GetUpperBound(0)
                    TOBJ = Me.SDL11(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
            Case "C"    '//dl명
                For i As Integer = 0 To Me.SDL12.GetUpperBound(0)
                    TOBJ = Me.SDL12(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next

                'Case "PA"    '//dl명
                '    For i As Integer = 0 To Me.SDL13.GetUpperBound(0)
                '        TOBJ = Me.SDL13(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "PB"    '//dl명
                '    For i As Integer = 0 To Me.SDL14.GetUpperBound(0)
                '        TOBJ = Me.SDL14(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "PC"    '//dl명
                '    For i As Integer = 0 To Me.SDL15.GetUpperBound(0)
                '        TOBJ = Me.SDL15(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next


            Case "J"    '//dl명
                For i As Integer = 0 To Me.SDL21.GetUpperBound(0)
                    TOBJ = Me.SDL21(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
            Case "F"    '//dl명
                For i As Integer = 0 To Me.SDL22.GetUpperBound(0)
                    TOBJ = Me.SDL22(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
                'Case "QA"    '//dl명
                '    For i As Integer = 0 To Me.SDL23.GetUpperBound(0)
                '        TOBJ = Me.SDL23(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "QB"    '//dl명
                '    For i As Integer = 0 To Me.SDL24.GetUpperBound(0)
                '        TOBJ = Me.SDL24(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "QC"    '//dl명
                '    For i As Integer = 0 To Me.SDL25.GetUpperBound(0)
                '        TOBJ = Me.SDL25(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next



            Case "K"    '//dl명
                For i As Integer = 0 To Me.SDL31.GetUpperBound(0)
                    TOBJ = Me.SDL31(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
            Case "M"    '//dl명
                For i As Integer = 0 To Me.SDL32.GetUpperBound(0)
                    TOBJ = Me.SDL32(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
                'Case "RA"    '//dl명
                '    For i As Integer = 0 To Me.SDL33.GetUpperBound(0)
                '        TOBJ = Me.SDL33(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "RB"    '//dl명
                '    For i As Integer = 0 To Me.SDL34.GetUpperBound(0)
                '        TOBJ = Me.SDL34(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next
                'Case "RC"    '//dl명
                '    For i As Integer = 0 To Me.SDL35.GetUpperBound(0)
                '        TOBJ = Me.SDL35(i)
                '        AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                '        Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                '        AddLog(Admin, "최종선택완료=" & 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.공백)
                '    Next



            Case "X"    '//전주번호
                For i As Integer = 0 To Me.S전주번호.GetUpperBound(0)
                    TOBJ = Me.S전주번호(i)
                    AddLog(Admin, MIDNAME & "패턴저장시 아이템=" & TOBJ.Name & "/" & TOBJ.Name.Substring(0, 1).ToUpper, LOGFILENAME)
                    Arinini.Write(Pname, "DESC", "저장된 문자패턴 " & MIDNAME)
                    AddLog(Admin, "최종선택완료=" & 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.공백)
                Next
                Arinini.Write(Pname, "LineType", Me.tb_ntype.Text)
                Arinini.Write(Pname, "nseparate", Me.cmb_sep.SelectedIndex)
            Case Else
                MsgBox("Save_PatternII 에 정의되지않은 문자(" & DIV & ") 가 발생하였습니다", MsgBoxStyle.Critical, "확인")
        End Select

        AddLog(Admin, "save_patter2 ㅔ서 데이터테이블 갱신을 ㅎ호출한다ㅣㅣ ", "\Alllog.txt")
        Me.데이터테이블갱신()
    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
        AddLog(Admin, "개체목록 콤보박스에서 특정 개체가 선택되었다 view property 호출", "\Alllog.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
        AddLog(Admin, "표시 체크박스 선택 ", "\Alllog.txt")
        For Each a As Control In SelCon
            a.Visible = Me.cb_visible.Checked
        Next
        AddLog(Admin, "[표시] 체크박스 선택에서 pewview를 호출 ", "\Alllog.txt")
        Me.preview_window()
    End Sub

    Private Sub tb_foncol_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb_foncol.DoubleClick
        AddLog(Admin, " 글씨색깔 변경 클릭됨", "\Alllog.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
        AddLog(Admin, "글씨꿁게 선택됨 setfont 호출 ", "\Alllog.txt")
        SetFont()
    End Sub

    Private Sub UpdateFontSize(ByVal newsize As Integer, Optional ByVal Src As MyControlOLEDBv2.MyLabel = Nothing) '
        AddLog(Admin, "updatefont :  ", "\Alllog.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.CtrlKeyDown Then
                    If offset < 0 Then
                        sender.장높이 -= 10
                    Else
                        sender.장높이 += 10
                    End If
                Else
                    sender.장높이 += offset
                End If
            Else    '//좌우
                If 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
                AddLog(Admin, "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 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 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 NPartternCheck()
        Dim 번호패턴검사 As Integer = 0

        '//패턴검사시작
        ' Me.PictureBox1.Image = Image.FromFile(My.Application.Info.DirectoryPath & "\image\start.png")
        For i As Integer = Me.TB_Pattern_Start.Text To Me.TB_Pattern_End.Text
            '  If chkFlag Then Exit For
            showcnt(i, Me.TB_Pattern_End.Text)

            Me.TB_Pattern_Start.Text = i
            번호패턴검사 = ChkNumPattern(i)
            '  MsgBox(번호패턴검사)

            If 번호패턴검사 = 0 Then    '0은 둘다 없다는 뜻이다 // 3은.. 문자와 길이가 동시에 존재한다는 뜻이다.
                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.TB_Pattern_Start.Text = Me.TB_Pattern_End.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 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

    '---------------------------------
    Public Function PARSE_번호(ByVal srcsTR As String) As Boolean
        'Me.CLEAR_ITEM("X")

        Dim Log As String = "\Parse_번호.txt"
        If srcsTR = "" OrElse Not Me.cb_jjnum.Checked Then
            Me.CLEAR_ITEM("X")
            AddLog(Admin, "번호에대한 내용이 없거나 번호를 표시하지 않도록 체크되어있습니다", Log)
            Return False
        End If

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)
        Return True
    End Function
    Public Function PARSE_번호패턴(ByVal SRCSTR As String) As Integer
        Dim Wlen As Short = SRCSTR.Length : If Wlen <= 0 Then Return 3 '//없는 글귀가 왓을때 턴해버린다.
        Dim SRC() As Char = SRCSTR.ToCharArray
        Dim Log As String = "\Parse_번호패턴.txt"
        Dim SepPos As Short = SRCSTR.IndexOf(";")
        Dim retval As Integer = 0   ''0은 정상 1은 길이패턴없음 2는 3은 길이+문자없음

        '//번호는 길이패턴을 하지않고 문자패턴만 한다.
        Dim pname As String
        Dim Arinini As New MyINI2(drstyle.File)
        Dim CTLPOS() As String  '//위치정보
        Dim CTLFONT() As String
        Dim CTLVISIBLE As Boolean
        Dim PATTERN As String = PATTERN_ENC(SRCSTR)
        Dim TOBJ As MyControlOLEDBv2.MyLabel

        Dim 분리인덱스 As Short = 0
        Dim 번호형식 As String = "999"
        Dim Dr() As DataRow

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

        Dr = dtpattern.Select("NAME = '" & pname & "X1POS'")
        If Dr.GetUpperBound(0) = 0 Then '//데이터가 존재하므로 모두 적용을 한다.
            AddLog(Admin, "번호패턴감지(문자) :  길이=" & Wlen & " 문자열=" & SRCSTR & " 패턴=" & PATTERN, Log)
            '//데이터는 최종적으로 번호형식에서 보낸다.
            분리인덱스 = Arinini.Read(pname, "nseparate", 0)
            번호형식 = Arinini.Read(pname, "LineType", "999")

            For i As Integer = 0 To Me.S전주번호.GetUpperBound(0)
                TOBJ = Me.S전주번호(i)
                TOBJ.Tag = ""   '//기존태그를 삭제한다.
                Try
                    '//상태를 읽어서 바로 적용한다.
                    Dr = dtpattern.Select("NAME = '" & pname & TOBJ.Name & "POS'")
                    If Dr.GetUpperBound(0) = 0 Then
                        CTLPOS = Dr(0)(1).ToString.Split(",")
                        TOBJ.Location = New Point(CTLPOS(0), CTLPOS(1))
                        TOBJ.Size = New Size(CTLPOS(2), CTLPOS(3))
                    End If

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

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

                    Dr = dtpattern.Select("NAME = '" & pname & TOBJ.Name & "SPACE'")
                    If Dr.GetUpperBound(0) = 0 Then
                        TOBJ.공백 = Dr(0)(1).ToString
                    End If
                    TOBJ.Tag = "C"
                Catch ex As Exception
                    AddLog(Admin, "문자패턴오류=" & ex.Message.ToString, Log)
                End Try
            Next
        Else
            AddLog(Admin, "문자패턴불일치 길이=" & Wlen & " 문자열=" & SRCSTR & " 패턴=" & PATTERN, Log)
            retval += 2 '//패턴이 없으므로 바로 넘긴다.
        End If


        If retval = 2 Then  '//문자패턴이 없을경우에만 길이패턴을 확인한다.
            '//길이패턴 확인
            pname = "JJNUMPATTERN" & Wlen

            Dr = dtpattern.Select("NAME = '" & pname & "X1POS'")
            If Dr.GetUpperBound(0) = 0 Then '//데이터가 존재하므로 모두 적용을 한다.
                AddLog(Admin, "번호패턴감지(길이) :  길이=" & Wlen & " 문자열=" & SRCSTR, Log)
                '//데이터는 최종적으로 번호형식에서 보낸다.
                분리인덱스 = Arinini.Read(pname, "nseparate", 0)
                번호형식 = Arinini.Read(pname, "LineType", "999")

                For i As Integer = 0 To Me.S전주번호.GetUpperBound(0)
                    TOBJ = Me.S전주번호(i)
                    TOBJ.Tag = ""   '//기존태그를 삭제한다.
                    Try
                        '//상태를 읽어서 바로 적용한다.
                        Dr = dtpattern.Select("NAME = '" & pname & TOBJ.Name & "POS'")
                        If Dr.GetUpperBound(0) = 0 Then
                            CTLPOS = Dr(0)(1).ToString.Split(",")
                            TOBJ.Location = New Point(CTLPOS(0), CTLPOS(1))
                            TOBJ.Size = New Size(CTLPOS(2), CTLPOS(3))
                        End If

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

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

                        Dr = dtpattern.Select("NAME = '" & pname & TOBJ.Name & "SPACE'")
                        If Dr.GetUpperBound(0) = 0 Then
                            TOBJ.공백 = Dr(0)(1).ToString
                        End If
                        TOBJ.Tag &= "L"
                    Catch ex As Exception
                        AddLog(Admin, "길이 패턴오류=" & ex.Message.ToString, Log)
                    End Try
                Next
            Else
                AddLog(Admin, "길이패턴불일치 기본스타일 복원  길이=" & Wlen & " 문자열=" & SRCSTR, Log)
                retval += 1 '//없다
            End If
        End If

        Me.cmb_sep.SelectedIndex = 분리인덱스

        If 번호형식 = "999" Then    '//패턴이없었다는 말이다 번호형식을 어느정도 맞춰준다.
            'MsgBox("번호형식이 없어서 셋팅합니다(" & 번호 & "/" & 번호.Length)
            If 번호.Length <= 12 Then
                If 번호.Length <= 4 Then
                    번호형식 = 번호.Length & "00"
                ElseIf 번호.Length <= 8 Then
                    번호형식 = "4" & CStr(번호.Length - 4) & "0"
                Else
                    번호형식 = "44" & CStr(번호.Length - 8)
                End If
            Else    '//12자리이상이므로 어덯게 쪼개야할지 3으로나눠서 ..int 대입을 하자
                번호형식 = CStr(Int(번호.Length / 3)) & CStr(Int(번호.Length / 3)) & CStr(번호.Length - Int(번호.Length / 3) * 2)
            End If
            'MsgBox("최종번호=" & 번호형식)
        End If

        Me.tb_ntype.Text = 번호형식

        번호형식지정(Me.tb_ntype.Text)  '//번호형식을 갱신해준다.
        Return retval '// 0이 리턴될것이다. 패턴이 모두 정상이란 뜻이다


    End Function

    Private Function SetXdata(ByVal idx As Short, ByRef Src() As Char) As MyControlOLEDBv2.MyLabel
        If idx > Src.GetUpperBound(0) Then Return Nothing
        Dim A As MyControlOLEDBv2.MyLabel = Me.S전주번호(0)

        For i As Integer = 0 To Me.S전주번호.GetUpperBound(0)
            If Me.S전주번호(i).MyText = "" Then
                Me.S전주번호(i).MyText = Src(idx)
                If i = 11 Then
                    A = Nothing
                Else
                    A = Me.S전주번호(i + 1)
                End If
                Exit For
            End If
        Next
        Return A
    End Function
    Private Function GetnextCtl(ByVal currCtl As MyControlOLEDBv2.MyLabel) As MyControlOLEDBv2.MyLabel
        Dim a As MyControlOLEDBv2.MyLabel = Nothing
        Select Case currCtl.Name.ToUpper
            Case "X1"
                a = Me.S전주번호(1) ' X2
            Case "X2"
                a = Me.S전주번호(2) 'X3
            Case "X3"
                a = Me.S전주번호(3) 'x4
            Case "X4"
                a = Me.S전주번호(4) 'x5
            Case "X5"
                a = Me.S전주번호(5) ' x6
            Case "X6"
                a = Me.S전주번호(6) 'x7
            Case "X7"
                a = Me.S전주번호(7) ' x8
            Case "X8"
                a = Me.S전주번호(8) 'x9
            Case "X9"
                a = Me.S전주번호(9) 'x10
            Case "X10"
                a = Me.S전주번호(10) ' x11
            Case "X11"
                a = Me.S전주번호(11) 'x12
            Case "X12"
                a = Me.S전주번호(12) 'X13
            Case "X13"
                a = Me.S전주번호(13) 'x14
            Case "X14"
                a = Me.S전주번호(14) 'x15
            Case "X15"
                a = Me.S전주번호(15) ' x16
            Case "X16"
                a = Me.S전주번호(16) 'x17
            Case "X17"
                a = Me.S전주번호(17) ' x18
            Case "X18"
                a = Me.S전주번호(18) 'x19
            Case "X19"
                a = Me.S전주번호(19) 'x20
            Case "X20"
                a = Me.S전주번호(20) ' x21
            Case "X21"
                a = Me.S전주번호(21) 'x12
            Case "X22"
                a = Me.S전주번호(22) 'X13
            Case "X23"
                a = Me.S전주번호(23) 'x14
            Case "X24"
                a = Me.S전주번호(24) 'x15
            Case "X25"
                a = Me.S전주번호(25) ' x16
            Case "X26"
                a = Me.S전주번호(26) 'x17
            Case "X27"
                a = Me.S전주번호(27) ' x18
            Case "X28"
                a = Me.S전주번호(28) 'x19
            Case "X29"
                a = Me.S전주번호(29) 'x20
            Case "X30"
                a = Me.S전주번호(30) ' x21
            Case Else
                a = Nothing
        End Select
        Return a
    End Function
    Private Sub 번호형식지정(Optional ByVal msg As String = "999")
        'MsgBox("번호형식지정 : " & 번호, MsgBoxStyle.Information, msg)
        '//지정된 번호형식으로 전부번호를 표시한다.
        '//20070826 번호는 분리/통합으로 구분해서 출력한다.
        Dim A() As Char = 번호.ToCharArray
        Dim P() As String
        If msg.IndexOf(",") = -1 Then '//구버젼 140702
            Dim pp As New List(Of String)
            For Each cc As Char In msg.ToCharArray
                pp.Add(cc)
            Next
            P = pp.ToArray()
        Else
            P = msg.Split(",")
        End If

        Me.CLEAR_ITEM("X")
        '//12자이상은 개별이라고 한다면 해당번호를 혼합으로 바꾼다.
        If Me.cmb_sep.SelectedIndex = -1 OrElse (Me.cmb_sep.SelectedIndex = 1 AndAlso 번호.Length > 30) Then Me.cmb_sep.SelectedIndex = 0

        Dim NextCtl As MyControlOLEDBv2.MyLabel = Me.S전주번호(0)
        Dim CurPos As Short = 0    '//몇번째 컨트롤까지 썻다는 표시
        Dim CPos As Short = 0       '//전체문자중 몇번째까지 했다는 표시

        Dim Limit(P.GetUpperBound(0)) As Short    '//각배열별 한계숫자
        For i As Short = 0 To P.GetUpperBound(0)
            If i = 0 Then
                Limit(i) = CInt(P(i).ToString)
            Else
                Limit(i) = Limit(i - 1) + CInt(P(i).ToString)
            End If
            '   MsgBox("한게값 : " & i & " 값=" & Limit(i))
        Next

        Select Case Me.cmb_sep.SelectedIndex
            Case 0  '//혼합
                '//형식수가 4를 넘지않으면 개별 넘을경우 통합출력으로한다.
                '//연습데이터 3442 : 345 R23L1 R932
                ' MsgBox("번호형식=" & msg & "/" & 번호 & "/p0=" & P(0))
                Me.tb_ntype.Enabled = True  '//분리엿을때 이것이 false 로 된다.
                Dim OK As Short = -1  '//완료 번호형식 배열값
                Dim 사용한컨트롤위치 As Short = -1
                Dim RES As Boolean = False

                For i As Integer = 0 To A.GetUpperBound(0)
                    If CInt(P(OK + 1).ToString) <= 4 Then    '//개별로넣는다
                        If i + 1 < Limit(OK + 1) Then
                            사용한컨트롤위치 += 1
                            Me.S전주번호(사용한컨트롤위치).MyText &= IIf(A(i) <> ";", A(i), "")
                        ElseIf i + 1 = Limit(OK + 1) Then
                            OK += 1 : If OK > Limit.GetUpperBound(0) Then Exit For
                            사용한컨트롤위치 += 1
                            Me.S전주번호(사용한컨트롤위치).MyText &= IIf(A(i) <> ";", A(i), "")
                        End If
                    Else   '//4보다크다면 해당 ok가 끈날때까지 한개의 컨트롤에 넣는다.
                        If RES = False Then
                            사용한컨트롤위치 += 1
                            RES = True
                        End If
                        If i + 1 < Limit(OK + 1) Then
                            Me.S전주번호(사용한컨트롤위치).MyText &= IIf(A(i) <> ";", A(i), "")
                        ElseIf i + 1 = Limit(OK + 1) Then
                            Me.S전주번호(사용한컨트롤위치).MyText &= IIf(A(i) <> ";", A(i), "")
                            OK += 1 : If OK > Limit.GetUpperBound(0) Then Exit For
                            RES = False
                        End If
                    End If
                Next
            Case 1  '//분리 
                Me.tb_ntype.Enabled = False
                For i As Int16 = 0 To A.GetUpperBound(0) '//개별 12개의 열에 데이터를 출력한다.(30개로 늘렷으니 충분할것이다)
                    Me.S전주번호(i).MyText = IIf(A(i) <> ";", A(i), "")
                Next
            Case 2  '//통합
                Me.tb_ntype.Enabled = True
                Dim OK As Short = -1  '//완료 번호형식 배열값
                For i As Integer = 0 To A.GetUpperBound(0)
                    If i < Limit(OK + 1) Then
                        Me.S전주번호(OK + 1).MyText &= IIf(A(i) <> ";", A(i), "")
                    ElseIf i = Limit(OK + 1) Then
                        OK += 1 : If OK + 1 > Limit.GetUpperBound(0) Then Exit For
                        Me.S전주번호(OK + 1).MyText &= IIf(A(i) <> ";", A(i), "")
                    End If
                Next
        End Select

        For i As Integer = 0 To Me.S전주번호.GetUpperBound(0)
            Me.S전주번호(i).Visible = IIf(Me.S전주번호(i).MyText = "", False, True)
        Next
    End Sub

    Public Function PARSE_관리구(ByVal srcstr As String) As Boolean
        '/선로명의 길이는 예측되지 않는다 동적 컨트롤 생성을 사용한다.
        ' MsgBox("PARSET_관리구")
        Me.CLEAR_ITEM("H")
        Dim Log As String = "\Parse_관리구.txt"
        If srcstr = "" OrElse Not Me.cb_kwang.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        For i As Integer = 0 To Wlen - 1   '//모든문자를 할당한다.
            Try
                S관리구(i).MyText = SRC(i).ToString
                S관리구(i).Visible = True
            Catch ex As Exception
                Exit For
            End Try
            'S관리구(i) = New MyControlOLEDBv2.MyLabel

            ' MsgBox(S관리구(i).MyText)

        Next
        Return True
    End Function
    Public Sub PARSE_관리구패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_관리구패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        '길이패턴여부를 확인했으므로 패턴을적용한다.[STYLE1LINEPATTERN9]

        'Dim lpattern As Boolean = False
        Dim Pname As String = "CNUMPATTERN" & Wlen
        'Dim Sname As String
        Dim CTLPOS() As String
        Dim CTLFONT() As String
        Dim CTLVISIBLE As Boolean
        Dim Arinini As New MyINI2(drstyle.File)
        'Dim tobj As MyControlOLEDBv2.MyLabel
        Dim Dr() As DataRow
        'Dim idx As Short = 0
        'Me.길이패턴연습(srcstr, Pname, Log, "H", S관리구)

        Pname = "CNUMPATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, S관리구)

        '//관리구5번 알파벳 지정이되어있는지 확인한다.
        Pname = "CNUMPATTERNI" & S관리구(4).MyText ' Me.h5.MyText '//5번이 W 일때는 cnumpatternIw 를 찾게된다.
        Dr = dtpattern.Select("NAME = '" & Pname & "DESC'")

        If Dr.GetUpperBound(0) = 0 Then '//있다.
            AddLog(Admin, "관리구5번 문자를 찾았습니다 (" & Pname & "DESC" & ")", Log)
            Dr = dtpattern.Select("NAME = '" & Pname & S관리구(4).Name & "POS'")
            If Dr.GetUpperBound(0) = 0 Then
                CTLPOS = Dr(0)(1).ToString.Split(",")
                Me.S관리구(4).Location = New Point(CTLPOS(0), CTLPOS(1))
                Me.S관리구(4).Size = New Size(CTLPOS(2), CTLPOS(3))
            End If

            Dr = dtpattern.Select("NAME = '" & Pname & S관리구(4).Name & "FONT'")
            If Dr.GetUpperBound(0) = 0 Then
                CTLFONT = Dr(0)(1).ToString.Split(",")
                S관리구(4).MyFont = New Font(CTLFONT(0), CTLFONT(1), IIf(CTLFONT(3).ToUpper = "TRUE", FontStyle.Bold, FontStyle.Regular), GraphicsUnit.Point)
                S관리구(4).장평 = CTLFONT(5)
                S관리구(4).장높이 = CTLFONT(6)
            End If
            Dr = dtpattern.Select("NAME = '" & Pname & S관리구(4).Name & "VISIBLE'")
            If Dr.GetUpperBound(0) = 0 Then
                CTLVISIBLE = Dr(0)(1).ToString
                S관리구(4).Visible = CType(CTLVISIBLE, Boolean)
            End If
            Dr = dtpattern.Select("NAME = '" & Pname & S관리구(4).Name & "SPACE'")
            If Dr.GetUpperBound(0) = 0 Then
                S관리구(4).공백 = Dr(0)(1)
            End If
        Else
            AddLog(Admin, "관리구5번 문자가 지정되어있지않습니다. (" & S관리구(4).MyText & ")", Log)
        End If
    End Sub

    Public Function PARSE_DL11(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("I")
        Dim Log As String = "\Parse_DL11명.txt"
        If srcstr = "" OrElse Not Me.cb_dl1.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL11(0).MyText = Me.Dl11
        Me.SDL11(0).Visible = True


        Return True
    End Function
    Public Function PARSE_DL12(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("C")
        Dim Log As String = "\Parse_DL12명.txt"
        If srcstr = "" OrElse Not Me.cb_dl1.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL12(0).MyText = Me.Dl12
        Me.SDL12(0).Visible = True

        Return True
    End Function
    'Public Function PARSE_DL13(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("C")
    '    Dim Log As String = "\Parse_DL13명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl1.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL13(0).MyText = Me.Dl13
    '    Me.SDL13(0).Visible = True

    '    Return True
    'End Function
    'Public Function PARSE_DL14(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("C")
    '    Dim Log As String = "\Parse_DL14명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl1.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL14(0).MyText = Me.Dl14
    '    Me.SDL14(0).Visible = True

    '    Return True
    'End Function
    'Public Function PARSE_DL15(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("C")
    '    Dim Log As String = "\Parse_DL15명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl1.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL15(0).MyText = Me.Dl15
    '    Me.SDL15(0).Visible = True

    '    Return True
    'End Function

    Public Sub PARSE_DL11명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl11명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL11PATTERN" & Wlen
        'Me.길이패턴연습(srcstr, Pname, Log, "I", SDL11)

        Pname = "DL11PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL11)

    End Sub
    Public Sub PARSE_DL12명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl12명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL12PATTERN" & Wlen
        ' Me.길이패턴연습(srcstr, Pname, Log, "C", SDL12)

        Pname = "DL12PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL12)

    End Sub
    'Public Sub PARSE_DL13명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl13명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL13PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "C", SDL12)

    '    Pname = "DL13PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL13)

    'End Sub
    'Public Sub PARSE_DL14명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl14명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL14PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "C", SDL12)

    '    Pname = "DL14PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL14)

    'End Sub
    'Public Sub PARSE_DL15명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl15명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL15PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "C", SDL12)

    '    Pname = "DL15PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL15)

    'End Sub

    Public Function PARSE_DL21(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("J")
        Dim Log As String = "\Parse_DL21명.txt"
        If srcstr = "" OrElse Not Me.cb_dl2.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL21(0).MyText = Me.Dl21
        Me.SDL21(0).Visible = True

        Return True
    End Function
    Public Function PARSE_DL22(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("F")
        Dim Log As String = "\Parse_DL22명.txt"
        If srcstr = "" OrElse Not Me.cb_dl2.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL22(0).MyText = Me.Dl22
        Me.SDL22(0).Visible = True

        Return True
    End Function
    'Public Function PARSE_DL23(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("F")
    '    Dim Log As String = "\Parse_DL23명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl2.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL23(0).MyText = Me.Dl23
    '    Me.SDL23(0).Visible = True

    '    Return True
    'End Function
    'Public Function PARSE_DL24(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("F")
    '    Dim Log As String = "\Parse_DL24명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl2.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL24(0).MyText = Me.Dl24
    '    Me.SDL24(0).Visible = True

    '    Return True
    'End Function
    'Public Function PARSE_DL25(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("F")
    '    Dim Log As String = "\Parse_DL25명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl2.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL25(0).MyText = Me.Dl25
    '    Me.SDL25(0).Visible = True

    '    Return True
    'End Function

    Public Sub PARSE_DL21명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl2명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL21PATTERN" & Wlen
        '   Me.길이패턴연습(srcstr, Pname, Log, "J", SDL21)

        Pname = "DL21PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL21)

    End Sub
    Public Sub PARSE_DL22명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl2명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL22PATTERN" & Wlen
        'Me.길이패턴연습(srcstr, Pname, Log, "F", SDL22)

        Pname = "DL22PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL22)

    End Sub
    'Public Sub PARSE_DL23명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl23명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL23PATTERN" & Wlen
    '    'Me.길이패턴연습(srcstr, Pname, Log, "F", SDL22)

    '    Pname = "DL23PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL23)

    'End Sub
    'Public Sub PARSE_DL24명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl24명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL24PATTERN" & Wlen
    '    'Me.길이패턴연습(srcstr, Pname, Log, "F", SDL22)

    '    Pname = "DL24PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL24)

    'End Sub
    'Public Sub PARSE_DL25명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl25명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL25PATTERN" & Wlen
    '    'Me.길이패턴연습(srcstr, Pname, Log, "F", SDL22)

    '    Pname = "DL25PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL25)

    'End Sub

    Public Function PARSE_DL31(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("K")
        Dim Log As String = "\Parse_DL31명.txt"
        If srcstr = "" OrElse Not Me.cb_dl3.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL31(0).MyText = Me.Dl31
        Me.SDL31(0).Visible = True
        Return True
    End Function
    Public Function PARSE_DL32(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("M")
        Dim Log As String = "\Parse_DL32명.txt"
        If srcstr = "" OrElse Not Me.cb_dl3.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If
        AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        Me.SDL32(0).MyText = Me.Dl32
        Me.SDL32(0).Visible = True
        Return True
    End Function
    'Public Function PARSE_DL33(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("M")
    '    Dim Log As String = "\Parse_DL33명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl3.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL33(0).MyText = Me.Dl33
    '    Me.SDL33(0).Visible = True
    '    Return True
    'End Function
    'Public Function PARSE_DL34(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("M")
    '    Dim Log As String = "\Parse_DL34명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl3.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL34(0).MyText = Me.Dl34
    '    Me.SDL34(0).Visible = True
    '    Return True
    'End Function
    'Public Function PARSE_DL35(ByVal srcstr As String) As Boolean
    '    Me.CLEAR_ITEM("M")
    '    Dim Log As String = "\Parse_DL35명.txt"
    '    If srcstr = "" OrElse Not Me.cb_dl3.Checked Then
    '        AddLog(Admin, "Zero Length - Return", Log)
    '        Return False
    '    End If
    '    AddLog(Admin, "Start Parse [DL:" & srcstr & "]", Log)

    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")

    '    AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

    '    Me.SDL35(0).MyText = Me.Dl35
    '    Me.SDL35(0).Visible = True
    '    Return True
    'End Function

    Public Sub PARSE_DL31명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl31명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL31PATTERN" & Wlen
        ' Me.길이패턴연습(srcstr, Pname, Log, "K", SDL31)

        Pname = "DL31PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL31)

    End Sub
    Public Sub PARSE_DL32명패턴(ByVal srcstr As String)
        Dim Log As String = "\Parse_dl32명패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "DL32PATTERN" & Wlen
        ' Me.길이패턴연습(srcstr, Pname, Log, "M", SDL32)

        Pname = "DL32PATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, SDL32)

    End Sub
    'Public Sub PARSE_DL33명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl33명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL33PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "M", SDL32)

    '    Pname = "DL33PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL33)

    'End Sub
    'Public Sub PARSE_DL34명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl34명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL34PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "M", SDL32)

    '    Pname = "DL34PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL34)

    'End Sub
    'Public Sub PARSE_DL35명패턴(ByVal srcstr As String)
    '    Dim Log As String = "\Parse_dl35명패턴.txt"
    '    Dim Wlen As Short = srcstr.Length
    '    Dim SepPos As Short = srcstr.IndexOf(";")
    '    Dim SrC() As Char = srcstr.ToCharArray

    '    Dim Pname As String = "DL35PATTERN" & Wlen
    '    ' Me.길이패턴연습(srcstr, Pname, Log, "M", SDL32)

    '    Pname = "DL35PATTERNII" & PATTERN_ENC(srcstr)
    '    Me.문자패턴연습(srcstr, Pname, Log, SDL35)

    'End Sub

    Public Function PARSE_전산번호(ByVal srcstr As String) As Boolean
        '/선로명의 길이는 예측되지 않는다 동적 컨트롤 생성을 사용한다.
        Me.CLEAR_ITEM("S")
        Dim Log As String = "\Parse_전산번호.txt"
        If srcstr = "" OrElse Not Me.cb_kwang.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)
        '/선로명의 길이는 예측되지 않는다 동적 컨트롤 생성을 사용한다.
        For i As Integer = 0 To Wlen - 1   '//모든문자를 할당한다.
            Try
                S전산번호(i).MyText = SRC(i).ToString
            Catch ex As Exception
                Exit For
            End Try

            'MsgBox("전산번호=" & S전산번호(i).MyText)
        Next
        Return True
    End Function
    Public Sub PARSE_전산번호패턴(ByVal srcstr As String)

        Dim Log As String = "\Parse_전산번호패턴.txt"
        Dim Wlen As Short = srcstr.Length
        Dim SepPos As Short = srcstr.IndexOf(";")
        Dim SrC() As Char = srcstr.ToCharArray

        Dim Pname As String = "JNUMPATTERN" & Wlen
        '  Me.길이패턴연습(srcstr, Pname, Log, "S", S전산번호)

        Pname = "JNUMPATTERNII" & PATTERN_ENC(srcstr)
        Me.문자패턴연습(srcstr, Pname, Log, S전산번호)
    End Sub

    Public Sub PARSE_선로명패턴(ByVal Srcstr As String)
        Dim Log As String = "\Parse_선로명패턴.txt"
        Dim Wlen As Short = Srcstr.Length : If Wlen <= 0 Then Return
        Dim Src() As Char = Srcstr.ToCharArray
        Dim SepPos As Short = Srcstr.IndexOf(";")

        '길이패턴여부를 확인했으므로 패턴을적용한다.[STYLE1LINEPATTERN9]
        Dim Pname As String = "LINEPATTERN" & Wlen

        ' Me.길이패턴연습(Srcstr, Pname, Log, "L", S선로명)
        '//패턴1이 끝났다 패턴2를 찾는다.
        '//패턴2는 style1LInepatternII문자숫자형식
        Pname = "LINEPATTERNII" & PATTERN_ENC(선로명)
        Me.문자패턴연습(Srcstr, Pname, Log, Me.S선로명)


    End Sub
    Public Function PARSE_선로명(ByVal srcstr As String) As Boolean
        Me.CLEAR_ITEM("L")
        '/선로명의 길이는 예측되지 않는다 동적 컨트롤 생성을 사용한다.
        Dim Log As String = "\Parse_선로명.txt"
        If srcstr = "" OrElse Not Me.cb_sunglo.Checked Then
            AddLog(Admin, "Zero Length - Return", Log)
            Return False
        End If

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

        AddLog(Admin, "Length=" & Wlen & "   Sep=" & SepPos, Log)

        For i As Integer = 0 To Wlen - 1   '//모든문자를 할당한다.
            Try
                If SRC(i) = ";" Then
                    S선로명(i).MyText = "---"

                End If
                Select Case SRC(i)
                    Case ";"
                        S선로명(i).MyText = "---"
                    Case ":"
                        S선로명(i).MyText = ""
                    Case Else
                        S선로명(i).MyText = SRC(i)
                End Select
                S선로명(i).Visible = True
            Catch ex As Exception
                Exit For
            End Try

        Next
        Return True
    End Function

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

    Private Sub GetPrintersName()
        AddLog(Admin, "GetPrinterName()", "\Alllog.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
            'If Me.cb_dummy.Checked AndAlso Me.cmb_dummy.SelectedIndex = 1 And Me.BindingSource1.Position >= 0 AndAlso Me.BindingSource1.Position + 1 < Me.BindingSource1.Count Then   '//현재인덱스가 최고값보다 작으면
            'Me.BindingSource1.Position += 2
            'Else
            Me.BindingSource1.Position += 1
            'End If
            'Me.BindingNavigatorMoveNextItem.PerformClick()
            'Me.BindingNavigatorPositionItem.Focus()
            'End If
        Else

            If Me.BindingNavigatorPositionItem.Text > 0 Then
                'If Me.cb_dummy.Checked AndAlso Me.cmb_dummy.SelectedIndex = 1 And Me.BindingSource1.Position >= 0 AndAlso Me.BindingSource1.Position + 1 < Me.BindingSource1.Count Then   '//현재인덱스가 최고값보다 작으면
                ' Me.BindingSource1.Position -= 2
                'Else
                Me.BindingSource1.Position -= 1
                'End If
                '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 Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        '//고관리구 5번 저장
        Dim msg As New System.Text.StringBuilder
        msg.AppendLine("관리구5번  영문자(" & Me.S관리구(4).MyText & " )문자에대한 스타일을 저장합니다")
        msg.AppendLine()
        msg.AppendLine("저장후 관리구5번에 동일한 영문자가 올경우에 저장된 내용이 반영됩니다")
        msg.AppendLine("------------------")
        msg.AppendLine("글꼴 = " & Me.S관리구(4).MyFont.ToString)
        msg.AppendLine("너비 = " & Me.S관리구(4).장평)
        msg.AppendLine("높이 = " & Me.S관리구(4).장높이)
        msg.AppendLine("좌표 = " & Me.S관리구(4).Location.ToString)
        msg.AppendLine("------------------")
        msg.AppendLine(" 저장하시겠습니까?")

        If MsgBox(msg.ToString, MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "저장확인") <> MsgBoxResult.Ok Then
            NOTICE("취소되었습니다", Me.lb_msg)
            Return
        End If
        '이건 길이패턴 저장하는 함수다.
        'MsgBox(drstyle.File)

        Dim Arinini As New MyINI2(drstyle.File)
        Dim TOBJ As MyControlOLEDBv2.MyLabel = Me.S관리구(4)
        Dim Pname As String = "CNUMPATTERNI" & TOBJ.MyText '//5번이 W 일때는 cnumpatternIw 를 찾게된다.

        Arinini.Write(Pname, "DESC", "영문자 특수저장(" & TOBJ.MyText & ")")
        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.공백)

        NOTICE("관리구5번 의 영문자 (" & TOBJ.MyText & ") 상태를 저장하였습니다", Me.lb_msg)
        데이터테이블갱신()
    End Sub



#Region "Not Edit"

    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 fmt As New StringFormat(StringFormatFlags.LineLimit)
        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

        '//쉐이프를 먼저 그린다.
        If Me.chk_draw.Checked Then
            '//라인을 그린다.
            For Each Rect As S_Line In Draw_Line
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                Ga.DrawLine(Pen, Rect.X, Rect.Y, Rect.X2, Rect.Y2)
            Next
            '//박스를 그린다.
            For Each Rect As S_Box In Draw_Box
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                Ga.DrawRectangle(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height)
            Next
            '//원를 그린다.
            For Each Rect As S_Circle In Draw_Circle
                Dim Pen As New Drawing.Pen(Rect.PenColor, Rect.PenWidth)
                Ga.DrawEllipse(Pen, Rect.X, Rect.Y, Rect.Width, Rect.Height)
            Next
        End If
        If 관리구 <> "" Then
            Try
                '// qr코드를 그린다
                For Each Rect As S_QRCode In Draw_QRcode
                    'Dim scale As Int16
                    Dim version As Int16
                    Dim image As Image
                    Dim data As String
                    Dim errorCorrect As String
                    Dim qrCodeEncoder1 As New QRCodeEncoder()
                    Dim encoding As String
                    encoding = cboEncoding.Text
                    If encoding = "3" Then
                        qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.BYTE
                    ElseIf encoding = "1" Then
                        qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC
                    ElseIf encoding = "2" Then
                        qrCodeEncoder1.QRCodeEncodeMode = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ENCODE_MODE.NUMERIC
                        '     Try
                        'scale = Convert.ToInt16(txtSize.Text)
                        'qrCodeEncoder.QRCodeScale = scale
                        'Catch ex As Exception
                        ' MessageBox.Show("Invalid size!")
                        ' End Try
                        Try
                            version = Convert.ToInt16(cboVersion.Text)
                            qrCodeEncoder1.QRCodeVersion = version
                        Catch ex As Exception
                            MessageBox.Show("Invaild Version!")
                        End Try
                    End If

                    errorCorrect = cboCorrectionLevel.Text
                    If errorCorrect = "1" Then
                        qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.L
                    ElseIf errorCorrect = "2" Then
                        qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.M
                    ElseIf errorCorrect = "3" Then
                        qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.Q
                    ElseIf errorCorrect = "4" Then
                        qrCodeEncoder1.QRCodeErrorCorrect = ThoughtWorks.QRCode.Codec.QRCodeEncoder.ERROR_CORRECTION.H
                    End If

                    data = 관리구            'data설정 임시
                    If lbQrBg.BackColor <> Drawing.Color.White Then qrCodeEncoder1.QRCodeBackgroundColor = lbQrBg.BackColor
                    If lbQrFG.BackColor <> Drawing.Color.Black Then qrCodeEncoder1.QRCodeForegroundColor = lbQrFG.BackColor
                    image = qrCodeEncoder1.Encode(data, Ga.DpiX, Ga.DpiY)
                    If Rect.Width = 0 OrElse Rect.Height = 0 Then
                        'Ga.DrawImage(image, Rect.X + MyProperty_Paper.출력여백X, Rect.Y + MyProperty_Paper.출력여백Y)
                        Ga.DrawImage(image, Rect.X, Rect.Y)
                    Else
                        'Ga.DrawImage(image, Rect.X + MyProperty_Paper.출력여백X, Rect.Y + MyProperty_Paper.출력여백Y, Rect.Width, Rect.Height)
                        Ga.DrawImage(image, Rect.X, Rect.Y, Rect.Width, Rect.Height)
                    End If
                Next
            Catch ex As Exception
                MessageBox.Show(ex.ToString())
            End Try
        End If


        If Me.tb_pagerepeat.Text = "" Or Me.tb_pagerepeat.Text < 1 Then Me.tb_pagerepeat.Text = "0"

        For pi As Short = 0 To Me.tb_pagerepeat.Text - 1  '//페이지당 연속출력할 횟수
            For i As Integer = 0 To Me.AllLabels.GetUpperBound(0)   '//모든 개체들에 대해서 인쇄를 설정한다.
                obj = Me.AllLabels(i).ctl
                If obj.Visible AndAlso obj.MyText <> "" Then   '//화면에 보이는것만 한다.                

                    For rcnt As Short = 0 To obj.Repeat '//반복기능추가한다
                        NewFontSize = obj.MyFont.Size + Me.tb_myfontsize.Text
                        If NewFontSize < 0 Then NewFontSize = 0

                        If pi > 0 Then   '//연속출력에의한 샊깔변경
                            Brush = New SolidBrush(Drawing.Color.DarkKhaki) '//전경색으로 브러쉬를 만든다.
                        Else
                            If rcnt > 0 Then '//더미출력에의한 색깔변경
                                Brush = New SolidBrush(Drawing.Color.LightGray) '//전경색으로 브러쉬를 만든다.
                            Else
                                Brush = New SolidBrush(obj.MyForeColor) '//전경색으로 브러쉬를 만든다.
                            End If
                        End If

                        MyFont = New Font(obj.MyFont.FontFamily, NewFontSize, obj.MyFont.Style)
                        If obj.장평 = 100 AndAlso obj.장높이 = 100 Then '//장평미사용 문자열 처리
                            Ga.DrawString(obj.최종문자, MyFont, Brush, (obj.Left + Me.tb_secX.Text * pi + obj.RepeatX * rcnt), (obj.Top + Me.tb_secY.Text * pi + obj.RepeatY * rcnt))
                        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))
                            If rcnt > 0 Then
                                G.DrawString(obj.최종문자, MyFont, Brushes.LightGray, 0, 0)
                                G.Dispose()
                                Ga.DrawImage(BMP, New Point(obj.Left + Me.tb_secX.Text * pi + obj.RepeatX * rcnt, obj.Top + Me.tb_secY.Text * pi + obj.RepeatY * rcnt)) ', CInt(GetSize.Width * (v장평 / 100)), GetSize.Height)
                            Else
                                G.DrawString(obj.최종문자, MyFont, Brush, 0, 0)
                                G.Dispose()
                                Ga.DrawImage(BMP, New Point(obj.Left + Me.tb_secX.Text * pi, obj.Top + Me.tb_secY.Text * pi)) ', CInt(GetSize.Width * (v장평 / 100)), GetSize.Height)
                            End If
                        End If
                    Next
                End If
            Next
        Next
        Ga.Dispose()
        Me.PictureBox1.Image = BackScr
    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 CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.GeTviewData(Me.BindingSource1.Position, True)
    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
        If SelCon Is Nothing Then
            MsgBox("선택된 개체가 없습니다", MsgBoxStyle.Critical, "확인")
            Return
        End If
        For Each A As Control In SelCon
            CType(A, MyControlOLEDBv2.MyLabel).장평 = CInt(Me.tb_wordwidth.Text)
        Next
        ViewProperty(SelCon(0))
        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
        If SelCon Is Nothing Then
            MsgBox("선택된 개체가 없습니다", MsgBoxStyle.Critical, "확인")
            Return
        End If
        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)
        Next
        ViewProperty(SelCon(0))
        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
        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
        For Each a As MyControlOLEDBv2.MyLabel In SelCon
            a.MyFont = CType(SelCon(0), MyControlOLEDBv2.MyLabel).MyFont
            a.장평 = CType(SelCon(0), MyControlOLEDBv2.MyLabel).장평
            a.장높이 = CType(SelCon(0), MyControlOLEDBv2.MyLabel).장높이
            a.공백 = CType(SelCon(0), MyControlOLEDBv2.MyLabel).공백
        Next
        Me.ViewProperty(CType(SelCon(0), MyControlOLEDBv2.MyLabel))
        Me.preview_window()
    End Sub
    Private Sub VScrollBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles VScrollBar1.ValueChanged
        Debug.Print("ValueChange Current : " & Me.VScrollBar1.Value)

    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 If

    End Sub
    Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
        Dim SelItem As New ArrayList

        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
                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 = Drawing.Color.Black
                        SelCon.Remove(obj)
                        Exist = True
                        Exit For
                    End If
                Next
                If Exist = False Then
                    SelCon.Add(Tobj)
                    Tobj.MyForeColor = Drawing.Color.Tomato
                End If
            ElseIf e.Button = Windows.Forms.MouseButtons.Left Then '왼쪽클리이면 지우고 다시 셋팅


                '//여기서 컨트롤이 눌렸으면 해당 그룹의 아이템 전체를 가져온다.
                For Each SC As MyControlOLEDBv2.MyLabel In SelCon
                    SC.MyForeColor = Drawing.Color.Black
                Next
                SelCon.Clear()
                SelCon.Add(Tobj)
                Tobj.MyForeColor = Drawing.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 = Drawing.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 = Drawing.Color.Black
        Next
        SelCon.Clear()
        SelCon.Add(AllLabels(Me.cmb_controls.SelectedIndex).ctl)
        AllLabels(Me.cmb_controls.SelectedIndex).ctl.MyForeColor = Drawing.Color.DodgerBlue
        ViewProperty(AllLabels(Me.cmb_controls.SelectedIndex).ctl)
        Me.preview_window()
    End Sub
    Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If MsgBox("현재 스타일(기본)을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "스타일저장") = MsgBoxResult.Yes Then
            SAVE_STYLE()
        Else
            NOTICE("스타일(기존)저장이 취소되었습니다", Me.lb_msg)
        End If

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

    Private Sub 문자패턴연습(ByVal srcstr As String, ByVal pname As String, ByVal log As String, ByVal S라벨() As MyControlOLEDBv2.MyLabel)
        Dim Wlen As Short = srcstr.Length : If Wlen <= 0 Then Return '//없는 글귀가 왓을때 턴해버린다.
        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 '//길이패턴이 있으면
            AddLog(Admin, "(찾음)  문자패턴 검색 길이=" & 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 &= "C"
                Catch ex As Exception
                    AddLog(Admin, "문자패턴오류 길이=" & Wlen & " Message=" & ex.Message.ToString, log)
                End Try
            Next
        Else
            AddLog(Admin, "문자패턴불일치 길이=" & Wlen & " 문자열=" & srcstr, log)
            AddLog(Admin, S라벨(0).설명 & "/" & S라벨(0).최종문자, log)
            'MsgBox(S라벨.GetUpperBound(0))
            Me.LOAD_STYLE(S라벨(0).DIV)
        End If
    End Sub
    Private Sub 기본ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If MsgBox("현재 스타일(기본)을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "스타일저장") = MsgBoxResult.Yes Then
            SAVE_STYLE()
        Else
            NOTICE("스타일(기존)저장이 취소되었습니다", Me.lb_msg)
        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
                If e.Control Then
                    Me.gfdlStripMenuItem.PerformClick()
                End If
            Case Keys.F5
                Me.gfdlStripMenuItem.PerformClick()
            Case Keys.F4 '//관리구5번저장
                Me.Button8.PerformClick()
            Case Keys.F7
                Me.bt_print.PerformButtonClick()
            Case Keys.F8
                Me.bt_prnpreview.PerformClick()
        End Select

    End Sub
    Private Sub SaveReadLayOut(ByVal read As Boolean)   '//현재 화면구성을 가로/세로 결정합니다.
        '//ini파일에저장한다. 섹션명은 pagetype0 ,pagetyp1  0은 세로 1은 가로다
        '  MsgBox(drstyle.File)

        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, "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))
                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 = 1
                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))
                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
        'MsgBox(Me.PictureBox1.Size.ToString)
    End Sub
    Private Sub bt_print_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 ToolStripButton2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        Process.Start(My.Application.Info.DirectoryPath & "\help\printform1.htm")
    End Sub
    Private Sub cm_styleeditoolStripMenuItem_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 ToolStripLabel2_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel2.ButtonClick
        If MsgBox("현재 스타일(기본)을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "스타일저장") = MsgBoxResult.Yes Then
            SAVE_STYLE()
        Else
            NOTICE("스타일(기존)저장이 취소되었습니다", Me.lb_msg)
        End If
    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 BindingNavigatorPositionItem_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles BindingNavigatorPositionItem.MouseEnter
        Me.BindingNavigatorPositionItem.Focus()
        Me.BindingNavigatorPositionItem.SelectAll()
    End Sub
    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 ToolStripTextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_ntype.KeyUp
        If e.KeyCode = Keys.Enter Then
            If Me.cmb_sep.SelectedIndex = 1 Then
                NOTICE("분리상태에서는 번호지정이 불가능합니다", Drawing.Color.Red, Me.lb_msg)
            Else
                번호형식지정(Me.tb_ntype.Text)
            End If
            Me.preview_window()
        End If
    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

#End Region



    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 Refresh_Drawlist()
        '//;라인하고 박스를 읽어서 리스트박스에
        Me.ListBox1.Items.Clear()
        Dim I As Short = 0
        For Each Rect As S_Line In Draw_Line
            Me.ListBox1.Items.Add("선(" & Rect.X & "," & Rect.Y & "," & Rect.X2 & "," & Rect.Y2 & "):" & I)
            I += 1
        Next
        I = 0
        For Each Rect As S_Box In Draw_Box
            Me.ListBox1.Items.Add("박스(" & Rect.X & "," & Rect.X & "," & Rect.Width & "," & Rect.Height & "):" & I)
            I += 1
        Next
        I = 0

        For Each Rect As S_Circle In Draw_Circle
            Me.ListBox1.Items.Add("원(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "):" & I)
            I += 1
        Next
        I = 0

        For Each Rect As S_QRCode In Draw_QRcode
            Me.ListBox1.Items.Add("QR(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "):" & I)
            I += 1
        Next
        I = 0
        preview_window()
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        '//선추가
        Dim NewLine As New S_Line
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = Draw_Line.Count * 10
        NewLine.Y = 10
        NewLine.X2 = 100 + Draw_Line.Count * 10
        NewLine.Y2 = NewLine.X2

        Draw_Line.Add(NewLine)
        Refresh_Drawlist()

    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        '//선추가
        Dim NewLine As New S_Box
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = Draw_Box.Count * 10
        NewLine.Y = Draw_Box.Count * 10
        NewLine.Width = 100 + Draw_Box.Count * 10
        NewLine.Height = NewLine.Width
        Draw_Box.Add(NewLine)
        Refresh_Drawlist()
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        If Me.ListBox1.SelectedIndex < 0 Then Return
        Select Case Me.ListBox1.Text.Substring(0, 1)
            Case "선"
                Dim Line As S_Line = Draw_Line(Me.ListBox1.Text.Split(":")(1))
                Me.bt_pencolor.BackColor = Line.PenColor
                Me.tb_pensize.Text = Line.PenWidth
                Me.tb_dx.Text = Line.X
                Me.tb_dy.Text = Line.Y
                Me.tb_dw.Text = Line.X2
                Me.tb_dh.Text = Line.Y2
            Case "박"
                Dim Line As S_Box = Draw_Box(Me.ListBox1.Text.Split(":")(1))
                Me.bt_pencolor.BackColor = Line.PenColor
                Me.tb_pensize.Text = Line.PenWidth
                Me.tb_dx.Text = Line.X
                Me.tb_dy.Text = Line.Y
                Me.tb_dw.Text = Line.Width
                Me.tb_dh.Text = Line.Height
            Case "원"
                Dim Line As S_Circle = Draw_Circle(Me.ListBox1.Text.Split(":")(1))
                Me.bt_pencolor.BackColor = Line.PenColor
                Me.tb_pensize.Text = Line.PenWidth
                Me.tb_dx.Text = Line.X
                Me.tb_dy.Text = Line.Y
                Me.tb_dw.Text = Line.Width
                Me.tb_dh.Text = Line.Height
            Case "Q"
                Dim Line As S_QRCode = Draw_QRcode(Me.ListBox1.Text.Split(":")(1))
                Me.tb_dx.Text = Line.X
                Me.tb_dy.Text = Line.Y
                Me.tb_dw.Text = Line.Width
                Me.tb_dh.Text = Line.Height
        End Select
    End Sub

    Private Sub tb_pensize_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_pensize.KeyDown, tb_dx.KeyDown, tb_dy.KeyDown, tb_dw.KeyDown, tb_dh.KeyDown
        If Me.ListBox1.SelectedIndex < 0 Then Return
        Dim SI As Short = Me.ListBox1.SelectedIndex
        If e.KeyCode = Keys.Enter Then
            '//새로만들어서 저장한다.
            Set_NewDraw()
            Me.Refresh_Drawlist()
            Me.ListBox1.SelectedIndex = SI
        End If

    End Sub

    Private Sub Set_NewDraw()
        Select Case Me.ListBox1.Text.Substring(0, 1)
            Case "선"
                Dim Line As New S_Line
                Line.PenColor = Me.bt_pencolor.BackColor
                Line.PenWidth = Me.tb_pensize.Text
                Line.X = Me.tb_dx.Text
                Line.Y = Me.tb_dy.Text
                Line.X2 = Me.tb_dw.Text
                Line.Y2 = Me.tb_dh.Text
                Draw_Line(Me.ListBox1.Text.Split(":")(1)) = Line
                'MsgBox("선재구성")
            Case "박"
                Dim Line As New S_Box
                Line.PenColor = Me.bt_pencolor.BackColor
                Line.PenWidth = Me.tb_pensize.Text
                Line.X = Me.tb_dx.Text
                Line.Y = Me.tb_dy.Text
                Line.Width = Me.tb_dw.Text
                Line.Height = Me.tb_dh.Text
                Draw_Box(Me.ListBox1.Text.Split(":")(1)) = Line
                'MsgBox("박스재구성")
            Case "원"
                Dim Line As New S_Circle
                Line.PenColor = Me.bt_pencolor.BackColor
                Line.PenWidth = Me.tb_pensize.Text
                Line.X = Me.tb_dx.Text
                Line.Y = Me.tb_dy.Text
                Line.Width = Me.tb_dw.Text
                Line.Height = Me.tb_dh.Text
                Draw_Circle(Me.ListBox1.Text.Split(":")(1)) = Line
                'MsgBox("원재구성")
            Case "Q"
                Dim Line As New S_QRCode
                Line.X = Me.tb_dx.Text
                Line.Y = Me.tb_dy.Text
                Line.Width = Me.tb_dw.Text
                Line.Height = Me.tb_dh.Text
                Draw_QRcode(Me.ListBox1.Text.Split(":")(1)) = Line
        End Select
    End Sub

    Private Sub bt_pencolor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_pencolor.Click
        Dim CD As New ColorDialog
        CD.Color = Me.bt_pencolor.BackColor
        If CD.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Me.bt_pencolor.BackColor = CD.Color
        Set_NewDraw()
    End Sub

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

        Dim bname As String = "DrawBox"
        Dim lname As String = "DrawLine"
        Dim cname As String = "DrawCircle"
        Dim qname As String = "DrawQRcode"
        Dim bcnt, lcnt, ccnt, qcnt As Short

        If read = False Then
            ini.Write(bname, "Count", Draw_Box.Count)
            For i As Short = 1 To Draw_Box.Count '//모두돌아서 저장한다.
                Dim L As S_Box = Draw_Box(i - 1)
                ini.Write(bname, "box" & i & "pencolor", L.PenColor.ToArgb)
                ini.Write(bname, "box" & i & "pensize", L.PenWidth)
                ini.Write(bname, "box" & i & "x", L.X)
                ini.Write(bname, "box" & i & "y", L.Y)
                ini.Write(bname, "box" & i & "x2", L.Width)
                ini.Write(bname, "box" & i & "y2", L.Height)
            Next
            ini.Write(cname, "Count", Draw_Circle.Count)
            For i As Short = 1 To Draw_Circle.Count '//모두돌아서 저장한다.
                Dim L As S_Circle = Draw_Circle(i - 1)
                ini.Write(cname, "Circle" & i & "pencolor", L.PenColor.ToArgb)
                ini.Write(cname, "Circle" & i & "pensize", L.PenWidth)
                ini.Write(cname, "Circle" & i & "x", L.X)
                ini.Write(cname, "Circle" & i & "y", L.Y)
                ini.Write(cname, "Circle" & i & "x2", L.Width)
                'ini.Write(cname, "Circle" & i & "y2", L.Height)
            Next
            ini.Write(lname, "Count", Draw_Line.Count)
            For i As Short = 1 To Draw_Line.Count '//모두돌아서 저장한다.
                Dim L As S_Line = Draw_Line(i - 1)
                ini.Write(lname, "line" & i & "pencolor", L.PenColor.ToArgb)
                ini.Write(lname, "line" & i & "pensize", L.PenWidth)
                ini.Write(lname, "line" & i & "x", L.X)
                ini.Write(lname, "line" & i & "y", L.Y)
                ini.Write(lname, "line" & i & "x2", L.X2)
                ini.Write(lname, "line" & i & "y2", L.Y2)
            Next
            ini.Write(qname, "Count", Draw_QRcode.Count)
            For i As Short = 1 To Draw_QRcode.Count '//모두돌아서 저장한다.
                Dim L As S_QRCode = Draw_QRcode(i - 1)
                'ini.Write(pname, "Image" & i & "pencolor", L.PenColor.ToArgb)
                'ini.Write(pname, "Image" & i & "pensize", L.PenWidth)
                ini.Write(qname, "qrcode" & i & "x", L.X)
                ini.Write(qname, "qrcode" & i & "y", L.Y)
                ini.Write(qname, "qrcode" & i & "x2", L.Width)
                ini.Write(qname, "qrcode" & i & "y2", L.Height)
            Next
        Else   '//여기는 읽는 부분
            Draw_Box.Clear()
            Draw_Line.Clear()
            Draw_Circle.Clear()
            Draw_QRcode.Clear()

            bcnt = ini.Read(bname, "Count", 0)
            For i As Short = 1 To bcnt '//모두돌아서 저장한다.
                Dim L As New S_Box
                L.PenColor = Drawing.Color.FromArgb(ini.Read(bname, "box" & i & "pencolor", 0))
                L.PenWidth = ini.Read(bname, "box" & i & "pensize", 3)
                L.X = ini.Read(bname, "box" & i & "x", 0)
                L.Y = ini.Read(bname, "box" & i & "y", 0)
                L.Width = ini.Read(bname, "box" & i & "x2", 10)
                L.Height = ini.Read(bname, "box" & i & "y2", 10)
                Draw_Box.Add(L)
            Next

            ccnt = ini.Read(cname, "Count", 0)
            For i As Short = 1 To ccnt '//모두돌아서 저장한다.
                Dim L As New S_Circle
                L.PenColor = Drawing.Color.FromArgb(ini.Read(cname, "Circle" & i & "pencolor", 0))
                L.PenWidth = ini.Read(cname, "Circle" & i & "pensize", 3)
                L.X = ini.Read(cname, "Circle" & i & "x", 0)
                L.Y = ini.Read(cname, "Circle" & i & "y", 0)
                L.Width = ini.Read(cname, "Circle" & i & "x2", 10)
                L.Height = ini.Read(cname, "Circle" & i & "y2", 10)
                Draw_Circle.Add(L)
            Next

            lcnt = ini.Read(lname, "Count", 0)
            For i As Short = 1 To lcnt '//모두돌아서 저장한다.
                Dim L As New S_Line
                L.PenColor = Drawing.Color.FromArgb(ini.Read(lname, "line" & i & "pencolor", 0))
                L.PenWidth = ini.Read(lname, "line" & i & "pensize", 3)
                L.X = ini.Read(lname, "line" & i & "x", 0)
                L.Y = ini.Read(lname, "line" & i & "y", 0)
                L.X2 = ini.Read(lname, "line" & i & "x2", 10)
                L.Y2 = ini.Read(lname, "line" & i & "y2", 10)
                Draw_Line.Add(L)
            Next

            qcnt = ini.Read(qname, "Count", 0)
            For i As Short = 1 To qcnt '//모두돌아서 저장한다.
                Dim L As New S_QRCode
                'L.PenColor = Color.FromArgb(ini.Read(pname, "Circle" & i & "pencolor", 0))
                'L.PenWidth = ini.Read(sname, "Circle" & i & "pensize", 3)
                L.X = ini.Read(qname, "qrcode" & i & "x", 0)
                L.Y = ini.Read(qname, "qrcode" & i & "y", 0)
                L.Width = ini.Read(qname, "qrcode" & i & "x2", 10)
                L.Height = ini.Read(qname, "qrcode" & i & "y2", 10)
                Draw_QRcode.Add(L)
            Next

            Me.Refresh_Drawlist()
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try

            '//삭제
            Select Case Me.ListBox1.Text.Substring(0, 1)
                Case "선"
                    Draw_Line.RemoveAt(Me.ListBox1.Text.Split(":")(1))
                Case "박"
                    Draw_Box.RemoveAt(Me.ListBox1.Text.Split(":")(1))
                Case "원"
                    Draw_Circle.RemoveAt(Me.ListBox1.Text.Split(":")(1))
                Case "Q"
                    Draw_QRcode.RemoveAt(Me.ListBox1.Text.Split(":")(1))
            End Select
            Me.Refresh_Drawlist()

        Catch ex As Exception
            MessageBox.Show("선택 후 삭제가 가능합니다.", "확인", MessageBoxButtons.OK, MessageBoxIcon.Error)
            ListBox1.Focus()
        End Try
    End Sub

    Private Sub DoolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DoolStripMenuItem.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        ' SAVE_PATTERN("DL11PATTERN", "I", Me.Dl11.Length, "\dl1명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl11, "DL11PATTERNII", "I", "\Dl1명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub bt_style_manager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_style_manager.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        ' SAVE_PATTERN("DL21PATTERN", "J", Me.Dl21.Length, "\dl2명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl21, "DL21PATTERNII", "J", "\Dl2명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return

        End If
        ' SAVE_PATTERN("DL31PATTERN", "K", Me.Dl31.Length, "\dl3명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl31, "DL31PATTERNII", "K", "\Dl3명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub gfdStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gfdStripMenuItem.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        'SAVE_PATTERN("LINEPATTERN", "L", Me.선로명.Length, "\선로명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.선로명, "LINEPATTERNII", "L", "\선로명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub gfdlStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gfdlStripMenuItem.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        '  SAVE_PATTERN("JJNUMPATTERN", "X", Me.번호.Length, "\번호패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.번호, "JJNUMPATTERNII", "X", "\번호패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        ' SAVE_PATTERN("DL12PATTERN", "C", Me.Dl12.Length, "\dl1명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl12, "DL12PATTERNII", "C", "\Dl1명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        'SAVE_PATTERN("DL22PATTERN", "F", Me.Dl22.Length, "\dl2명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl22, "DL22PATTERNII", "F", "\Dl2명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        If MsgBox("패턴을 저장하시겠습니까?", MsgBoxStyle.Information + MsgBoxStyle.OkCancel, "확인") <> MsgBoxResult.Ok Then
            NOTICE("패턴 저장이 취소되었습니다", Me.lb_msg)
            Return
        End If
        ' SAVE_PATTERN("DL32PATTERN", "M", Me.Dl32.Length, "\dl3명패턴.TXT")    '//선로명의 패턴을 저장합니다.
        SAVE_PATTERNII(Me.Dl32, "DL32PATTERNII", "M", "\Dl3명패턴2.TXT")    '//선로명의 패턴을 저장합니다.
    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 tb_pagerepeat_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_pagerepeat.KeyDown, tb_secX.KeyDown, tb_secY.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.preview_window()
        End If
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        Dim NewLine As New S_Circle
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 200
        NewLine.Height = 200
        Draw_Circle.Add(NewLine)
        Refresh_Drawlist()
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        Dim NewLine As New S_QRCode
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 0
        NewLine.Height = 0
        Draw_QRcode.Add(NewLine)
        Refresh_Drawlist()
    End Sub
    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim a As New ColorDialog
        a.Color = lbQrBg.BackColor
        If a.ShowDialog() = Windows.Forms.DialogResult.OK Then
            lbQrBg.BackColor = a.Color
        End If
    End Sub

    Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        Dim a As New ColorDialog
        a.Color = lbQrFG.BackColor
        If a.ShowDialog() = Windows.Forms.DialogResult.OK Then
            lbQrFG.BackColor = a.Color
        End If
    End Sub
End Class



