Imports System.Windows.Forms
Imports System.Drawing

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

Public Class Frm_Prnset
    'Enum E_Ftyle
    '    가공번호찰 = 1
    '    가로등 = 2
    '    정액등 = 3
    '    지중번호찰 = 4
    '    수용번호찰 = 5
    'End Enum
    'Public PType As E_Ftyle
    Public Pform As Defalut_PrintForm '//이폼을 부른 부모폼을 참조한다.
    Public Style As C_Epole.SCStyle  '//현재선택된스타일의 정보를 가지고잇다 속성컨트롤 연결을위해 생성했다
    Public MyProperty_Detail As PropertyGrid_Ctl
    Public MyProperty_Paper As PropertyGrid_Paper

    '//프린터여백

    Public Sub New()
        ' 이 호출은 Windows Form 디자이너에 필요합니다.
        InitializeComponent()
        ' InitializeComponent() 호출 뒤에 초기화 코드를 추가하십시오.
    End Sub
    Public Sub New(ByVal parent As Form)
        ' 이 호출은 Windows Form 디자이너에 필요합니다.
        InitializeComponent()
        Pform = parent
        ' InitializeComponent() 호출 뒤에 초기화 코드를 추가하십시오.
    End Sub

    Private Sub Frm_Prnset_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        'Me.NewFp1.ASetting_Save(False, "view_" & Pform.StyleTag, "\ViewConfig\" & Pform.StyleTag & "_")
        Me.Save_PrinterName()
    End Sub

    Private Sub Frm_Prnset_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.F8
                Me.bt_preview.PerformClick()
            Case Keys.F9
                Me.bt_print.PerformClick()
        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.cmb_prnlist.Items.Clear()
        For Each Pname As String In C_Epole.GetPrintersName
            Me.cmb_prnlist.Items.Add(Pname)
        Next
        Me.cmb_prnlist.Items.Add("Image - JPEG")

        Me.Load_Printername()  '//저장된 기본프린터명을 셋팅한다.

        Dim Tmsg As System.Text.StringBuilder
        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.tb_printrange, Tmsg.ToString)
    End Sub


    ''' <summary>
    ''' 환경파일에 현재지정된 프린터명을 기록합니다.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Save_PrinterName()
        Eini.Write("PRINTFORM", "printername", Me.cmb_prnlist.Text)   '//패턴검사조건 콤보박스      
    End Sub

    ''' <summary>
    ''' 공통적으로 적용될 설정을 불러오거나/저장합니다.(현재는 지정프린터명)
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Load_Printername()
        'Arin.WLog2(Auto_Log, "현재설정(스타일)을 가져옵니다.()", LogFile)
        'Arin.WLog2(Auto_Log, "Load_Setting()", LogFile)
        Dim Data As String = Eini.Read("PRINTFORM", "printername", "")
        'MsgBox("프린터명 " & Data & "파일:" & Eini.FileName)
        Me.cmb_prnlist.Text = Data
    End Sub

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

    '//190223
    Function getStyleIndex() As Integer
        If cmb_style.Text.Trim = "" Then Return -1
        Dim nostr As String = cmb_style.Text.Substring(1, cmb_style.Text.IndexOf("]") - 1)
        Return Integer.Parse(nostr)
    End Function

    ''' <summary>
    ''' 현재 선택된 스타일정보를 이폼의 Style 구조체에 기록
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub Set_current_Style()
        Dim SStyle As C_Epole.SStyle = StyleList(getStyleIndex())
        Style.Margin = New Point(SStyle.MarginX, SStyle.MarginY)
        Style.Scale = New Point(SStyle.ScaleX, SStyle.ScaleY)
        Style.Dummy = SStyle.Dummy
        Style.Dummytype = SStyle.Dummytype
        Style.DummyMargin = New Point(SStyle.dummmyx, SStyle.dummmyy)
        Style.Orient = SStyle.LandScape
        Style.UseBG = SStyle.Viewimage
    End Sub

    Private Sub cmb_style_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_style.SelectedIndexChanged
        If Me.cmb_style.SelectedIndex > -1 Then
            '//선택된 스타일정보를 이곳 style 구조체에 저장한다.
            Me.MyProperty_Paper = New PropertyGrid_Paper(Pform, Me)
            Set_current_Style()
            Pform.Selected_Style(getStyleIndex()) '//선택이 됬으므로 스타일을 보여준다.
            'Me.Text = "속성창(" & StyleList(Me.cmb_style.SelectedIndex).File & ")"
            'If System.IO.File.Exists(My.Application.Info.DirectoryPath & "\ViewConfig\" & Pform.StyleTag & ".xml") Then
            ' Me.NewFp1.Open(My.Application.Info.DirectoryPath & "\ViewConfig\" & Pform.StyleTag & ".xml")
            ' End If
            Me.NewFp1.DataSource = Pform.BS
            'MsgBox(Pform.BS.ToString())
            '변경
            'Me.NewFp1.ASetting_Load(False, "view_" & Pform.StyleTag, "\ViewConfig\" & Pform.StyleTag & "_")
            '//페이지속성 프로퍼티에연결
            Me.pg1.SelectedObject = Me.MyProperty_Paper


        Else
            Pform.AddMessage("[Frm_PrnSet] 에서 스타일콤보박스에 -1보다 작은값이 선택되었습니다")
        End If
    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.rad_rangecustom.Checked = True
    End Sub

    Public Sub ViewProperty(ByRef sender As CEpole.C_label, ByVal Message As String)
        Pform.AddMessage("[1개의 개체 속성보기] : " & Message)
        If sender Is Nothing Then
            Pform.AddMessage("[1개의 개체 속성보기] : 발생자가 Nothing 입니다.")
            Return
        End If
        Me.MyProperty_Detail = New PropertyGrid_Ctl(Pform.SelCon, Pform, Me)
        Me.pg.SelectedObject = Me.MyProperty_Detail

        '//선택된개체의 정보를 화면에 표시
        Me.cb_visible.Checked = sender.visible
        Me.cb_bold.Checked = sender.Font.Bold

        Me.tb_x.Text = Me.MyProperty_Detail.위치x
        Me.tb_y.Text = Me.MyProperty_Detail.위치y
        Me.tb_w.Text = Me.MyProperty_Detail.너비
        Me.tb_h.Text = Me.MyProperty_Detail.높이
        Me.tb_size.Text = Me.MyProperty_Detail.글꼴크기
        Me.tb_space.Text = Me.MyProperty_Detail.자간
        Me.TB_FONTNAME.Text = Me.MyProperty_Detail.글꼴.FontFamily.Name
        Me.tb_rx.Text = Me.MyProperty_Detail.다음위치X
        Me.tb_ry.Text = Me.MyProperty_Detail.다음위치Y
        Me.tb_rep.Text = Me.MyProperty_Detail.반복횟수
        Me.lbFColor.BackColor = Me.MyProperty_Detail.전경색 '//160515

        If Pform.SelCon.Count = 1 Then
            Me.cmb_sep.SelectedIndex = Pform.AllFullLabels(sender.Gidx).LineType
        Else    '//다중개체가 선택되었을때는 ***** 를 표시하도록한다.
            Dim Lt As CEpole.C_Epole.E_LineType = Pform.AllFullLabels(sender.Gidx).LineType
            Dim AllSame As Boolean = True
            For Each c As CEpole.C_label In Pform.SelCon
                If Pform.AllFullLabels(c.Gidx).LineType <> Lt Then
                    AllSame = False
                    Exit For
                End If
            Next
            If AllSame Then
                Me.cmb_sep.SelectedIndex = Lt
            Else
                Me.cmb_sep.SelectedIndex = 3    '//모두같지않다면 ***** 로 변경
            End If

        End If

        ' Me.cb_seppattern.Checked = Pform.AllFullLabels(sender.Gidx).SeparatePattern   '//개별패턴이 지정되는 그룹인지 확인한다.
        If Pform.AllFullLabels(sender.Gidx).Ei = Pform.AllFullLabels(sender.Gidx).Si Then  '//싱글패턴개체이므로 번호형식이 필요없다.
            Me.cmb_sep.Enabled = False
            Me.lb_numtype.Enabled = False
            Me.lb_numtype.Text = "-,-,-"
        Else
            Me.cmb_sep.Enabled = True
            Me.lb_numtype.Enabled = True
            Me.lb_numtype.Text = Pform.AllFullLabels(sender.Gidx).NumType
        End If

        '//개체를 선택하면 탭페이지를 개체조정으로 자동변경한다.
        Me.TabControl1.SelectedIndex = 2

    End Sub

    Private Sub cmb_controls_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb_controls.SelectionChangeCommitted
        For Each A As CEpole.C_label In Pform.SelCon
            A.ForeColor = A.ForeColor2 ' Drawing.Color.Black     '//선택된것들 죄다 검은색으로  160515
        Next
        Dim Selected As C_label = Pform.Get_Control(Me.cmb_controls.SelectedIndex)

        Pform.SelCon.Clear()
        Pform.SelCon.Add(Selected)
        Selected.ForeColor = Drawing.Color.DodgerBlue
        ViewProperty(Selected, "내부:개체선택콤보박스의 changed Commited")
        Pform.preview_window()

    End Sub
    Private Sub cmb_controls_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_controls.SelectedIndexChanged
        '//선택될때
        If Me.cmb_controls.Text = "*****" Then  '//다중선택으로 들어왔따.
            ViewProperty(Pform.OnlyOne, "내부 : 개체선택콤보박스의 selectedindexchanged")
        Else
            If Me.cmb_controls.SelectedIndex < 0 Then Return
            ViewProperty(Pform.Get_Control(Me.cmb_controls.SelectedIndex), "내부 : 개체선택콤보박스의 selectedindexchanged")
        End If
    End Sub

    Public Sub SetFont()   '//체크박스 상태에따라서 폰트를 변경합니다.
        Dim B As System.Drawing.FontStyle
        If Me.cb_bold.Checked = True Then B = FontStyle.Bold
        Dim Tobj As CEpole.C_label

        For Each a As CEpole.C_label In Pform.SelCon
            Tobj = CType(a, CEpole.C_label)
            Tobj.Font = New Font(Tobj.Font, B)
        Next
        Pform.preview_window()
    End Sub

    Public Function GetBgImgFile() As String
        Return GetImgPath(Me.tb_picfile.Text)
    End Function

    Private Sub CbtstyleeditToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CbtstyleeditToolStripMenuItem.Click
        Dim A As New StyleEdit(getStyleIndex(), Pform.StyleDir, Pform.AllFullLabels)
        A.ShowDialog()
    End Sub

    Private Sub cmb_sep_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb_sep.SelectionChangeCommitted
        If Me.cmb_controls.SelectedIndex = -1 Then
            If Me.cmb_controls.Text <> "*****" Then Return '//선택된게 없으면 넘어간다.다중개체일떄 건드리면 모두 바꾼다.
        End If
        If Me.cmb_sep.Text = "*****" Then Return

        If Pform.SelCon.Count = 1 Then  '//1개만 선택되었다.
            Dim Gidx As Short = Pform.Get_Control(Me.cmb_controls.SelectedIndex).Gidx
            Pform.AllFullLabels(Gidx).LineType = Me.cmb_sep.SelectedIndex  '//해당라벨그룹의 표시형식을 변경
            Pform.AddMessage(Pform.AllFullLabels(Gidx).Desc & "의 줄설정값이 " & Me.cmb_sep.SelectedIndex & " 로 변경되었습니다")
            Pform.AddMessage("selecteion Changedcommit : " & Me.cmb_sep.SelectedIndex & " 로 변경되었습니다")
        Else '//선택된개체전부를 바꿔줘야한다.
            For Each C As C_label In Pform.SelCon
                Dim Gidx As Short = C.Gidx
                Pform.AllFullLabels(Gidx).LineType = Me.cmb_sep.SelectedIndex  '//해당라벨그룹의 표시형식을 변경
                Pform.AddMessage(Pform.AllFullLabels(Gidx).Desc & "의 줄설정값이 " & Me.cmb_sep.SelectedIndex & " 로 변경되었습니다")
                Pform.AddMessage("selecteion Changedcommit : " & Me.cmb_sep.SelectedIndex & " 로 변경되었습니다")

            Next
        End If
        
    End Sub

    Private Sub lb_numtype_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lb_numtype.KeyDown
        If e.KeyCode = Keys.Enter Then
            For Each C As C_label In Pform.SelCon
                'If Me.cmb_controls.SelectedIndex = -1 Then Return '//선택된게 없으면 넘어간다.
                Dim Gidx As Short = C.Gidx
                Pform.AllFullLabels(Gidx).NumType = Me.lb_numtype.Text
                Pform.AddMessage(Pform.AllFullLabels(Gidx).Desc & "의 번호형식이 " & Me.lb_numtype.Text & " 로 변경되었습니다")
                Pform.AddMessage("Numtype_Text_Changed : " & Me.lb_numtype.Text & " 로 변경되었습니다")
            Next
            MsgBox("번호형식은 패턴저장후에 적용됩니다", MsgBoxStyle.Information, "확인")
        End If
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_preview.Click
        Pform.Print_Preview()
    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_print.Click
        Pform.Print()
    End Sub

    Private Sub cb_dummy_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Pform.Refresh_Window()
    End Sub

    Public Function Make_NewStyle(Optional ByVal srcfile As String = "") As Boolean
        If Pform.StyleDir.Exists = False Then Pform.StyleDir.Create() '//폴더가없으면 만든다.
        '//090429 CFG형태로 변경한다

        Dim File As String = "style" & Format(Now, "MMddhhmmss")  '//확장자빠진 새로운파일명만 있다.


        Dim Newfn As String = Pform.StyleDir.FullName & "\" & File
        Dim NewDesc As String = InputBox("생성할 스타일의 이름을 입력하세요", "스타일생성", "신규스타일")
        Dim NewFnFull As String

        If NewDesc <> "" Then    '//스타일설명이없다면 취소다
            If srcfile <> "" Then    '//소스파일이있다면 복사기능이다.
                Dim SrcPAttern As String = srcfile.Substring(0, srcfile.IndexOf(".")) '//확장자빠진 실제파일명만있다.
                '//파일명과같은 모든 확장자를 찾아서 복사를한다.
                For Each FN As String In System.IO.Directory.GetFiles(Pform.StyleDir.FullName, SrcPAttern & ".*")
                    '//fn에서 확장자만 추출해서 새로운 파일명의 확장자에 붙인다.
                    Try
                        NewFnFull = Newfn & FN.Substring(FN.LastIndexOf("."))
                        IO.File.Copy(FN, NewFnFull, True)
                    Catch ex As Exception
                        'MessageBox.Show(ex.ToString())

                    End Try

                Next
            End If
            Eini = New ACC.MyINI(Newfn & ".cfg")
            If Eini.Exist = False Then Eini.Create()
            Eini.Write("STYLE", "DESC", NewDesc)
            Eini.Write("STYLE", "FILE", File)
            Return True
        End If
        Return False
    End Function
    Public Function RenameStyle(ByVal srcfile As String) As Boolean
        If Pform.StyleDir.Exists = False Then Pform.StyleDir.Create() '//폴더가없으면 만든다.
        '//090429 CFG형태로 변경한다

        Dim File As String = srcfile.Substring(0, srcfile.LastIndexOf(".")) & ".cfg"  '//확장자빠진 새로운파일명만 있다.
        Dim Newfn As String = Pform.StyleDir.FullName & "\" & File
        Dim curname As String = Me.cmb_style.Text.Substring(Me.cmb_style.Text.IndexOf("]") + 2)
        Dim NewDesc As String = InputBox("스타일의 이름을 입력하세요", "스타일이름변경", curname)

        If NewDesc <> "" Then    '//스타일설명이없다면 취소다
            Eini = New ACC.MyINI(Newfn)
            If Eini.Exist = False Then Eini.Create()
            Eini.Write("STYLE", "DESC", NewDesc)
            Return True
        End If
        Return False
    End Function
    Private Sub cbt_makenewstyle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbt_makenewstyle.Click
        If Me.Make_NewStyle Then
            MsgBox("스타일이 성공적으로 생성되었습니다" & vbCrLf & "출력창을 닫고 다시 열었을경우 반영됩니다", MsgBoxStyle.Information, "확인")
        Else
            MsgBox("스타일 생성이 취소되었거나 실패했습니다", MsgBoxStyle.Information, "확인")
        End If
    End Sub

    Private Sub cbt_copystyle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbt_copystyle.Click
        If Me.Make_NewStyle(StyleList(getStyleIndex()).File) Then
            MsgBox("스타일이 성공적으로 복사되었습니다" & vbCrLf & "출력창을 닫고 다시 열었을경우 반영됩니다", MsgBoxStyle.Information, "확인")
        Else
            MsgBox("스타일 복사가 취소되었거나 실패했습니다", MsgBoxStyle.Information, "확인")
        End If
    End Sub

    Private Sub cbt_del_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbt_del.Click
        If MsgBox("현재 스타일을 삭제하시겠습니까?", MsgBoxStyle.OkCancel Or MsgBoxStyle.Information, "삭제확인") = MsgBoxResult.Ok Then
            Dim FI As New System.IO.FileInfo(Pform.StyleDir.FullName & "\" & StyleList(getStyleIndex()).File)
            For Each File As System.IO.FileInfo In FI.Directory.GetFiles(FI.Name.Substring(0, FI.Name.LastIndexOf(".")) & ".*")
                File.Delete()
            Next
            MsgBox("삭제되었습니다", MsgBoxStyle.Information, "확인")
            Pform.Close()
        End If
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_imgtype.SelectedIndexChanged
        If Me.cmb_imgtype.SelectedIndex = -1 Then Me.cmb_imgtype.SelectedIndex = 0
        If Me.cmb_imgtype.SelectedIndex = 5 Then '//직접출력
            Me.GroupBox1.Enabled = True
            If Not Pform.Ctl_PictureBox.BackgroundImage Is Nothing Then
                Me.bakimg.BackgroundImage = Me.Pform.Ctl_PictureBox.BackgroundImage
                Me.Pform.Ctl_PictureBox.BackgroundImage = Nothing   '//본 배경화면은 false
            Else
                If IO.File.Exists(Me.tb_picfile.Text) Then
                    ' If Me.Chk_BgImage.Checked Then
                    Me.bakimg.BackgroundImage = Image.FromFile(Me.tb_picfile.Text)
                    'Else
                    '     Me.bakimg.BackgroundImage = Nothing
                    ' End If
                End If
            End If
            'Pform.preview_window()
        Else
            Me.bakimg.BackgroundImage = Nothing   '//셋팅화면의 배경은 쓰지않으므로 false 시킨다.
            Me.GroupBox1.Enabled = False
            Me.Pform.Ctl_PictureBox.BackgroundImageLayout = Me.cmb_imgtype.SelectedIndex
            If IO.File.Exists(Me.tb_picfile.Text) Then
                ' If Me.Chk_BgImage.Checked Then
                Me.bakimg.BackgroundImage = Image.FromFile(Me.tb_picfile.Text)
                If Chk_BgImage.Checked Then
                    Pform.Ctl_PictureBox.BackgroundImage = Me.bakimg.BackgroundImage
                End If
                'Else
                '     Me.bakimg.BackgroundImage = Nothing
                ' End If
            End If
            '  MsgBox("배경설정됨")
        End If

    End Sub

    Private Sub tb_bakh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb_bakh.Click, tb_bakw.Click, tb_bakx.Click, tb_baky.Click
        CType(sender, TextBox).SelectAll()
    End Sub

    Private Sub tb_bakh_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb_bakh.GotFocus, tb_bakw.GotFocus, tb_bakx.GotFocus, tb_baky.GotFocus
        CType(sender, TextBox).SelectAll()
    End Sub

    Private Sub tb_bakx_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_bakx.KeyDown, tb_baky.KeyDown, tb_bakw.KeyDown, tb_bakh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Pform.preview_window()
        End If
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If Me.rad_repeat.Checked Then
            Me.GroupBox3.Text = "출력페이지수"
            Me.rad_rangeall.Enabled = False
            Me.rad_Rangecurr.Enabled = False
            Me.rad_rangecustom.Enabled = False
            Me.tb_printrange.Enabled = True
            Me.tb_printrange.Text = "1"
        Else
            Me.rad_rangeall.Enabled = 1
            Me.rad_Rangecurr.Enabled = 1
            Me.rad_rangecustom.Enabled = 1
            Me.tb_printrange.Enabled = True
            Me.GroupBox3.Text = "인쇄범위"
            Me.tb_printrange.Text = ""
        End If
    End Sub

    Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage2.Click

    End Sub

    Private Sub ToolStripButton1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click

        Dim MinLeft As Short = 999
        For Each A As CEpole.C_label In Pform.SelCon
            If A.Left < MinLeft Then MinLeft = A.Left '//가장작으 Left값 추적
        Next
        For Each a As CEpole.C_label In Pform.SelCon
            a.Left = MinLeft
        Next
        Pform.preview_window()
    End Sub

    Private Sub ToolStripButton2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        Dim MinLeft As Short = -999
        For Each A As CEpole.C_label In Pform.SelCon
            If A.Left > MinLeft Then MinLeft = A.Left '//가장작으 Left값 추적
        Next
        For Each a As CEpole.C_label In Pform.SelCon
            a.Left = MinLeft
        Next
        Pform.preview_window()
    End Sub

    Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        Dim MinLeft As Short = 999
        For Each A As CEpole.C_label In Pform.SelCon
            If A.Top < MinLeft Then MinLeft = A.Top '//가장작으 Left값 추적
        Next
        For Each a As CEpole.C_label In Pform.SelCon
            a.Top = MinLeft
        Next
        Pform.preview_window()
    End Sub

    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
        Dim MinLeft As Short = -999
        For Each A As CEpole.C_label In Pform.SelCon
            If A.Top > MinLeft Then MinLeft = A.Top '//가장작으 Left값 추적
        Next
        For Each a As CEpole.C_label In Pform.SelCon
            a.Top = MinLeft
        Next
        Pform.preview_window()
    End Sub

    Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_bold.Click
        Me.SetFont()
    End Sub

    Private Sub cb_visible_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_visible.Click
        'Arin.WLog2(Auto_Log, "표시 체크박스 선택 ", LogFile)
        For Each a As CEpole.C_label In Pform.SelCon
            a.visible = Me.cb_visible.Checked
        Next
        Pform.preview_window()
    End Sub

    Private Sub ToolStripButton5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_fontchange.Click
        If Pform.SelCon Is Nothing Then Return
        Dim B As New FontDialog
        B.Font = CType(Pform.SelCon(0), CEpole.C_label).Font
        If B.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then Return

        For Each a As CEpole.C_label In Pform.SelCon
            a.Font = B.Font
        Next
        Me.ViewProperty(Pform.onlyOne, "내부 : 글꼴변경버튼 클릭시")
        Pform.preview_window()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim OBJ As C_label = Pform.Get_Control(Me.cmb_controls.SelectedIndex)
        Dim Str As String = InputBox("변경할 문자를 입력하세요", "", OBJ.Text)
        OBJ.Text = Str
        Me.cb_visible.Checked = True
        ViewProperty(OBJ, "Change Mytext")
        Pform.preview_window()
    End Sub

    Private Sub 파일저장ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 파일저장ToolStripMenuItem.Click
        Me.NewFp1.SaveExcel("c:\a.xls")
    End Sub

    Private Sub Chk_BgImage_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chk_BgImage.CheckedChanged
        If Me.cmb_imgtype.SelectedIndex = -1 Then Me.cmb_imgtype.SelectedIndex = 0
        If Me.cmb_imgtype.SelectedIndex <> 5 Then
            If Chk_BgImage.Checked Then
                Pform.Ctl_PictureBox.BackgroundImage = Me.bakimg.BackgroundImage
            Else
                Pform.Ctl_PictureBox.BackgroundImage = Nothing
            End If
        End If
        
        Pform.preview_window()
    End Sub

    Private Sub bakimg_BackgroundImageChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles bakimg.BackgroundImageChanged
        Try
            Me.lb_imgsize.Text = Me.bakimg.BackgroundImage.Width & "*" & Me.bakimg.BackgroundImage.Height
        Catch ex As Exception
            Me.lb_imgsize.Text = "*.*"
        End Try

    End Sub

    Private Sub bakimg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bakimg.Click

    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        '//그림선택버튼
        Dim A As New System.Windows.Forms.OpenFileDialog

        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() <> System.Windows.Forms.DialogResult.OK Then Return

        Me.tb_picfile.Text = GetImgPath(A.FileName)
        Me.Chk_BgImage.Checked = True
        Me.bakimg.BackgroundImage = Image.FromFile(GetImgPath(Me.tb_picfile.Text))

        If Me.cmb_imgtype.SelectedIndex < 5 Then
            Pform.Ctl_PictureBox.BackgroundImage = Me.bakimg.BackgroundImage
        Else   '//직접출력할때는 미리보기버퍼용으로 셋팅화면의 픽쳐박스를 이용한다.
            Me.bakimg.BackgroundImage = Image.FromFile(GetImgPath(Me.tb_picfile.Text))
        End If
        Pform.preview_window()
    End Sub

    Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        '//그림삭제버튼
        Me.Chk_BgImage.Checked = False   '//배경표시버튼 비활성
        Me.tb_picfile.Text = ""
        Try
            Me.bakimg.BackgroundImage = Nothing
        Catch ex As Exception
        End Try
    End Sub


    

    ''' <summary>
    ''' 쉐이프개체의 목록을 작성합니다.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Refresh_Drawlist()

        '//;라인하고 박스를 읽어서 리스트박스에
        Me.lst_shape.Items.Clear()
        Dim I As Short = 0
        If Pform.Draw_Line.Count > 0 Then
            For Each Rect As C_Epole.S_Line In Pform.Draw_Line.Items
                Me.lst_shape.Items.Add("선(" & Rect.X & "," & Rect.Y & "," & Rect.X2 & "," & Rect.Y2 & "):" & I)
                I += 1
            Next
        End If

        I = 0
        If Pform.Draw_Box.Count > 0 Then
            For Each Rect As C_Epole.S_Box In Pform.Draw_Box.Items
                Me.lst_shape.Items.Add("박스(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "," & Rect.Radius & "):" & I)
                I += 1
            Next
        End If

        I = 0
        If Pform.Draw_Circle.Count > 0 Then
            For Each Rect As C_Epole.S_Circle In Pform.Draw_Circle.Items
                Me.lst_shape.Items.Add("원(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "):" & I)
                I += 1
            Next
        End If

        I = 0
        If Pform.Draw_Image.Count > 0 Then
            For Each Rect As C_Epole.S_Image In Pform.Draw_Image.Items
                Me.lst_shape.Items.Add("그림(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "):" & I)
                I += 1
            Next
        End If

        I = 0
        If Pform.Draw_QRcode.Count > 0 Then
            For Each Rect As C_Epole.S_QRCode In Pform.Draw_QRcode.Items
                Me.lst_shape.Items.Add("QR(" & Rect.X & "," & Rect.Y & "," & Rect.Width & "," & Rect.Height & "):" & I)
                I += 1
            Next
        End If

        Pform.preview_window()
    End Sub

    Private Sub lst_shape_DrawItem(sender As Object, e As System.Windows.Forms.DrawItemEventArgs) Handles lst_shape.DrawItem

    End Sub

    Private Sub lst_shape_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lst_shape.SelectedIndexChanged
        If Me.lst_shape.SelectedIndex < 0 Then Return
        '//들어있는 쉐이프들을 선택했을때.
        Select Case Me.lst_shape.Text.Substring(0, 1)
            Case "선"
                Dim PP As New PropertyGrid_Line(Me.lst_shape.Text.Split(":")(1), Me)
                pgs.SelectedObject = PP
            Case "박"
                Dim PP As New PropertyGrid_Box(Me.lst_shape.Text.Split(":")(1), Me)
                pgs.SelectedObject = PP
            Case "원"
                Dim PP As New PropertyGrid_Circle(Me.lst_shape.Text.Split(":")(1), Me)
                pgs.SelectedObject = PP
            Case "그"
                Dim PP As New PropertyGrid_Image(Me.lst_shape.Text.Split(":")(1), Me)
                pgs.SelectedObject = PP
            Case "Q"
                Dim PP As New PropertyGrid_QRcode(Me.lst_shape.Text.Split(":")(1), Me)
                pgs.SelectedObject = PP
        End Select

        'For Each A As C_Epole.S_DrawShape In Pform.SelConDraw
        '    If A.DrawType = C_Epole.E_DrawType.Box Then
        '        Dim Obj As C_Epole.S_Box = A.DrawObject
        '        Obj.PenColor = Color.Black
        '        CType(A.DrawObject, C_Epole.S_Box).PenColor = Color.Black
        '    Else
        '        CType(A.DrawObject, C_Epole.S_Box).PenColor = Color.Black
        '    End If
        '    A.ForeColor = Color.Black     '//선택된것들 죄다 검은색으로
        'Next

        'Dim Selected As C_label = Pform.Get_Control(Me.cmb_controls.SelectedIndex)
        'Pform.SelCon.Clear()
        'Pform.SelCon.Add(Selected)
        'Selected.ForeColor = Color.DodgerBlue
        'ViewProperty(Selected, "내부:개체선택콤보박스의 changed Commited")
        'Pform.preview_window()


    End Sub

    Private Sub chk_usedraw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk_usedraw.Click
        Pform.preview_window()
    End Sub

    Private Sub bt_dmode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_dmode.Click
        '//디자인모드활성화
        Pform.DMode = Me.bt_dmode.Checked
    End Sub

    Private Sub cb_seppattern_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cb_seppattern.Click
        '//선택했을때ㅔ
        Dim Gidx As Short = Pform.Get_Control(Me.cmb_controls.SelectedIndex).Gidx
        ' Pform.AllFullLabels(Gidx).SeparatePattern = Me.cb_seppattern.Checked
    End Sub

    Private Sub bt_font_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_font.Click
        Dim FD As New FontDialog
        Try
            FD.Font = Me.MyProperty_Detail.글꼴
            If FD.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                Me.MyProperty_Detail.글꼴 = FD.Font
                Me.tb_size.Text = FD.Font.Size
                Me.TB_FONTNAME.Text = FD.Font.Name
            End If

        Catch ex As Exception
            MsgBox("선택된 개체가 없거나 오류입니다", MsgBoxStyle.Critical, "확인")
        End Try

    End Sub

#Region "keyboard Down"

    Private Sub tb_x_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_x.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.위치x = Me.tb_x.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_y_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_y.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.위치y = Me.tb_y.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_w_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_h.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.높이 = Me.tb_h.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_h_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_w.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.너비 = Me.tb_w.Text
            Catch ex As Exception

            End Try

        End If
    End Sub

    Private Sub tb_size_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_size.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.글꼴크기 = Me.tb_size.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_space_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_space.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.자간 = Me.tb_space.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_rep_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_rep.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.반복횟수 = Me.tb_rep.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_rx_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_rx.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.다음위치X = Me.tb_rx.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
    Private Sub tb_ry_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_ry.KeyDown
        If e.KeyCode = Keys.Enter Then
            Try
                Me.MyProperty_Detail.다음위치Y = Me.tb_ry.Text
            Catch ex As Exception

            End Try

        End If
    End Sub
#End Region

    Private Sub cmb_editname_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_editname.Click
        If Me.RenameStyle(StyleList(getStyleIndex()).File) Then
            MsgBox("스타일 이름이 성공적으로 변경되었습니다" & vbCrLf & "출력창을 닫고 다시 열었을경우 반영됩니다", MsgBoxStyle.Information, "확인")
        Else
            MsgBox("스타일 이름변경이 취소되었거나 실패했습니다", MsgBoxStyle.Information, "확인")
        End If
    End Sub

    Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_del.Click
        If Me.lst_shape.SelectedIndex < 0 Then Return
        If MsgBox("삭제하시겠습니까?", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "삭제") <> MsgBoxResult.Ok Then Return
        '//들어있는 쉐이프들을 선택했을때.
        Select Case Me.lst_shape.Text.Substring(0, 1)
            Case "선"
                '//삭제해야한다.
                Dim idx As Short = Me.lst_shape.Text.Split(":")(1)
                Dim NewLine As New CEpole.Shape_line
                For i As Integer = 0 To Pform.Draw_Line.Count - 1
                    If i <> idx Then NewLine.Add(Pform.Draw_Line.Item(i))
                Next
                Pform.Draw_Line = NewLine
            Case "박"
                '//삭제해야한다.
                Dim idx As Short = Me.lst_shape.Text.Split(":")(1)
                Dim NewLine As New CEpole.Shape_Box
                For i As Integer = 0 To Pform.Draw_Box.Count - 1
                    If i <> idx Then NewLine.Add(Pform.Draw_Box.item(i))
                Next
                Pform.Draw_Box = NewLine
            Case "원"
                '//삭제해야한다.
                Dim idx As Short = Me.lst_shape.Text.Split(":")(1)
                Dim NewLine As New CEpole.Shape_Circle
                For i As Integer = 0 To Pform.Draw_Circle.Count - 1
                    If i <> idx Then NewLine.Add(Pform.Draw_Circle.item(i))
                Next
                Pform.Draw_Circle = NewLine
            Case "그"
                '//삭제해야한다.
                Dim idx As Short = Me.lst_shape.Text.Split(":")(1)
                Dim NewLine As New CEpole.Shape_Image
                For i As Integer = 0 To Pform.Draw_Image.Count - 1
                    If i <> idx Then NewLine.Add(Pform.Draw_Image.item(i))
                Next
                Pform.Draw_Image = NewLine
            Case "Q"
                '//삭제해야한다.
                Dim idx As Short = Me.lst_shape.Text.Split(":")(1)
                Dim NewLine As New CEpole.Shape_QRcode
                For i As Integer = 0 To Pform.Draw_QRcode.Count - 1
                    If i <> idx Then NewLine.Add(Pform.Draw_QRcode.item(i))
                Next
                Pform.Draw_QRcode = NewLine
        End Select
        Me.Refresh_Drawlist()
        Pform.preview_window()
    End Sub


    Private Sub ToolStripButton9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton9.Click
        If MsgBox("선택된 개체들의 글꼴을 HY견고딕을 변경하시겠습니까?", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "확인") = MsgBoxResult.Ok Then
            Pform.CtrFontChange()
        End If
    End Sub

    Private Sub bt_circle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_circle.Click
        '//원
        Dim NewLine As C_Epole.S_CirCle
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 200
        'NewLine.Height = 200
        Pform.Draw_Circle.Add(NewLine)
        Me.Refresh_Drawlist()
    End Sub

    Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_lineh.Click
        '//가로선
        Dim NewLine As C_Epole.S_Line
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.X2 = 200
        NewLine.Y2 = 100
        Pform.Draw_Line.Add(NewLine)
        Me.Refresh_Drawlist()
    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_linev.Click
        '//세로선
        Dim NewLine As C_Epole.S_Line
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.X2 = 100
        NewLine.Y2 = 200
        Pform.Draw_Line.Add(NewLine)
        Me.Refresh_Drawlist()
    End Sub

    Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_image.Click
        '//그림
        Dim NewLine As C_Epole.S_Image
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 0
        NewLine.Height = 0
        NewLine.FileName = ".\image\그림파일명.jpg"
        Pform.Draw_Image.Add(NewLine)
        Me.Refresh_Drawlist()
    End Sub

    Private Sub ToolStripButton5_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_box.Click
        '//박스추가
        Dim NewLine As C_Epole.S_Box
        NewLine.PenColor = Drawing.Color.Black
        NewLine.PenWidth = 3
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 200
        NewLine.Height = 200
        Pform.Draw_Box.Add(NewLine)
        Me.Refresh_Drawlist()
    End Sub

    Private Sub bt_chang_font_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_chang_font.Click
        If MsgBox("선택된 스타일의 모든 글꼴을 변경합니다(패턴포함)" & vbCrLf & Me.cmb_style.Text & vbCrLf & "폰트창이 뜨면 변경할 폰트를 선택하세요", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "확인") = MsgBoxResult.Ok Then
            Dim FD As New FontDialog
            FD.Font = Me.Font
            If FD.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                ' MsgBox(FD.Font.Name)
                Pform.Change_All_FontData(FD.Font)
            End If
        End If
    End Sub

    Private Sub ToolStripButton5_Click_3(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_qr.Click
        '//QR코드추가
        Dim NewLine As C_Epole.S_QRCode
        NewLine.X = 100
        NewLine.Y = 100
        NewLine.Width = 50
        NewLine.Height = 50

        NewLine.Size = 4
        NewLine.QRData = "{DATA}"
        NewLine.Version = CEpole.C_Epole.EQR_Version.v11
        NewLine.Encoding = CEpole.C_Epole.EQR_Incoding.Byte
        NewLine.CLeve = CEpole.C_Epole.EQR_CLEVE.M
        NewLine.Format = "{DATA}"   '//출력포맷

        Pform.Draw_QRcode.Add(NewLine)
        Refresh_Drawlist()

    End Sub

    Private Sub lbFColor_Click(sender As Object, e As EventArgs) Handles lbFColor.Click
        Dim f As New ColorDialog
        f.Color = lbFColor.BackColor
        If f.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            lbFColor.BackColor = f.Color
            Me.MyProperty_Detail.전경색 = lbFColor.BackColor
        End If
    End Sub

    Private Sub btSaveImage_Click(sender As Object, e As EventArgs) Handles btSaveImage.Click

        Dim od As New SaveFileDialog
        od.Filter = "JPEG(*.jpg)|*.jpg|모든파일|*.*"
        od.FileName = "Image" + Pform.SrcIdx.ToString("000000000") + ".jpg"
        If od.ShowDialog = System.Windows.Forms.DialogResult.OK Then
            Pform.SaveImage(od.FileName)
        End If

    End Sub

    Private Sub 스타일숨김ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles btStyleinvisible.Click
        Dim dlg As DialogResult = MsgBox("현재 선택된 스타일을 숨김처리 하시겠습니까?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo)
        If dlg <> System.Windows.Forms.DialogResult.Yes Then Return

        Dim srcfile As String = StyleList(getStyleIndex()).File '//스타일 파일명
        If Pform.StyleDir.Exists = False Then Pform.StyleDir.Create() '//폴더가없으면 만든다.
        Dim File As String = srcfile.Substring(0, srcfile.LastIndexOf(".")) & ".cfg"  '//확장자빠진 새로운파일명만 있다.
        Dim Newfn As String = Pform.StyleDir.FullName & "\" & File
        '  Dim NewDesc As String = InputBox("스타일의 이름을 입력하세요", "스타일이름변경", Me.cmb_style.Text)

        Eini = New ACC.MyINI(Newfn)
        If Eini.Exist = False Then Eini.Create()
        Eini.Write("STYLE", "VISIBLE", "0")

        MsgBox("스타일이 숨김 처리 되었습니다" + vbCrLf + "출력창을 다시 열였을 때 적용됩니다")

    End Sub

    Private Sub 스타일표시ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles btStyleVisible.Click
        Dim dlg As DialogResult = MsgBox("현재 선택된 스타일을 [표시함]처리 하시겠습니까?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo)
        If dlg <> System.Windows.Forms.DialogResult.Yes Then Return

        Dim srcfile As String = StyleList(getStyleIndex()).File '//스타일 파일명
        If Pform.StyleDir.Exists = False Then Pform.StyleDir.Create() '//폴더가없으면 만든다.
        Dim File As String = srcfile.Substring(0, srcfile.LastIndexOf(".")) & ".cfg"  '//확장자빠진 새로운파일명만 있다.
        Dim Newfn As String = Pform.StyleDir.FullName & "\" & File
        '  Dim NewDesc As String = InputBox("스타일의 이름을 입력하세요", "스타일이름변경", Me.cmb_style.Text)

        Eini = New ACC.MyINI(Newfn)
        If Eini.Exist = False Then Eini.Create()
        Eini.Write("STYLE", "VISIBLE", "1")

        MsgBox("스타일이 표시 처리 되었습니다" + vbCrLf + "출력창을 다시 열였을 때 적용됩니다")
    End Sub

    Private Sub cm_style_Opening(sender As Object, e As CancelEventArgs) Handles cm_style.Opening
        If Pform.DisableWaterMark = False Then '//190223
            btStyleinvisible.Visible = False
            btStyleVisible.Visible = False
        Else
            btStyleinvisible.Visible = True
            btStyleVisible.Visible = True
        End If
    End Sub
End Class