Option Strict Off
Option Explicit On
Imports System.Windows.Forms
'------------------------------------ 2024/04/01 ------------------------------------
Public Class 巐frmDlg僗僀僗僀儐儔儐儔
    Inherits System.Windows.Forms.Form

#Region "愰尵"
    Private mNew幚峴拞 As Boolean = True
    Private mMe_gmDlgID As Integer = 0
    Private mDlgLoading As Boolean = True
    Event 僗僀僗僀儐儔儐儔愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer)
    Event 懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨(ByVal rMe_gmDlgID As Integer, ByVal r昞帵曄峏僂僀儞僪僂ID As Integer, ByVal r昞帵True徚嫀False As Boolean, ByRef wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 As Boolean)

    Private mLoading As Boolean = True  'New() 偺撪晹偱 .Checked 曄峏偵傛傝僾儘僷僥傿偑曄峏偝傟傞偺傪杊偖偨傔
    Private mUserSTD, mUser偐側僇僫 As Boolean
    '********************************************************************************
    Private mChgp僗僀僗僀攚宨夋憸傪昞帵, mKeyDown, mChgp僗僀僗僀榞偺怓偼儔儞僟儉 As Boolean
    '********************************************************************************
    Private WithEvents oo儐儔儐儔 As 屲cls儐儔儐儔 = Nothing
    Private mThisCall As Boolean = False
    '**************************************************************************
    '愰尵
    Private WithEvents o怓尒杮 As 屲clsColorSet2401 = Nothing
    Private flg_o怓尒杮Loading As Boolean = True
    '**************************************************************************************************************************************
    Private WithEvents 僀儀儞僩gAppEventMaker As 屲clsEventMaker
    '**************************************************************************************************************************************
#End Region

#Region "AppIniFileOp"
    Private Function zzAppIniFileOp(ByVal Load_0_QueryUnload_1_Resize_2_DoIniSave_3 As Long) As Boolean
        '撉弌偟帪偵丂INI 僼傽僀儖偑懚嵼偟側偄応崌偼丂False丂傪曉偟傑偡丅
        If gggAppIniFile Is Nothing Then Return False
        Return gggAppIniFile.aaAppIniFileOp_僼僅乕儉僒僀僘偲埵抲偩偗_嫟捠張棟(Load_0_QueryUnload_1_Resize_2_DoIniSave_3, Me, "3840")
    End Function
#End Region

#Region "僼僅乕儉僀儀儞僩"
    Private Sub 巐frmDlg僗僀僗僀儐儔儐儔_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '---------------------------------------------------
        僀儀儞僩gAppEventMaker = gAppEventMaker
        '---------------------------------------------------
        'qqqqq("1 pp僗僀僗僀and儐儔儐儔幚峴拞 = " & CStr(pp僗僀僗僀and儐儔儐儔幚峴拞))
        '------------------------
        mNew幚峴拞 = False
        mDlgLoading = True
        Dim wIsOK As Boolean
        RaiseEvent 僗僀僗僀儐儔儐儔愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄(wIsOK, mMe_gmDlgID)
        If Not wIsOK Then GoTo EXIT_ON_ERROR
        '---------------------------------------------------
        oo儐儔儐儔 = frmMain.oo儐儔儐儔
        mLoading = True
        '------------------------
        mUserSTD = Not (c僺僞1_僐儗2_僇僫3 = 3) : mUser偐側僇僫 = (c僺僞1_僐儗2_僇僫3 = 3)
        '------------------------
        pnl偐側僇僫梡.Visible = mUser偐側僇僫 : pnl偐側僇僫梡.Top = 275 : lbl攚宨怓偐側僇僫.Top = rdbtn攚宨怓.Top
        '------------------------
        'qqqqq("2 pp僗僀僗僀and儐儔儐儔幚峴拞 = " & CStr(pp僗僀僗僀and儐儔儐儔幚峴拞))
        '------------------------
        gggbol = gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨夋憸儕僗僩儃僢僋僗憖嶌(lst攚宨夋憸偺愗傝懼偊)
        '****************************************************
        'Add 2023/08/27
        lst曄壔僗僺乕僪攞悢.SelectedIndex = oo儐儔儐儔.p夋憸偺曄壔僗僺乕僪摿暿攞悢_ListBox弶婜壔(lst曄壔僗僺乕僪攞悢)
        '****************************************************
        mLoading = False : mDlgLoading = False
        '------------------------
        Call aaBtnOptStateSet("")
        '------------------------
        mn8僗僀僗僀梡僇乕僪宆傪愝掕.Visible = gm巊梡偡傞mn8僗僀僗僀梡僇乕僪宆傪愝掕
        '------------------------
        Call zzAppIniFileOp(2)
        '------------------------
        'qqqqq "Dlg僗僀僗僀儐儔儐儔愝掕 Form_Load"
        '------------------------
        mDlgLoading = False
        If Not zzAppIniFileOp(0) Then gggint = 嘳FormMove(gco僼僅乕儉傪僗僋儕乕儞拞怱偵堏摦, Me) 'INI 僼傽僀儖偑懚嵼偟側偄応崌偵丄偙偺僼僅乕儉傪夋柺偺僙儞僞乕偵昞帵偡傞僐乕僪丅
        '---------------------------------------------------
        gggbol = 嘳Form_OwnerSet_IconSet_TextSet(Me, "僗僀僗僀 偲 儐儔儐儔", Me.Owner)
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僼僅乕儉偺昞帵徚嫀(mMe_gmDlgID, True)

        o怓尒杮 = New 屲clsColorSet2401(flg_o怓尒杮Loading, Me, 232, 52, 172, 172)
        '------------------------
        Call 僀儀儞僩gAppEventMaker_僗僀僗僀偲儐儔儐儔奐巒偲掆巭()
        gggbol = zzColorBox忬懺愝掕()
        '------------------------
        lbl僇僶乕1.Visible = False : lbl僇僶乕2.Visible = False : lbl僇僶乕1.Left = 435 : lbl僇僶乕2.Left = 575

        'qqqqq("9 pp僗僀僗僀and儐儔儐儔幚峴拞 = " & CStr(pp僗僀僗僀and儐儔儐儔幚峴拞))
        '------------------------
        Return
        '---------------------------------------------------
