Option Strict Off
Option Explicit On
Imports System.Windows.Forms
'------------------------------------ 2023/11/09 ------------------------------------
Public Class 巐frmDlgUseCardSelect

#Region "愰尵"
    '---------------------------------------------------
    Event 僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer, ByRef w僟僀傾儘僌僥僉僗僩 As String, ByRef w巊梡栚揑儊僢僙乕僕 As String, ByRef w僞僥屄悢 As Integer, ByRef w巊梡屄悢_0_to_max As Integer, ByRef w傾僾儕宆_max As Integer, _
                ByRef w僙儖暆 As Integer, ByRef w僙儖崅 As Integer, ByRef wCell娫僞僥儓僐 As Integer, ByRef w恾宍奜墢榞暆 As Integer, ByRef w恾宍奜墢榞怓 As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer)
    Event 僇乕僪僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByVal r僇乕僪宆IDX As Integer, ByVal r僙儖暆 As Integer, ByVal r僙儖崅 As Integer, ByRef w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer, ByRef w僇乕僪傪巊梡偟偰偄傞 As Boolean)
    Event 僇乕僪枃悢偲僗僀僗僀儊僯儏乕傪巊梡偟傑偡偐(ByRef wIsOK As Boolean, ByRef w僇乕僪枃悢儊僯儏乕傪巊梡偡傞 As Boolean, ByRef w僗僀僗僀儊僯儏乕傪巊梡偡傞 As Boolean)
    Event 僇乕僪宆偺慖戰忬懺傪曄峏偟偰壓偝偄(ByRef wIsOK As Boolean, ByRef r僇乕僪慖戰僨乕僞乕() As Boolean)
    Event 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(ByRef wIsOK As Boolean, ByRef r僐儅儞僪 As Integer, ByRef r捛壛僨乕僞乕 As Integer)
    Event 僇乕僪枃悢巜掕Checked愝掕(ByRef wIsOK As Boolean, ByRef mnu僇乕僪枃悢_1 As ToolStripMenuItem, ByRef mnu僇乕僪枃悢_2 As ToolStripMenuItem, ByRef mnu僇乕僪枃悢_3 As ToolStripMenuItem, ByRef mnu僇乕僪枃悢_4 As ToolStripMenuItem, ByRef mnu僇乕僪枃悢_5 As ToolStripMenuItem)
    '---------------------------------------------------
    '怓愝掕Dlg 偐傜偺揮憲
    Event 僇儔乕偑曄峏偝傟傑偟偨(ByVal rIndex As Integer, ByVal rColor As Integer)
    Event 僇儔乕傪偡傋偰尦偵栠偟側偝偄(ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer)
    Event 僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄(ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer)
    Event 儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄(ByRef w尦偵栠偡 As Boolean, ByRef w婯掕抣偵儕僙僢僩 As Boolean, ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt 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 mMe_gmDlgID As Integer = 0
    Private m傾僾儕宆_max As Integer = 0
    Private m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 As Boolean = False
    '**************************************************************************************************************************************
    Private WithEvents 僀儀儞僩gAppEventMaker As 屲clsEventMaker
    '**************************************************************************************************************************************
    Private WithEvents m岥岥岥 As 屲clsCellListBox
    '***************************************************
#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, Me.Text)
    End Function
#End Region

#Region "弶婜壔"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUseCardSelect_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        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 巐frmDlgUseCardSelect_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        qqqqq("巐frmDlgUseCardSelect_Disposed")
        Call frmMain.frmDlgUseCardSelect_User_s_DisPose(mMe_gmDlgID)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUseCardSelect_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'qqqqq("仠巐frmDlgUseCardSelect_Load")
        '***************************************************
        Dim wIsOK As Boolean, wMe_gmDlgID As Integer, w僟僀傾儘僌僥僉僗僩 As String = "", w巊梡栚揑儊僢僙乕僕 As String = "", w僞僥屄悢 As Integer, w巊梡屄悢_0_to_max As Integer, w傾僾儕宆_max As Integer
        Dim rw僙儖暆 As Integer, rw僙儖崅 As Integer, rwCell娫僞僥儓僐 As Integer, rw恾宍奜墢榞暆 As Integer, w恾宍奜墢榞怓 As Integer, w儕僗僩攚宨怓 As Integer, w慖戰怓 As Integer
        wIsOK = False
        RaiseEvent 僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄(wIsOK, wMe_gmDlgID, w僟僀傾儘僌僥僉僗僩, w巊梡栚揑儊僢僙乕僕, w僞僥屄悢, w巊梡屄悢_0_to_max, w傾僾儕宆_max, rw僙儖暆, rw僙儖崅, rwCell娫僞僥儓僐, rw恾宍奜墢榞暆, w恾宍奜墢榞怓, w儕僗僩攚宨怓, w慖戰怓)
        '---------------------------------------------------
        If wIsOK = False Then GoTo EXIT_ON_ERROR
        If w僞僥屄悢 < 1 Or w巊梡屄悢_0_to_max < 1 Or w僞僥屄悢 > 20 Or w巊梡屄悢_0_to_max > 400 Then GoTo EXIT_ON_ERROR
        If rw僙儖暆 < 20 Or rw僙儖崅 < 20 Or rw僙儖暆 > 400 Or rw僙儖崅 > 400 Then GoTo EXIT_ON_ERROR
        '---------------------------------------------------
        Dim w僇乕僪枃悢儊僯儏乕傪巊梡偡傞 As Boolean, w僗僀僗僀儊僯儏乕傪巊梡偡傞 As Boolean
        wIsOK = False
        RaiseEvent 僇乕僪枃悢偲僗僀僗僀儊僯儏乕傪巊梡偟傑偡偐(wIsOK, w僇乕僪枃悢儊僯儏乕傪巊梡偡傞, w僗僀僗僀儊僯儏乕傪巊梡偡傞)
        If wIsOK = False Then GoTo EXIT_ON_ERROR
        '***************************************************
        僀儀儞僩gAppEventMaker = gAppEventMaker
        '---------------------------------------------------
        mMe_gmDlgID = wMe_gmDlgID
        m傾僾儕宆_max = w傾僾儕宆_max
        Me.Text = w僟僀傾儘僌僥僉僗僩  'Me.Text丂偼丂INI僼傽僀儖偺撉傒彂偒丂Function zzAppIniFileOp() 偱巊梡偡傞丅
        lbl巊梡栚揑儊僢僙乕僕.Text = w巊梡栚揑儊僢僙乕僕
        mnu僇乕僪枃悢.Visible = w僇乕僪枃悢儊僯儏乕傪巊梡偡傞
        mn8suiyula.Visible = w僗僀僗僀儊僯儏乕傪巊梡偡傞
        '---------------------------------------------------
        Dim ooINI傪撉傒崬傓慜偺僼僅乕儉偺Left As Integer = Me.Left   'INI 僼傽僀儖偑懚嵼偟側偄応崌偵丄偙偺僼僅乕儉傪夋柺偺僙儞僞乕偵昞帵偡傞僐乕僪丅
        gggbol = zzAppIniFileOp(0)
        '---------------------------------------------------
        Dim MeOwner As Form = Me.Owner
        If MeOwner IsNot Nothing Then
            If MeOwner.Icon IsNot Nothing Then Me.Icon = MeOwner.Icon
        End If
        '***************************************************
        m岥岥岥 = New 屲clsCellListBox
        Dim 岥岥岥width As Integer, 岥岥岥height As Integer
        Dim 岥岥岥left As Integer = 20, 岥岥岥top As Integer = 50
        Dim 巊梡屄悢 = (w巊梡屄悢_0_to_max + 1)
        Dim 儓僐屄悢 = (巊梡屄悢 \ w僞僥屄悢) + IIf(巊梡屄悢 Mod w僞僥屄悢 = 0, 0, 1)
        Dim rMouseChkInSide_0_to_03 As Single = 0.05
        gggbol = m岥岥岥.僙儖儕僗僩嶌惉偲弶婜壔(Me, BorderStyle.Fixed3D, True, 儓僐屄悢, w僞僥屄悢, 巊梡屄悢, rw恾宍奜墢榞暆, rw僙儖暆, rw僙儖崅, rwCell娫僞僥儓僐, rMouseChkInSide_0_to_03, w儕僗僩攚宨怓, w慖戰怓, w恾宍奜墢榞怓, 岥岥岥left, 岥岥岥top, 岥岥岥width, 岥岥岥height)
        '---------------------------------------------------
        'qqqqq("m岥岥岥   " + Format(岥岥岥width, "000") + ", " + Format(岥岥岥height, "000"))
        '***************************************************
        '儃僞儞偲儔儀儖偺埵抲愝掕
        Dim xx As Integer = 岥岥岥left + 岥岥岥width + 20
        btn偡傋偰偺慖戰傪夝彍.Left = xx : btn偡傋偰慖戰偡傞.Left = xx : btn傾僾儕宆偩偗偡傋偰慖戰.Left = xx : btn儐乕僓乕宆偩偗偡傋偰慖戰.Left = xx : lbl巊梡栚揑儊僢僙乕僕.Left = xx
        '---------------------------------------------------
        Dim www As Integer = (btn儐乕僓乕宆偩偗偡傋偰慖戰.Right + 20) + Me.Width - Me.ClientSize.Width
        Dim hhh As Integer = (岥岥岥top + 岥岥岥height + 20) + Me.Height - Me.ClientSize.Height
        Dim xxx As Integer = 100
        Dim yyy As Integer = 100
        If MeOwner IsNot Nothing Then
            With MeOwner
                xxx = .Left + (.Width \ 2) - (www \ 2) : yyy = .Top + (.Height \ 2) - (hhh \ 2)
            End With
        End If
        '---------------------------------------------------
        If ooINI傪撉傒崬傓慜偺僼僅乕儉偺Left = Me.Left Then
            '傕偟 INI 僼傽僀儖偑撉傒崬傑傟偢偵丄僂僀儞僪僒僀僘偑僨僓僀儞帪偺僒僀僘偺傑傑偱偁傟偽
            'qqqqq("INI 僼傽僀儖偑撉傒崬傑傟偢")
            Me.SetBounds(xxx, yyy, www, hhh, BoundsSpecified.All)
        Else
            Me.SetBounds(0, 0, www, hhh, BoundsSpecified.Size)
        End If
        '***************************************************
        gggbol = m岥岥岥.aaCardDrawAll(False)
        gggbol = m岥岥岥.僙儖偺慖戰忬懺COPY_OldToNew1_NewToOld2(0, True, 1)
        gggbol = zzEnabledSet()
        '--------------------------------------------------
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僼僅乕儉偺昞帵徚嫀(mMe_gmDlgID, True)
        '--------------------------------------------------
        Return
        '---------------------------------------------------
EXIT_ON_ERROR:
        Call 嘳MsgBox_OK_忣曬("巐frmDlgUseCardSelect_Load() 撪偱僄儔乕偑敪惗偟傑偟偨丅")
        Me.Close()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "撪晹張棟"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn偡傋偰偺慖戰傪夝彍_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn偡傋偰偺慖戰傪夝彍.Click
        gggbol = zz偡傋偰偺慖戰_onoff(False, 0)
    End Sub
    Private Sub btn偡傋偰慖戰偡傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn偡傋偰慖戰偡傞.Click
        gggbol = zz偡傋偰偺慖戰_onoff(True, 0)
    End Sub
    Private Sub btn傾僾儕宆偩偗偡傋偰慖戰_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn傾僾儕宆偩偗偡傋偰慖戰.Click
        gggbol = zz偡傋偰偺慖戰_onoff(True, 1)
    End Sub
    Private Sub btn儐乕僓乕宆偩偗偡傋偰慖戰_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn儐乕僓乕宆偩偗偡傋偰慖戰.Click
        gggbol = zz偡傋偰偺慖戰_onoff(True, 2)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz偡傋偰偺慖戰_onoff(ByVal OnTrue_OffFalse As Boolean, ByVal 儈僢僋僗0_傾僾儕偺傒1_儐乕僓乕偺傒2 As Integer) As Boolean
        Dim 儈僢僋僗 As Boolean = (儈僢僋僗0_傾僾儕偺傒1_儐乕僓乕偺傒2 = 0)
        Dim 傾僾儕 As Boolean = (儈僢僋僗0_傾僾儕偺傒1_儐乕僓乕偺傒2 = 1)
        Dim 儐乕僓乕 As Boolean = (儈僢僋僗0_傾僾儕偺傒1_儐乕僓乕偺傒2 = 2)
        Dim a As Integer, ee As Boolean
        For a = 0 To m岥岥岥.僙儖巊梡MAX
            If OnTrue_OffFalse Then
                If a <= m傾僾儕宆_max Then ee = (儈僢僋僗 Or 傾僾儕) Else ee = (儈僢僋僗 Or 儐乕僓乕)
            Else
                ee = False
            End If
            gggbol = m岥岥岥.僙儖偺慖戰new忬懺SET(a, ee) '      m僇乕僪僨乕僞乕(a).慖戰new = ee
            gggbol = m岥岥岥.aaCardDraw(a, True, False)
        Next
        m岥岥岥.Refresh()
        gggbol = zzEnabledSet()
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzEnabledSet() As Boolean
        Dim 傾僾儕偼偡傋偰慖戰 As Boolean, 儐乕僓乕偼偡傋偰慖戰 As Boolean, 偄偢傟偐偑慖戰 As Boolean
        gggbol = m岥岥岥.偡傋偰偺慖戰忬懺僠僃僢僋(m傾僾儕宆_max, 傾僾儕偼偡傋偰慖戰, 儐乕僓乕偼偡傋偰慖戰, 偄偢傟偐偑慖戰)
        btn偡傋偰偺慖戰傪夝彍.Enabled = 偄偢傟偐偑慖戰
        btn偡傋偰慖戰偡傞.Enabled = Not (傾僾儕偼偡傋偰慖戰 And 儐乕僓乕偼偡傋偰慖戰)
        btn傾僾儕宆偩偗偡傋偰慖戰.Enabled = Not 傾僾儕偼偡傋偰慖戰
        btn儐乕僓乕宆偩偗偡傋偰慖戰.Enabled = Not 儐乕僓乕偼偡傋偰慖戰
        mnu慖戰傪揔梡.Enabled = m岥岥岥.慖戰忬懺偼曄峏偝傟偰偄傞() And 偄偢傟偐偑慖戰
        lbl慖戰傪揔梡寈崘儊僢僙乕僕.Enabled = mnu慖戰傪揔梡.Enabled
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz僇乕僪宆偺慖戰忬懺傪屇傃弌偟尦偵傕愝掕() As Boolean
        Dim wIsOK As Boolean, r僇乕僪慖戰僨乕僞乕(0) As Boolean
        gggint = m岥岥岥.僙儖偺慖戰new忬懺GETALL(r僇乕僪慖戰僨乕僞乕)
        wIsOK = False
        RaiseEvent 僇乕僪宆偺慖戰忬懺傪曄峏偟偰壓偝偄(wIsOK, r僇乕僪慖戰僨乕僞乕)
        If wIsOK Then
            gggint = m岥岥岥.僙儖偺慖戰忬懺COPY_OldToNew1_NewToOld2(0, True, 2)
        End If
        gggbol = zzEnabledSet()
        Return wIsOK
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "儊僯儏乕憖嶌"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu慖戰傪揔梡_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu慖戰傪揔梡.Click
        Dim wIsOK As Boolean
        If zz僇乕僪宆偺慖戰忬懺傪屇傃弌偟尦偵傕愝掕() Then
            If mMe_gmDlgID = gmDlg僗僀僗僀僇乕僪宆傪愝掕 Then
                If pp僗僀僗僀幚峴拞 Or pp僗僀僗僀and儐儔儐儔幚峴拞 Then        '0 = 側偟丂丂丂1 = 僗僀僗僀偺傒丂丂丂2 = 儐儔儐儔偺傒丂丂丂3 = 僗僀僗僀儐儔儐儔椉曽
                    gm僗僀僗僀嵞僗僞乕僩尨場 = gc曄峏p僗僀僗僀僇乕僪枃悢
                Else
                    'no op
                End If
            ElseIf mMe_gmDlgID = gmDlg僎乕儉僇乕僪宆傪愝掕 Then
                m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = True
                If Not pp僎乕儉幚峴拞 Then
                    wIsOK = False : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, gccom尰嵼偺僎乕儉傪尰嵼偺僇乕僪枃悢偱嵞僗僞乕僩, 0)
                Else
                    wIsOK = False : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, gccom尰嵼偺僎乕儉偺幚峴忬嫷偺傑傑_aa僇乕僪偺攝抲偲嵞昤夋, 0)
                End If

            ElseIf mMe_gmDlgID = gmDlg僂儘僂儘僎乕儉梡僇乕僪宆慖戰曄峏 Then
                'add 2023/03/03 using in urouro
                wIsOK = False : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, gccom尰嵼偺僎乕儉傪尰嵼偺僇乕僪枃悢偱嵞僗僞乕僩, 0)
            Else
                'no op
            End If
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu僇乕僪枃悢_DropDownOpening(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu僇乕僪枃悢.DropDownOpening
        If mnu僇乕僪枃悢.Visible = False Then Return
        Dim wIsOK As Boolean : RaiseEvent 僇乕僪枃悢巜掕Checked愝掕(wIsOK, mnu僇乕僪枃悢巜掕Do_1, mnu僇乕僪枃悢巜掕Do_2, mnu僇乕僪枃悢巜掕Do_3, mnu僇乕僪枃悢巜掕Do_4, mnu僇乕僪枃悢巜掕Do_5)
    End Sub
    Private Sub mnu僇乕僪枃悢巜掕Do_1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu僇乕僪枃悢巜掕Do_1.Click, mnu僇乕僪枃悢巜掕Do_2.Click, mnu僇乕僪枃悢巜掕Do_3.Click, mnu僇乕僪枃悢巜掕Do_4.Click, mnu僇乕僪枃悢巜掕Do_5.Click
        Dim index As Integer = IIf(sender.Equals(mnu僇乕僪枃悢巜掕Do_1), 1, IIf(sender.Equals(mnu僇乕僪枃悢巜掕Do_2), 2, IIf(sender.Equals(mnu僇乕僪枃悢巜掕Do_3), 3, IIf(sender.Equals(mnu僇乕僪枃悢巜掕Do_4), 4, IIf(sender.Equals(mnu僇乕僪枃悢巜掕Do_5), 5, 0)))))
        If index = 0 Then Return
        '--------------------------------------------------
        m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = False
        Dim MsgboxCap As String = "僺僞儁僞丂僎乕儉梡僇乕僪宆丂愝掕"
        '--------------------------------------------------
        Dim 僇乕僪宆儕僗僩慖戰悢 As Integer = m岥岥岥.慖戰僇乕僪宆偺憤悢()
        If 僇乕僪宆儕僗僩慖戰悢 = 0 Then
            MsgBox("僇乕僪宆偼堦偮埲忋昁梫偱偡" + gggCR2 + "儕僗僩撪偱丄僇乕僪宆傪慖戰偟偰偔偩偝偄丅", MsgBoxStyle.OkOnly, MsgboxCap)
            Return
        Else
            If m岥岥岥.慖戰忬懺偼曄峏偝傟偰偄傞() Then
                Select Case MsgBox("僎乕儉梡偺僇乕僪宆偺慖戰忬懺偼丄怴偟偔側偭偰偄傑偡" + gggCR2 + "僎乕儉梡偺僇乕僪宆偺慖戰忬懺傪丄揔梡偟傑偡偐", MsgBoxStyle.YesNoCancel, MsgboxCap)
                    Case MsgBoxResult.Cancel
                        Return
                    Case MsgBoxResult.Yes
                        If Not zz僇乕僪宆偺慖戰忬懺傪屇傃弌偟尦偵傕愝掕() Then Return
                    Case MsgBoxResult.No
                        'no op
                End Select
            End If
            m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = True
            Dim wIsOK As Boolean = False : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, gccom僇乕僪枃悢巜掕Do_1_2_3_4_5, index)
            gggbol = zzEnabledSet()
            Return
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu偙偺傾僾儕傪廔椆_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu偙偺傾僾儕傪廔椆.Click
        If Not 嘳MsgBox_傾僾儕廔椆偟傑偡偐(app傾僾儕僞僀僩儖) Then Return
        Dim wIsOK As Boolean : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, gccom傾僾儕廔椆, 0)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    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, mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭.Click, mn8僗僀僗僀幚峴.Click, mn8僗僀僗僀掆巭.Click, mn8儐儔儐儔幚峴.Click, mn8儐儔儐儔掆巭.Click, mn8僗僀僗僀偲儐儔儐儔傪昞帵.Click, mn8僗僀僗僀夋憸傪愝掕.Click, mn8偙偺傾僾儕傪廔椆.Click
        Dim opcode As Integer = IIf(sender Is mn8僗僀僗僀偲儐儔儐儔傪幚峴, gccom僗僀僗僀偲儐儔儐儔傪幚峴, IIf(sender Is mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭, gccom僗僀僗僀偲儐儔儐儔偡傋偰掆巭, IIf(sender Is mn8僗僀僗僀幚峴, gccom僗僀僗僀幚峴, _
                                IIf(sender Is mn8僗僀僗僀掆巭, gccom僗僀僗僀掆巭, IIf(sender Is mn8儐儔儐儔幚峴, gccom儐儔儐儔幚峴, IIf(sender Is mn8儐儔儐儔掆巭, gccom儐儔儐儔掆巭, _
                                IIf(sender Is mn8僗僀僗僀偲儐儔儐儔傪昞帵, gccom僗僀僗僀偲儐儔儐儔傪昞帵, IIf(sender Is mn8僗僀僗僀夋憸傪愝掕, gccom僗僀僗僀夋憸傪愝掕, IIf(sender Is mn8偙偺傾僾儕傪廔椆, gccom傾僾儕廔椆, 0)))))))))
        If opcode = 0 Then Return
        If opcode = gccom傾僾儕廔椆 Then
            If Not 嘳MsgBox_傾僾儕廔椆偟傑偡偐(app傾僾儕僞僀僩儖) Then Return
        End If
        Dim wIsOK As Boolean : RaiseEvent 僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(wIsOK, opcode, 0)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu暵偠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu暵偠傞.Click
        '2023/01/06 delete 懠偺僟僀傾儘僌偑昞帵偝傟傞偲偒偵丄僐僐偑屇傃弌偝傟傞応崌偑偁傞偺偱丄張棟偑暋嶨偵側傞偺偱丄偙偺僐乕僪偼嶍彍偟偨丅
        'If mnu慖戰傪揔梡.Enabled Then
        '    If Not 嘳MsgBox_Yes_TRUE_No_FALSE(Me.Text, "仠怴偟偄慖戰偑揔梡偝傟偰偄傑偣傫仠" & gggCR2 & "偙偺僟僀傾儘僌偱愝掕偟偨丄怴偟偄慖戰偑揔梡偝傟偰偄傑偣傫丅" & gggCR2 & "偙偺傑傑僟僀傾儘僌傪暵偠傑偡偐丠") Then Return
        'End If
        Me.Close()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu怓偺愝掕_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu怓偺愝掕.Click
        If gm傾僾儕廔椆偡傞 Then Return
        gggbol = m岥岥岥.aa怓偺愝掕僟僀傾儘僌Show(Me)
    End Sub