EXIT_ON_ERROR:
        Call 嘳MsgBox_OK_忣曬("巐frmDlg僗僀僗僀儐儔儐儔() 撪偱僄儔乕偑敪惗偟傑偟偨丅")
        Me.Close()
    End Sub

    Private Sub 巐frmDlg僗僀僗僀儐儔儐儔_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Call lst攚宨夋憸傪昞帵_SelectedIndexChanged(Nothing, Nothing)
    End Sub

    Private Sub mnu暵偠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu暵偠傞.Click
        Me.Close()
    End Sub
    Private Sub 巐frmDlg僗僀僗僀儐儔儐儔_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        o怓尒杮.Dispose()
        If Me.Visible Then gggint = zzAppIniFileOp(2)
        gggint = zzAppIniFileOp(1)
        If 僀儀儞僩gAppEventMaker Is Nothing Then
            僀儀儞僩gAppEventMaker = gAppEventMaker
        End If
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僼僅乕儉偺昞帵徚嫀(mMe_gmDlgID, False)
    End Sub
    Private Sub 巐frmDlg僗僀僗僀儐儔儐儔_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        qqqqq("巐frmDlg僗僀僗僀儐儔儐儔_Disposed")
        Call gm僗僀僗僀嫟梡僋儔僗.aa僗僀僗僀儐儔儐儔愝掕Dlg_Load_1_Disposed_2(2, Nothing)
    End Sub
#End Region

#Region "僗僀僗僀幚峴儊僯儏乕孮 ++"
    Private Sub mn8suiyula_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8suiyula.Click
        'no op
    End Sub
    Private Sub mn8僗僀僗僀偲儐儔儐儔傪幚峴_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀偲儐儔儐儔傪幚峴.Click
        Call frmMain.mn8僗僀僗僀偲儐儔儐儔傪幚峴_Click(Nothing, Nothing)
    End Sub
    Private Sub mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭.Click
        Call frmMain.mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭_Click(Nothing, Nothing)
    End Sub
    Private Sub mn8僗僀僗僀幚峴_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀幚峴.Click
        Call frmMain.mn8僗僀僗僀幚峴_Click(Nothing, New System.EventArgs())
    End Sub
    Private Sub mn8僗僀僗僀掆巭_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀掆巭.Click
        Call frmMain.mn8僗僀僗僀掆巭_Click(Nothing, New System.EventArgs())
    End Sub
    Private Sub mn8儐儔儐儔幚峴_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8儐儔儐儔幚峴.Click
        Call frmMain.mn8儐儔儐儔幚峴_Click(Nothing, New System.EventArgs())
    End Sub
    Private Sub mn8儐儔儐儔掆巭_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8儐儔儐儔掆巭.Click
        Call frmMain.mn8儐儔儐儔掆巭_Click(Nothing, New System.EventArgs())
    End Sub
    Private Sub mn8僗僀僗僀夋憸傪愝掕_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀夋憸傪愝掕.Click
        Call frmMain.mn8僗僀僗僀夋憸傪愝掕_Click(Nothing, Nothing)
    End Sub
    Private Sub mn8僗僀僗僀梡僇乕僪宆傪愝掕_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8僗僀僗僀梡僇乕僪宆傪愝掕.Click
        Call frmMain.mn8僗僀僗僀梡僇乕僪宆傪愝掕_Click(Nothing, Nothing)
    End Sub
    Private Sub mn8偙偺傾僾儕傪廔椆_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mn8偙偺傾僾儕傪廔椆.Click
        If 嘳MsgBox_傾僾儕廔椆偟傑偡偐(app傾僾儕僞僀僩儖) Then Call frmMain.mn1game偙偺傾僾儕傪廔椆_Click(Nothing, Nothing)
    End Sub
    Private Sub mnu師偺夋憸偵愗傝懼偊_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu師偺夋憸偵愗傝懼偊.Click
        If mLoading Then Return
        gggbol = gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨夋憸偺愗傝懼偊_師偺夋憸偵_嫮惂揑偵
    End Sub
#End Region

#Region "僐儞僩儘乕儖丂僀儀儞僩"
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub lst戝拞彫儌乕僪_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst戝拞彫儌乕僪.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀戝拞彫儌乕僪ListBoxIndex = lst戝拞彫儌乕僪.SelectedIndex
    End Sub
    Private Sub lst僼儔僼儔儌乕僪_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst僼儔僼儔儌乕僪.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僼儔僼儔儌乕僪ListBoxIndex = lst僼儔僼儔儌乕僪.SelectedIndex
    End Sub
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub rdbtn僇乕僪偺榞偺怓_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdbtn僇乕僪偺榞偺怓.CheckedChanged
        gggbol = rdbtn僇乕僪偺榞偺怓_rdbtn攚宨怓_chk榞偺怓偼儔儞僟儉_Changed()
    End Sub
    Private Sub rdbtn攚宨怓_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdbtn攚宨怓.CheckedChanged
        gggbol = rdbtn僇乕僪偺榞偺怓_rdbtn攚宨怓_chk榞偺怓偼儔儞僟儉_Changed()
    End Sub
    Private Sub chk榞偺怓偼儔儞僟儉_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chk榞偺怓偼儔儞僟儉.CheckStateChanged
        gggbol = rdbtn僇乕僪偺榞偺怓_rdbtn攚宨怓_chk榞偺怓偼儔儞僟儉_Changed()
    End Sub
    Private Function rdbtn僇乕僪偺榞偺怓_rdbtn攚宨怓_chk榞偺怓偼儔儞僟儉_Changed() As Boolean
        If mNew幚峴拞 Then Return False
        If mLoading Then Return False
        If o怓尒杮 Is Nothing Then Return False
        If flg_o怓尒杮Loading Then Return False
        Dim old As Boolean
        With gm僗僀僗僀嫟梡僋儔僗
            old = .p僗僀僗僀榞偺怓偼儔儞僟儉
            .p僗僀僗僀榞偺怓偼儔儞僟儉 = chk榞偺怓偼儔儞僟儉.Checked
            mChgp僗僀僗僀榞偺怓偼儔儞僟儉 = (old <> .p僗僀僗僀榞偺怓偼儔儞僟儉)
        End With
        Return zzColorBox忬懺愝掕()
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub lst僇乕僪枃悢_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst僇乕僪枃悢.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僇乕僪枃悢 = lst僇乕僪枃悢.SelectedIndex + 1
    End Sub
    Private Sub lst僘乕儉儌乕僪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst僘乕儉儌乕僪.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僘乕儉儌乕僪Do = lst僘乕儉儌乕僪.SelectedIndex + 1
    End Sub
    Private Sub lst僇乕僪僒僀僘_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst僇乕僪僒僀僘.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僒僀僘 = lst僇乕僪僒僀僘.SelectedIndex + 1
    End Sub
    Private Sub lst僇乕僪僗僺乕僪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst僇乕僪僗僺乕僪.SelectedIndexChanged
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僗僺乕僪 = lst僇乕僪僗僺乕僪.SelectedIndex + 1
    End Sub
    Private Sub lst榞偺懢偝_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst榞偺懢偝.SelectedIndexChanged
        '僐儗僐僐丂僺僞儁僞丂愱梡
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀榞僒僀僘 = lst榞偺懢偝.SelectedIndex + 1
    End Sub
    '--------------------------------------------------------------------------------
    Private Sub lst僇乕僪僀儊乕僕_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst僇乕僪僀儊乕僕.SelectedIndexChanged
        '僇僫偐側愱梡
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        frmMain.p僗僀僗僀僇乕僪僀儊乕僕 = lst僇乕僪僀儊乕僕.SelectedIndex
    End Sub
    Private Sub lst僇乕僪僀儊乕僕愗懼_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst僇乕僪僀儊乕僕愗懼.SelectedIndexChanged
        '僇僫偐側愱梡
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僇乕僪僀儊乕僕偺愗傝懼偊僺僢僠MenuIndex = lst僇乕僪僀儊乕僕愗懼.SelectedIndex + 1
    End Sub
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub lst攚宨夋憸傪昞帵_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst攚宨夋憸傪昞帵.SelectedIndexChanged
        Dim old As Boolean
        If mNew幚峴拞 Then Return
        If mLoading Then Return
        With gm僗僀僗僀嫟梡僋儔僗
            old = .p僗僀僗僀攚宨夋憸傪昞帵
            .p僗僀僗僀攚宨夋憸傪昞帵ListBoxIndex = lst攚宨夋憸傪昞帵.SelectedIndex
            mChgp僗僀僗僀攚宨夋憸傪昞帵 = (old <> .p僗僀僗僀攚宨夋憸傪昞帵)
            With gm僗僀僗僀嫟梡僋儔僗
                If .p僗僀僗僀攚宨夋憸傪昞帵 Then
                    rdbtn僇乕僪偺榞偺怓.Checked = True
                Else
                    rdbtn攚宨怓.Checked = True
                End If
            End With
            gggbol = zzColorBox忬懺愝掕()
            '-------------------------------------
            If .p僗僀僗僀攚宨夋憸傪昞帵 And pp僗僀僗僀幚峴拞 And (Not pp僗僀僗僀and儐儔儐儔幚峴拞) Then
                Call mn8儐儔儐儔幚峴_Click(Nothing, Nothing)
            End If
        End With
    End Sub
    Private Sub lst攚宨夋憸偺愗傝懼偊_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst攚宨夋憸偺愗傝懼偊.SelectedIndexChanged
        If mLoading Then Return
        If lst攚宨夋憸偺愗傝懼偊.SelectedIndex >= 0 Then
            mLoading = True
            gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨夋憸偺愗傝懼偊僺僢僠MenuIndex = lst攚宨夋憸偺愗傝懼偊.SelectedIndex + 1
        End If
        mLoading = False
    End Sub
    Private Sub lst攚宨夋憸偺柧傞偝_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst攚宨夋憸偺柧傞偝.SelectedIndexChanged
        If mLoading Then Return
        If lst攚宨夋憸偺柧傞偝.SelectedIndex >= 0 Then
            mLoading = True
            gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨夋憸柧傞偝ListIndex_0_5 = lst攚宨夋憸偺柧傞偝.SelectedIndex
        End If
        mLoading = False
    End Sub
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub lst堏摦儌乕僪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst堏摦儌乕僪.SelectedIndexChanged
        If Not mLoading And lst堏摦儌乕僪.SelectedIndex >= 0 Then Call oo儐儔儐儔.p夋憸偺堏摦儌乕僪Do_Click(lst堏摦儌乕僪.SelectedIndex + 1)
    End Sub
    Private Sub lst僘乕儉斾棪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst僘乕儉斾棪.SelectedIndexChanged
        If Not mLoading And lst僘乕儉斾棪.SelectedIndex >= 0 Then Call oo儐儔儐儔.p夋憸偺僘乕儉斾棪Do_Click(lst僘乕儉斾棪.SelectedIndex + 1)
    End Sub
    Private Sub lst堏摦斾棪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst堏摦斾棪.SelectedIndexChanged
        If Not mLoading And lst堏摦斾棪.SelectedIndex >= 0 Then Call oo儐儔儐儔.p夋憸偺堏摦斾棪Do_Click(lst堏摦斾棪.SelectedIndex + 1)
    End Sub
    Private Sub lst曄壔僗僺乕僪_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lst曄壔僗僺乕僪.SelectedIndexChanged
        If Not mLoading And lst曄壔僗僺乕僪.SelectedIndex >= 0 Then Call oo儐儔儐儔.p夋憸偺曄壔僗僺乕僪Do_Click(lst曄壔僗僺乕僪.SelectedIndex + 1)
    End Sub
    Private Sub lst曄壔僗僺乕僪攞悢_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst曄壔僗僺乕僪攞悢.SelectedIndexChanged
        If Not mLoading And lst曄壔僗僺乕僪攞悢.SelectedIndex >= 0 Then Call oo儐儔儐儔.lst曄壔僗僺乕僪攞悢Do_Click(lst曄壔僗僺乕僪攞悢.SelectedIndex + 1)
    End Sub
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Sub o怓尒杮_OnColorChanged(ByVal rCurMainColor As Integer, ByVal rCurColor As Integer, ByVal rChangeMode As 屲clsColorSet2401.ColorChangeMode, ByVal rEventMouseUp As Boolean) Handles o怓尒杮.OnColorChanged
        If mDlgLoading Then Return
        If o怓尒杮 Is Nothing Then Return
        If flg_o怓尒杮Loading Then Return
        If rCurColor >= 0 Then
            If rEventMouseUp Then
                If rdbtn攚宨怓.Checked Then lbl攚宨怓.BackColor = 嘳Color峔憿懱_from_怓抣(rCurColor) Else lbl僇乕僪偺榞偺怓.BackColor = 嘳Color峔憿懱_from_怓抣(rCurColor)
                lbl攚宨怓.Refresh()
                lbl僇乕僪偺榞偺怓.Refresh()
                If rEventMouseUp Or (rChangeMode > 1) Then
                    If mUserSTD Then
                        If rdbtn攚宨怓.Checked Then
                            gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨偺怓 = rCurColor
                        Else
                            gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僇乕僪榞偺怓(2) = rCurColor
                        End If
                    Else '僇僫偐側愱梡
                        gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨偺怓 = rCurColor
                    End If
                End If
            End If
        End If
        'Debug.Print("怓尒杮_OnColorChanged  " + CStr(rChangeMode) + "   " + CStr(rEventMouseUp))
    End Sub