#End Region

#Region "僀儀儞僩 from gAppEventMaker"

    Private Sub 僀儀儞僩gAppEventMaker_僎乕儉奐巒偲掆巭(ByVal r奐巒True掆巭False As Boolean, ByRef wOptionRetStr As String) Handles 僀儀儞僩gAppEventMaker.僎乕儉奐巒偲掆巭
        'qqqqq("僀儀儞僩gAppEventMaker_僎乕儉奐巒偲掆巭")
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        If gmDlg僎乕儉僇乕僪宆傪愝掕_偼_僎乕儉奐巒帪偵偼昞帵偝傟偰偄傞 Then
            'qqqqq("gmDlg僎乕儉僇乕僪宆傪愝掕_偼_僎乕儉奐巒帪偵偼昞帵偝傟偰偄傞 ")
            Return
        End If
        '---------------------------------------------------------
        'add 2023/03/03
        Select Case mMe_gmDlgID
            'add 2023/03/03 using in urouro
            Case gmDlg僂儘僂儘僎乕儉梡僇乕僪宆慖戰曄峏
                Return
        End Select
        '---------------------------------------------------------
        If r奐巒True掆巭False Then
            If m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = True Then
                m偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = False
                Return
            Else
                mnu暵偠傞_Click(Nothing, Nothing)
            End If

        Else
            mnu暵偠傞_Click(Nothing, Nothing)
        End If
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僇乕僪僔儑乕奐巒偲掆巭(ByVal r奐巒true掆巭false As Boolean) Handles 僀儀儞僩gAppEventMaker.僇乕僪僔儑乕奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        Select Case mMe_gmDlgID
            Case gmDlg僎乕儉僇乕僪宆傪愝掕, gmDlg僗僀僗僀僇乕僪宆傪愝掕, gmDlg偐側僇僫僇乕僪宆傪愝掕
                If r奐巒true掆巭false = True Then Call mnu暵偠傞_Click(Nothing, Nothing)
        End Select
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僗僀僗僀偲儐儔儐儔奐巒偲掆巭() Handles 僀儀儞僩gAppEventMaker.僗僀僗僀偲儐儔儐儔奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        Select Case mMe_gmDlgID
            Case gmDlg僎乕儉僇乕僪宆傪愝掕 '僎乕儉梡
                If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then Call mnu暵偠傞_Click(Nothing, Nothing)
            Case gmDlg僗僀僗僀僇乕僪宆傪愝掕 '僗僀僗僀梡
                gggbol = 僀儀儞僩gAppEventMaker.僗僀僗僀偲儐儔儐儔奐巒偲掆巭_嫟捠張棟("gmDlg僗僀僗僀僇乕僪宆傪愝掕", mn8僗僀僗僀偲儐儔儐儔傪幚峴, mn8僗僀僗僀偲儐儔儐儔偡傋偰掆巭, _
                                           mn8僗僀僗僀幚峴, mn8僗僀僗僀掆巭, mn8儐儔儐儔幚峴, mn8儐儔儐儔掆巭, _
                                           mn8僗僀僗僀偲儐儔儐儔傪昞帵, mn8僗僀僗僀夋憸傪愝掕)
            Case gmDlg偐側僇僫僇乕僪宆傪愝掕
                If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then Call mnu暵偠傞_Click(Nothing, Nothing)
            Case gmDlg僇乕僪僔儑乕僇乕僪宆傪愝掕
                If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then Call mnu暵偠傞_Click(Nothing, Nothing)
        End Select

    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
            Select Case mMe_gmDlgID
                Case gmDlg僗僀僗僀僇乕僪宆傪愝掕
                    Call 僀儀儞僩gAppEventMaker_僗僀僗僀偲儐儔儐儔奐巒偲掆巭()
            End Select
        End If
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨() Handles 僀儀儞僩gAppEventMaker.儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨
        gggbol = m岥岥岥.aaCardDrawAll(False)
    End Sub