#End Region

#Region "aa奜晹偲偺僀儞僞僼僃僀僗"
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aaBtnOptStateSet(ByRef op As String) As Boolean
        Try
            If Me.Visible = False Then Return False
        Catch ex As Exception
            Return False
        End Try
        mLoading = True
        With gm僗僀僗僀嫟梡僋儔僗
            If op = "" Or op = "p僗僀僗僀戝拞彫儌乕僪" Then
                lst戝拞彫儌乕僪.SelectedIndex = .p僗僀僗僀戝拞彫儌乕僪ListBoxIndex
            End If
            If op = "" Or op = "p僗僀僗僀僼儔僼儔儌乕僪" Then
                lst僼儔僼儔儌乕僪.SelectedIndex = .p僗僀僗僀僼儔僼儔儌乕僪ListBoxIndex
            End If
            If op = "" Or op = "p僗僀僗僀榞偺怓偼儔儞僟儉" Then
                chk榞偺怓偼儔儞僟儉.Checked = .p僗僀僗僀榞偺怓偼儔儞僟儉
            End If
            If op = "" Or op = "p僗僀僗僀攚宨夋憸傪昞帵" Then
                lst攚宨夋憸傪昞帵.SelectedIndex = .p僗僀僗僀攚宨夋憸傪昞帵ListBoxIndex
            End If
            If op = "" Or op = "p僗僀僗僀攚宨夋憸偺愗傝懼偊僺僢僠" Then
                lst攚宨夋憸偺愗傝懼偊.SelectedIndex = .p僗僀僗僀攚宨夋憸偺愗傝懼偊僺僢僠MenuIndex - 1
            End If
            If op = "" Or op = "p僗僀僗僀攚宨夋憸柧傞偝" Then
                lst攚宨夋憸偺柧傞偝.SelectedIndex = .p僗僀僗僀攚宨夋憸柧傞偝ListIndex_0_5
            End If

            If op = "" Or op = "p僗僀僗僀僇乕僪枃悢" Then
                lst僇乕僪枃悢.SelectedIndex = .p僗僀僗僀僇乕僪枃悢 - 1
            End If
            If op = "" Or op = "p僗僀僗僀僘乕儉儌乕僪Do" Then
                lst僘乕儉儌乕僪.SelectedIndex = .p僗僀僗僀僘乕儉儌乕僪Do - 1
            End If
            If op = "" Or op = "p僗僀僗僀僒僀僘" Then
                lst僇乕僪僒僀僘.SelectedIndex = .p僗僀僗僀僒僀僘 - 1
            End If
            If op = "" Or op = "p僗僀僗僀僗僺乕僪" Then
                lst僇乕僪僗僺乕僪.SelectedIndex = .p僗僀僗僀僗僺乕僪 - 1
            End If
            '---------------------------------------------------------------
            '僐儗僐僐丂僺僞儁僞丂愱梡
            If op = "" Or op = "p僗僀僗僀榞僒僀僘" Then
                lst榞偺懢偝.SelectedIndex = .p僗僀僗僀榞僒僀僘 - 1
            End If
            '---------------------------------------------------------------
            '僇僫偐側愱梡
            If op = "" Or op = "p僗僀僗僀僇乕僪僀儊乕僕偺愗傝懼偊僺僢僠" Then
                lst僇乕僪僀儊乕僕愗懼.SelectedIndex = .p僗僀僗僀僇乕僪僀儊乕僕偺愗傝懼偊僺僢僠MenuIndex - 1
            End If
            '僇僫偐側愱梡
            If op = "" Or op = "p僗僀僗僀僇乕僪僀儊乕僕" Then
                lst僇乕僪僀儊乕僕.SelectedIndex = frmMain.p僗僀僗僀僇乕僪僀儊乕僕
            End If
        End With
        With oo儐儔儐儔
            If op = "" Or op = "p夋憸偺堏摦儌乕僪" Then
                lst堏摦儌乕僪.SelectedIndex = .p夋憸偺堏摦儌乕僪 - 1
            End If
            If op = "" Or op = "p夋憸偺僘乕儉斾棪" Then
                lst僘乕儉斾棪.SelectedIndex = .p夋憸偺僘乕儉斾棪 - 1
            End If
            If op = "" Or op = "p夋憸偺堏摦斾棪" Then
                lst堏摦斾棪.SelectedIndex = .p夋憸偺堏摦斾棪 - 1
            End If
            If op = "" Or op = "p夋憸偺曄壔僗僺乕僪" Then
                lst曄壔僗僺乕僪.SelectedIndex = .p夋憸偺曄壔僗僺乕僪 - 1
            End If
            If op = "" Or op = "p夋憸偺曄壔僗僺乕僪摿暿攞悢" Then
                lst曄壔僗僺乕僪攞悢.SelectedIndex = .p夋憸偺曄壔僗僺乕僪摿暿攞悢
            End If
        End With
        'If op <> "" Then gggbol = aaEnabledSet()
        mLoading = False
        Return True
    End Function
#End Region

#Region "儘乕僇儖僿儖僷乕"
    Private Function zzColorBox忬懺愝掕() As Boolean
        Try
            If mThisCall Then Return False
            If mNew幚峴拞 Then Return False
            If mLoading Then Return False
            If o怓尒杮 Is Nothing Then Return False
            If flg_o怓尒杮Loading Then Return False
            '------------------------------------------------------------------
            With gm僗僀僗僀嫟梡僋儔僗
                Dim e攚宨夋憸偼巊梡偟側偄 As Boolean = Not zz攚宨夋憸偺巊梡_CurSetting_In_Listbox()
                Dim e僇乕僪偺榞偺怓偼愝掕抣 As Boolean = Not .p僗僀僗僀榞偺怓偼儔儞僟儉 '(Not chk榞偺怓偼儔儞僟儉.Checked)
                '------------------------------------------------------------------
                mThisCall = True
                '------------------------------------------------------------------
                Dim ccc As Integer = 嘳Color峔憿懱_to_怓抣(System.Drawing.SystemColors.Control)
                '------------------------------------------------------------------
                '------------------------------------------------------------------
                lbl攚宨怓.BackColor = 嘳Color峔憿懱_from_怓抣(IIf(e攚宨夋憸偼巊梡偟側偄, .p僗僀僗僀攚宨偺怓, ccc))
                lbl攚宨怓.Visible = e攚宨夋憸偼巊梡偟側偄
                '------------------------------------------------------------------
                lbl僇乕僪偺榞偺怓.BackColor = 嘳Color峔憿懱_from_怓抣(IIf(e僇乕僪偺榞偺怓偼愝掕抣, .p僗僀僗僀僇乕僪榞偺怓(2), ccc))
                '------------------------------------------------------------------
                If mUserSTD Then
                    '------------------------------------------------------------------
                    rdbtn僇乕僪偺榞偺怓.Visible = e僇乕僪偺榞偺怓偼愝掕抣 : lbl僇乕僪偺榞偺怓.Visible = e僇乕僪偺榞偺怓偼愝掕抣
                    '------------------------------------------------------------------
                    o怓尒杮.Enabled = (e攚宨夋憸偼巊梡偟側偄 Or e僇乕僪偺榞偺怓偼愝掕抣)
                    '------------------------------------------------------------------
                    rdbtn攚宨怓.Visible = True : lbl攚宨怓偐側僇僫.Visible = False
                    '------------------------------------------------------------------
                    rdbtn攚宨怓.Visible = e攚宨夋憸偼巊梡偟側偄
                    '------------------------------------------------------------------
                    chk榞偺怓偼儔儞僟儉.Checked = .p僗僀僗僀榞偺怓偼儔儞僟儉
                    '------------------------------------------------------------------
                Else '偐側僇僫
                    '------------------------------------------------------------------
                    rdbtn攚宨怓.Visible = False : lbl攚宨怓偐側僇僫.Visible = e攚宨夋憸偼巊梡偟側偄
                    '------------------------------------------------------------------
                    rdbtn僇乕僪偺榞偺怓.Visible = False : lbl僇乕僪偺榞偺怓.Visible = False
                    '------------------------------------------------------------------
                    o怓尒杮.Enabled = e攚宨夋憸偼巊梡偟側偄
                    '------------------------------------------------------------------
                    chk榞偺怓偼儔儞僟儉.Visible = False

                End If
                mThisCall = False
                If Not o怓尒杮.Enabled Then
                    o怓尒杮.CurMainColor = &HC0C0C0&
                Else
                    If mUserSTD Then
                        If rdbtn攚宨怓.Checked = True Then
                            o怓尒杮.CurMainColor() = .p僗僀僗僀攚宨偺怓
                        ElseIf rdbtn僇乕僪偺榞偺怓.Checked = True Then
                            o怓尒杮.CurMainColor() = .p僗僀僗僀僇乕僪榞偺怓(2)
                        End If
                    Else
                        o怓尒杮.CurMainColor() = .p僗僀僗僀攚宨偺怓
                    End If
                End If
                '------------------------------------------------------------------
                mChgp僗僀僗僀攚宨夋憸傪昞帵 = False
                mChgp僗僀僗僀榞偺怓偼儔儞僟儉 = False
                '------------------------------------------------------------------
            End With
            Return True
        Catch
            MsgBox(ErrorToString)
            Return False
        End Try
    End Function

    Private Function zz攚宨夋憸偺巊梡_CurSetting_In_Listbox() As Boolean
        Return (gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨夋憸傪昞帵_By_CurListBoxIndex(lst攚宨夋憸傪昞帵.SelectedIndex))
    End Function