#End Region

#Region "僀儀儞僩 from m岥岥岥"
    '**************************************************************************************************************************************
    Private Sub m岥岥岥_僇乕僪僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByVal r僇乕僪宆IDX As Integer, ByVal r僙儖暆 As Integer, ByVal r僙儖崅 As Integer, ByRef w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer, ByRef w僇乕僪傪巊梡偟偰偄傞 As Boolean) Handles m岥岥岥.僇乕僪僨乕僞乕傪偔偩偝偄
        RaiseEvent 僇乕僪僨乕僞乕傪偔偩偝偄(wIsOK, r僇乕僪宆IDX, r僙儖暆, r僙儖崅, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, w僇乕僪傪巊梡偟偰偄傞)
    End Sub
    Private Sub m岥岥岥_慖戰僀儞僨僢僋僗偑曄傢傝傑偟偨(ByVal rIndex As Integer) Handles m岥岥岥.慖戰僀儞僨僢僋僗偑曄傢傝傑偟偨
        gggbol = zzEnabledSet()
    End Sub
    '**************************************************************************************************************************************
    Private Sub m岥岥岥_僇儔乕偑曄峏偝傟傑偟偨(ByVal rIndex As Integer, ByVal rColor As Integer) Handles m岥岥岥.僇儔乕偑曄峏偝傟傑偟偨
        'call from m岥岥岥.怓愝掕Dlg
        RaiseEvent 僇儔乕偑曄峏偝傟傑偟偨(rIndex, rColor)
    End Sub
    Private Sub m岥岥岥_僇儔乕傪偡傋偰尦偵栠偟側偝偄(ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer) Handles m岥岥岥.僇儔乕傪偡傋偰尦偵栠偟側偝偄
        RaiseEvent 僇儔乕傪偡傋偰尦偵栠偟側偝偄(rColor1stt, rColor2stt, rColor3stt, w儕僗僩攚宨怓, w慖戰怓, w恾宍奜墢榞怓)
    End Sub
    Private Sub m岥岥岥_僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄(ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer) Handles m岥岥岥.僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄
        RaiseEvent 僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄(w儕僗僩攚宨怓, w慖戰怓, w恾宍奜墢榞怓)
    End Sub
    Private Sub m岥岥岥_儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄(ByRef w尦偵栠偡 As Boolean, ByRef w婯掕抣偵儕僙僢僩 As Boolean, ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt As Integer) Handles m岥岥岥.儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄
        RaiseEvent 儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄(w尦偵栠偡, w婯掕抣偵儕僙僢僩, rColor1stt, rColor2stt, rColor3stt)
    End Sub
    '**************************************************************************************************************************************
#End Region

End Class