#End Region

#Region "僀儀儞僩 from oo儐儔儐儔"

    Private Sub oo儐儔儐儔_p夋憸偺僘乕儉斾棪chg(ByRef 僾儘僷僐儅儞僪 As Integer, ByRef v As Integer) Handles oo儐儔儐儔.p夋憸偺僘乕儉斾棪chg
        'If gm昞帵拞Dlg僗僀僗僀儐儔儐儔 = False Then Return
        mLoading = True
        lst僘乕儉斾棪.SelectedIndex = 嘳悢抣斖埻Int(0, lst僘乕儉斾棪.Items.Count - 1, v - 1)
        mLoading = False
    End Sub

    Private Sub oo儐儔儐儔_p夋憸偺堏摦儌乕僪chg(ByRef 僾儘僷僐儅儞僪 As Integer, ByRef v As Integer) Handles oo儐儔儐儔.p夋憸偺堏摦儌乕僪chg
        'If gm昞帵拞Dlg僗僀僗僀儐儔儐儔 = False Then Return
        mLoading = True
        lst堏摦儌乕僪.SelectedIndex = 嘳悢抣斖埻Int(0, lst堏摦儌乕僪.Items.Count - 1, v - 1)
        mLoading = False
    End Sub

    Private Sub oo儐儔儐儔_p夋憸偺堏摦斾棪chg(ByRef 僾儘僷僐儅儞僪 As Integer, ByRef v As Integer) Handles oo儐儔儐儔.p夋憸偺堏摦斾棪chg
        'If gm昞帵拞Dlg僗僀僗僀儐儔儐儔 = False Then Return
        mLoading = True
        lst堏摦斾棪.SelectedIndex = 嘳悢抣斖埻Int(0, lst堏摦斾棪.Items.Count - 1, v - 1)
        mLoading = False
    End Sub

    Private Sub oo儐儔儐儔_p夋憸偺曄壔僗僺乕僪chg(ByRef 僾儘僷僐儅儞僪 As Integer, ByRef v As Integer) Handles oo儐儔儐儔.p夋憸偺曄壔僗僺乕僪chg
        'If gm昞帵拞Dlg僗僀僗僀儐儔儐儔 = False Then Return
        mLoading = True
        lst曄壔僗僺乕僪.SelectedIndex = 嘳悢抣斖埻Int(0, lst曄壔僗僺乕僪.Items.Count - 1, v - 1)
        mLoading = False
    End Sub

#End Region

#Region "僀儀儞僩 from gAppEventMaker"

    Private Sub 僀儀儞僩gAppEventMaker_僇乕僪僔儑乕奐巒偲掆巭(ByVal r奐巒true掆巭false As Boolean) Handles 僀儀儞僩gAppEventMaker.僇乕僪僔儑乕奐巒偲掆巭
        If Me.Visible Then
            If r奐巒true掆巭false Then
                Call mnu暵偠傞_Click(Nothing, Nothing)
            End If
        End If
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僗僀僗僀儐儔儐儔夋憸昞帵ONOFF(ByVal r夋憸昞帵OnOff As Boolean) Handles 僀儀儞僩gAppEventMaker.僗僀僗僀儐儔儐儔夋憸昞帵ONOFF
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        Dim e0 As Boolean, e0not As Boolean
        '------------------------------------------------------------------
        e0 = (Not zz攚宨夋憸偺巊梡_CurSetting_In_Listbox()) : e0not = Not e0
        '------------------------------------------------------------------
        lbl僇僶乕1.Visible = e0 : lbl僇僶乕2.Visible = e0
        '------------------------------------------------------------------
        rdbtn攚宨怓.Enabled = e0 : lbl攚宨怓.Enabled = e0 : lbl攚宨怓.BackColor = 嘳Color峔憿懱_from_怓抣(IIf(e0, IIf(mUserSTD, gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀攚宨偺怓, gm僗僀僗僀嫟梡僋儔僗.p僗僀僗僀僇乕僪榞偺怓(1)), 嘳Color峔憿懱_to_怓抣(System.Drawing.SystemColors.Control)))
        '------------------------------------------------------------------
        mn8僗僀僗僀偲儐儔儐儔傪幚峴.Enabled = r夋憸昞帵OnOff
        mn8儐儔儐儔幚峴.Enabled = r夋憸昞帵OnOff

    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僗僀僗僀偲儐儔儐儔奐巒偲掆巭() Handles 僀儀儞僩gAppEventMaker.僗僀僗僀偲儐儔儐儔奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        gggbol = 僀儀儞僩gAppEventMaker.僗僀僗僀偲儐儔儐儔奐巒偲掆巭_嫟捠張棟("gmDlg僗僀僗僀儐儔儐儔", mn8僗僀僗僀偲儐儔儐儔傪幚峴, mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭, _
                                   mn8僗僀僗僀幚峴, mn8僗僀僗僀掆巭, mn8儐儔儐儔幚峴, mn8儐儔儐儔掆巭, _
                                   Nothing, mn8僗僀僗僀夋憸傪愝掕)
        mnu師偺夋憸偵愗傝懼偊.Enabled = pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 And (Not gAppEventMaker.僼僅乕儉偺昞帵徚嫀_愝掕偲庢摼(0, gmDlgFile僗僀僗僀梡))
        If (pp儐儔儐儔幚峴拞 Or pp僗僀僗僀and儐儔儐儔幚峴拞) Then lst攚宨夋憸傪昞帵.SelectedIndex = 0

    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僎乕儉奐巒偲掆巭(ByVal r奐巒True掆巭False As Boolean, ByRef wOptionRetStr As String) Handles 僀儀儞僩gAppEventMaker.僎乕儉奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        If r奐巒True掆巭False Then
            Call mnu暵偠傞_Click(Nothing, Nothing)
        Else

        End If
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僼僅乕儉偺昞帵偲徚嫀(ByVal r僼僅乕儉柤ID As Integer, ByVal r昞帵True徚嫀False As Boolean) Handles 僀儀儞僩gAppEventMaker.僼僅乕儉偺昞帵偲徚嫀
        Dim wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 As Boolean
        RaiseEvent 懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨(mMe_gmDlgID, r僼僅乕儉柤ID, r昞帵True徚嫀False, wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄)
        If wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 Then
            Call mnu暵偠傞_Click(Nothing, Nothing)
        Else
            If gm傾僾儕廔椆偡傞 Then Return
            If Me.Visible = False Then Return
            If r僼僅乕儉柤ID = mMe_gmDlgID Then Return
            Select Case r僼僅乕儉柤ID
                Case gmDlg僗僀僗僀儐儔儐儔          'Call from Me
                    If r昞帵True徚嫀False Then mnu師偺夋憸偵愗傝懼偊.Enabled = pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞
                Case gmDlgFile僗僀僗僀梡
                    mn8僗僀僗僀夋憸傪愝掕.Enabled = Not r昞帵True徚嫀False
                    mnu師偺夋憸偵愗傝懼偊.Enabled = (Not r昞帵True徚嫀False) And pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞
                Case gmDlg僗僀僗僀僇乕僪宆傪愝掕
                    mn8僗僀僗僀梡僇乕僪宆傪愝掕.Enabled = Not r昞帵True徚嫀False
            End Select
        End If
    End Sub

#End Region

End Class

