Option Strict Off
Option Explicit On
Imports System.Drawing.Drawing2D
'------------------------------------ 2023/11/09 ------------------------------------
Public Class ClsPitapeta

#Region "愰尵"
    '********************************************************************************
    Private oo僺僞儁僞僇乕僪 As New ClsPitapetaCard
    '********************************************************************************
    Public WithEvents DlgFile僎乕儉梡 As 巐frmDlgPctFilesList
    Public WithEvents 昗弨僆僾僔儑儞愝掕Dlg As 巐frmDlgOptionSTD
    Public WithEvents 昗弨僒僂儞僪愝掕Dlg As 巐frmDlgSound
    Public WithEvents 僎乕儉僇乕僪僒僀僘Dlg As frmDlgGameCardSize
    '********************************************************************************
    Private mImg尰嵼偺僎乕儉梡 As Image = Nothing : Private mImg尰嵼偺僎乕儉梡Gray As Image = Nothing : Private mImg尰嵼僒僀僘Gray As Image = Nothing
    '********************************************************************************
    Private WithEvents 僀儀儞僩gAppEventMaker As 屲clsEventMaker
    '********************************************************************************
    Private Const c挿曽宍 As Integer = 0 : Private Const c惓曽宍 As Integer = 1 : Private Const c懭墌宍 As Integer = 2 : Private Const c墌宍 As Integer = 3 : Private Const c榋妏宍 As Integer = 4 : Private Const c傂偟宍 As Integer = 5
    Private Const c嶰妏宍 As Integer = 6 : Private Const c廫帤宍 As Integer = 7 : Private Const c偩傞傑宍 As Integer = 8 : Private Const c僟僀儎宍 As Integer = 9 : Private Const c惎宍 As Integer = 10 : Private Const c傾儗僀宍 As Integer = 11
    Private Const c僴乕僩宍 As Integer = 12 : Private Const c巐偮梩宍 As Integer = 13 : Private Const c偍傢傫宍 As Integer = 14 : Private Const c傾僩儉宍 As Integer = 15 : Private Const c偝偐側宍 As Integer = 16 : Private Const c挶宍 As Integer = 17
    Private Const c僔儍僩儖宍 As Integer = 18 : Private Const cUFO_宍 As Integer = 19
    Private Const cUser0宍 As Integer = 20 : Private Const cUser1宍 As Integer = 21 : Private Const cUser2宍 As Integer = 22 : Private Const cUser3宍 As Integer = 23 : Private Const cUser4宍 As Integer = 24
    Private Const cUser5宍 As Integer = 25 : Private Const cUser6宍 As Integer = 26 : Private Const cUser7宍 As Integer = 27 : Private Const cUser8宍 As Integer = 28 : Private Const cUser9宍 As Integer = 29
    '--------------------------------------------------------------------------------
    Public Const c僇乕僪宆ALLmin As Integer = c挿曽宍  '0
    Public Const c僇乕僪宆APPmax As Integer = cUFO_宍  '19
    Public Const c僇乕僪宆USERmin As Integer = cUser0宍 '20
    Public Const c僇乕僪宆Allmax As Integer = cUser9宍  '29
    '********************************************************************************
    Private Const 惎 As String = "仛"
    Private m巊梡僇乕僪孮 As String, m巊梡僇乕僪孮BKUP As String
    Private Const cUserCard僗働乕儖婎悢WD As Integer = 1000 : Private Const cUserCard僗働乕儖婎悢HT As Integer = 1000
    '********************************************************************************
    Private Structure type僇乕僪宆
        Dim 儊僯儏乕僞僀僩儖 As String '
        Dim 儊僯儏乕偵昞帵 As Boolean '
        Dim 廲墶斾棪 As Single '
        Dim 婎弨偺攞悢抣墶 As Single '
        Dim 婎弨偺攞悢抣廲 As Single '
        Dim 億儕僑儞梫慺悢 As Integer '
        Dim 億儕僑儞() As POINTAPI '
    End Structure
    Private m儐乕僓乕嶌惉僨乕僞乕 As type僇乕僪宆
    Private m僇乕僪宆僨乕僞乕婎杮愝掕(c僇乕僪宆Allmax) As type僇乕僪宆 '慡偰偺僇乕僪宆僨乕僞乕  0丂偐傜巒傑傝丄c僇乕僪宆Allmax 偵側傞丅
    Private m僇乕僪宆僨乕僞乕儐乕僓乕(c僇乕僪宆Allmax) As type僇乕僪宆 '儐乕僓乕僇乕僪偺昗弨偺僨乕僞乕  0丂偐傜巒傑傞偑丄桳岠側偺偼丂cUser0宍丂乣丂c僇乕僪宆Allmax丅
    '********************************************************************************
    Private Structure type僇乕僪乕僨乕僞乕
        Dim DoDraw As Boolean           'True = 師夞偵昤夋偡傞僼儔僢僌
        Dim 摉傝嶍彍偢傒 As Boolean      '摉傝嶍彍偢傒偵側偭偰偄傟偽   True
        Dim 幚悺椞堟 As RECT             '僇乕僪偺僂傿儞僪僂撪偺幚嵺偺幚悺椞堟
        Dim 廳側傝挷嵏梡椞堟 As RECT     '廳側傝挷嵏梡偺撪懁偵弅傫偩椞堟
        Dim 嵞攝抲梡僙儞僞乕x As Single  '僂僀儞僪僂偺儕僒僀僘側偳偱嵞攝抲偡傞応崌偵丄寁嶼偡傞偨傔偺奺僇乕僪偺僙儞僞乕X
        Dim 嵞攝抲梡僙儞僞乕y As Single  '僂僀儞僪僂偺儕僒僀僘側偳偱嵞攝抲偡傞応崌偵丄寁嶼偡傞偨傔偺奺僇乕僪偺僙儞僞乕Y
        Dim 夋慺僇乕僪ID As Integer      '偙偺僇乕僪偺夋慺偺杮棃偺埵抲偺僇乕僪僀儞僨僢僋僗
        Dim 儕乕僕儑儞 As Integer        '昤夋偲儅僂僗僀儀儞僩偺偨傔偺椞堟
        Dim 儕乕僕儑儞榞 As Integer      '榞昤夋偺偨傔偺椞堟
        Dim 幚悺WD As Integer           '幚悺椞堟.Width
        Dim 幚悺HT As Integer           '幚悺椞堟.Height
        Dim 僇乕僪宆 As Integer
        Dim 僇乕僪榞暆 As Integer
        Dim 戝拞彫 As Single 'Size Hilitu
    End Structure
    Private m僇乕僪攝楍(app嵟戝僇乕僪枃悢 * 2) As type僇乕僪乕僨乕僞乕 '慡偰偺僇乕僪乕僨乕僞乕  1丂偐傜巒傑傝丄gc嵟戝僇乕僪枃悢 偵側傞丅
    Private m昤夋専嵏攝楍(app嵟戝僇乕僪枃悢) As Integer '昤夋偲儅僂僗擖椡偺専嵏梡偺慡偰偺僇乕僪乕僨乕僞乕攝楍丂丂儅僂僗偺僋儕僢僋偵傛傝弴彉偑擖傟懼傢傞丅
    '********************************************************************************
    Private DoeventCall As Boolean = False
    '********************************************************************************
    Public Function ppc僇乕僪宆ALLmin() As Integer
        Return c僇乕僪宆ALLmin 'c挿曽宍 '0
    End Function
    Public Function ppc僇乕僪宆APPmax() As Integer
        Return c僇乕僪宆APPmax 'cUFO_宍 '19
    End Function
    Public Function ppc僇乕僪宆USERmin() As Integer
        Return c僇乕僪宆USERmin 'cUser0宍 '20
    End Function
    Public Function ppc僇乕僪宆Allmax() As Integer
        Return c僇乕僪宆Allmax 'cUser9宍 '29
    End Function
#End Region

#Region "奜晹偲偺娭學"

    Protected Overrides Sub Finalize()
        If mImg尰嵼偺僎乕儉梡 IsNot Nothing Then mImg尰嵼偺僎乕儉梡.Dispose()
        If mImg尰嵼偺僎乕儉梡Gray IsNot Nothing Then mImg尰嵼偺僎乕儉梡Gray.Dispose()
        If mImg尰嵼僒僀僘Gray IsNot Nothing Then mImg尰嵼僒僀僘Gray.Dispose()
        MyBase.Finalize()
    End Sub

#Region "aa奜晹偲偺僀儞僞僼僃僀僗"

    Friend Function aa弶婜愝掕僆僽僕僃愝掕() As Boolean
        '----------------------------------------
        '2023/08/05 new
        mImg尰嵼偺僎乕儉梡 = New Bitmap(2000, 1200)
        mImg尰嵼偺僎乕儉梡Gray = New Bitmap(2000, 1200)
        mImg尰嵼僒僀僘Gray = New Bitmap(2000, 1200)
        frmMain.pctBmp.Image = New Bitmap(2000, 1200)
        frmMain.pct儊僀儞.Image = New Bitmap(2000, 1200)
        '----------------------------------------
        frmMain.pctCard.Image = New Bitmap(1000, 500)
        frmMain.pctCardHit.Image = New Bitmap(1000, 500)
        '----------------------------------------
        僀儀儞僩gAppEventMaker = gAppEventMaker
        '----------------------------------------
        DlgFile僎乕儉梡 = New 巐frmDlgPctFilesList
        gggbol = DlgFile僎乕儉梡.aa弶婜愝掕僆僽僕僃愝掕("僎乕儉梡僼傽僀儖傪愝掕", gmDlgFile僎乕儉梡, &HAAFFFF&, False)
        '----------------------------------------
        gggbol = frmMain.僎乕儉僨乕僞乕昞帵(3, 0, 0)
        '----------------------------------------
        Return True
    End Function

    Friend Function aaDlgFile僎乕儉梡_aa僂僀儞僪僂弶婜壔嶌惉_After_Ini_Read() As String
        If DlgFile僎乕儉梡 Is Nothing Then Return ""
        gggstr = DlgFile僎乕儉梡.aa僂僀儞僪僂弶婜壔嶌惉()
        Dim 僼傽僀儖 As String = DlgFile僎乕儉梡.p夋憸僼傽僀儖尰嵼巊梡()
        Return zz僎乕儉昤夋梡僼傽僀儖怴婯愝掕(frmMain, 僼傽僀儖)
    End Function

    Friend Function aaDlgFile僎乕儉梡_aa僂僀儞僪僂_Close() As Boolean
        If DlgFile僎乕儉梡 Is Nothing Then Return False
        DlgFile僎乕儉梡.Close()
        Return True
    End Function

    Friend Function aafrmMain_Paint() As Boolean
        If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then
            Return False
        Else
            If frmMain.pct儊僀儞.Image Is Nothing Then Return False
            Return zz僇乕僪昤夋(0, 0, 0)
        End If
    End Function

    Private Function zz僎乕儉昤夋梡僼傽僀儖怴婯愝掕(ByRef fom As frmMain, ByVal 僼傽僀儖 As String) As String
        '---------------------------------------------
        Dim wPctCurBmp廲墶斾棪 As Single : Dim w巊梡拞儕僗僩IDX As Integer
        Dim imf As Image = Nothing
        Dim OpenOKfile As String = DlgFile僎乕儉梡.aa夋憸僼傽僀儖僆乕僾儞_into_ImageBox_IfError_SetNextFile_帺摦揑偵(僼傽僀儖, imf, wPctCurBmp廲墶斾棪, w巊梡拞儕僗僩IDX)
        '---------------------------------------------
        'qqqqq("aa夋憸僼傽僀儖僆乕僾儞....SetNextFile_帺摦揑偵()")
        '---------------------------------------------
        gggbol = 嘳Image_Copy_or_Clone(mImg尰嵼偺僎乕儉梡, imf)
        gggbol = 嘳Image_Copy_or_Clone(mImg尰嵼偺僎乕儉梡Gray, imf)
        imf.Dispose()
        '僌儗乕偵偡傞
        gggbol = zz昤夋梡僌儗乕_pctCurFileGray_Make(mImg尰嵼偺僎乕儉梡, mImg尰嵼偺僎乕儉梡Gray)
        '---------------------------------------------
        p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 = 0
        Return DlgFile僎乕儉梡.aa夋憸僼傽僀儖怴婯愝掕屻偺儕僗僩慖戰昞帵張棟(OpenOKfile)
    End Function

    Private Function zz昤夋梡僌儗乕_pctCurFileGray_Make(ByRef Img尦夋 As Image, ByRef Img僌儗僀 As Image) As Boolean
        If Img尦夋 Is Nothing Then Return False
        If Img僌儗僀 IsNot Nothing Then
            Img僌儗僀.Dispose()
        End If
        Img僌儗僀 = Img尦夋.Clone
        Return 嘳BmpPctBox柧傞偔埫偔偡傞_BitsByteAry(Img僌儗僀, p僎乕儉梡僼傽僀儖偺柧傞偝幚岠抣(p僎乕儉梡僼傽僀儖偺柧傞偝))
    End Function

    Friend Function aa昤夋梡_pctBoxs_僙僢僩Image(ByRef f As frmMain, ByVal rNew僼傽僀儖 As String, ByVal pct僌儗僀巊梡 As Boolean) As Boolean
        Static Old巊梡夋憸柤 As String = "" : Static OldWD As Integer : Static OldHT As Integer
        '2022/05/01
        '僂僀儞僪僂僒僀僘偑侾僺僋僙儖偱傕偢傟傞偲丄昤夋僄儔乕偵側傞
        '偐偡偐側攚宨偺偢傟偼丄偙偙偺丂嘳僒僀僘寁嶼_庴偗偵崌傢偣偰_憲傝傪僩儕儈儞僌丂屇傃弌偟偱偱敪惗偡傞
        If DoeventCall Then Return False
        With f
            If mImg尰嵼偺僎乕儉梡 Is Nothing Then Return False
            With frmMain.pctCardHit
                If .Visible Then .Visible = False
            End With
            Dim YY As Integer = .mMenuHight
            Dim WD As Integer = Math.Max(100, .ClientSize.Width)
            Dim HT As Integer = Math.Max(100, .ClientSize.Height - .mMenuHight)
            Dim 僼傽僀儖 As String = IIf(rNew僼傽僀儖 = "", DlgFile僎乕儉梡.p夋憸僼傽僀儖尰嵼巊梡, rNew僼傽僀儖)
            If (Old巊梡夋憸柤 <> 僼傽僀儖) Or OldWD <> WD Or OldHT <> HT Then
                '.pct儊僀儞.Visible = False
                .pct儊僀儞.SetBounds(0, YY, WD, HT)
                .pctBmp.SetBounds(0, YY, WD, HT)
                If Not 嘳Image_怴婯嶌惉_嵞嶌惉(.pct儊僀儞.Image, WD, HT) Then Return False
                If Not 嘳Image_怴婯嶌惉_嵞嶌惉(.pctBmp.Image, WD, HT) Then Return False
                If Not 嘳Image_怴婯嶌惉_嵞嶌惉(mImg尰嵼僒僀僘Gray, WD, HT) Then Return False
                '---------------------------------------
                Dim wLeft, wTop, wWidth, wHeight As Integer
                Dim 憲傝暆 As Integer = mImg尰嵼偺僎乕儉梡.Width
                Dim 憲傝崅 As Integer = mImg尰嵼偺僎乕儉梡.Height
                gggbol = 嘳僒僀僘寁嶼_庴偗偵崌傢偣偰_憲傝傪僩儕儈儞僌(WD, HT, 憲傝暆, 憲傝崅, wLeft, wTop, wWidth, wHeight)
                If pct僌儗僀巊梡 Then
                    gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(.pct儊僀儞.Image, mImg尰嵼偺僎乕儉梡Gray, wLeft, wTop, wWidth, wHeight)
                Else
                    gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(.pct儊僀儞.Image, mImg尰嵼偺僎乕儉梡, wLeft, wTop, wWidth, wHeight)
                End If
                gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(.pctBmp.Image, mImg尰嵼偺僎乕儉梡, wLeft, wTop, wWidth, wHeight)
                gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(mImg尰嵼僒僀僘Gray, mImg尰嵼偺僎乕儉梡Gray, wLeft, wTop, wWidth, wHeight)
                OldWD = WD : OldHT = HT
                If 僼傽僀儖 <> "" Then Old巊梡夋憸柤 = 僼傽僀儖
                'qqqqq("aa昤夋梡_pctBoxs_僙僢僩Image()  " + 僼傽僀儖)
                DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
            End If
        End With
        Return True
    End Function

    Friend Function aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(ByRef f As frmMain, ByVal rNew僼傽僀儖 As String, ByVal pct僌儗僀巊梡 As Boolean) As Boolean
        Static OldWD As Integer : Static OldHT As Integer
        If DoeventCall Then Return False
        With f
            If mImg尰嵼偺僎乕儉梡 Is Nothing Then Return False
            With frmMain.pctCardHit
                If .Visible Then .Visible = False
            End With
            Dim WD As Integer = Math.Max(100, .ClientSize.Width)
            Dim HT As Integer = Math.Max(100, .ClientSize.Height - .mMenuHight)
            If OldWD = WD And OldHT = HT Then
                Dim img As Image : Dim 憲傝暆, 憲傝崅 As Integer : Dim wLeft, wTop, wWidth, wHeight As Integer
                If pct僌儗僀巊梡 Then img = mImg尰嵼僒僀僘Gray Else img = .pctBmp.Image
                憲傝暆 = img.Width
                憲傝崅 = img.Height
                gggbol = 嘳僒僀僘寁嶼_庴偗偵崌傢偣偰_憲傝傪僩儕儈儞僌(WD, HT, 憲傝暆, 憲傝崅, wLeft, wTop, wWidth, wHeight)
                gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(.pct儊僀儞.Image, img, wLeft, wTop, wWidth, wHeight)
                'qqqqq("aa昤夋梡_pctBoxs_僙僢僩Image_pct儊僀儞偩偗()  ")
                'DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
            Else
                OldWD = WD : OldHT = HT
                Return aa昤夋梡_pctBoxs_僙僢僩Image(f, rNew僼傽僀儖, pct僌儗僀巊梡)
            End If
            OldWD = WD : OldHT = HT
        End With
        Return True
    End Function

    Friend Function aa攚宨偺柧傞偝傪曄峏偡傞(ByRef lst攚宨偺柧傞偝 As ListBox) As Boolean
        Call p僎乕儉梡僼傽僀儖偺柧傞偝ListBox偐傜撉弌偟(lst攚宨偺柧傞偝)
        If zz昤夋梡僌儗乕_pctCurFileGray_Make(mImg尰嵼偺僎乕儉梡, mImg尰嵼偺僎乕儉梡Gray) Then
            Return aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, "", True)
        End If
        Return False
    End Function

    Friend Function aa僼傽僀儖夋憸僎乕儉梡DlgShow(ByVal rOwner As Form) As Boolean
        Return DlgFile僎乕儉梡.aa僼傽僀儖夋憸DlgShow(rOwner)
    End Function

    Friend Function aa僾儘僷僥傿弶婜壔_INI撉弌偟彂崬傒sub(ByRef 僾儘僷僐儅儞僪 As Integer, ByRef ini攝楍() As String, ByRef CurIDX As Integer) As Boolean
        Dim AryMax As Integer = UBound(ini攝楍)
        Dim ssss As String
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔
                Call p儐乕僓乕僇乕僪偺僨乕僞乕_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(僾儘僷僐儅儞僪)
                Call p尰嵼偺僇乕僪枃悢_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉攝怓奜榞_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉攝怓奜榞僪儔僢僌_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉攝怓敳偗攚宨_RW(僾儘僷僐儅儞僪)
                Call p僇乕僪堦抳偱斀揮偡傞_RW(僾儘僷僐儅儞僪)
                Call p僇乕僪堏摦偺婳愓傪巆偡_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉梡僼傽僀儖偺柧傞偝_RW(僾儘僷僐儅儞僪)
                Call p僇乕僪僒僀僘榞偺懢偝_RW(僾儘僷僐儅儞僪)
                Call p僇乕僪僗僺乕僪_RW(僾儘僷僐儅儞僪)
                Call p僒僂儞僪僼傽僀儖偺攝楍_RW(僾儘僷僐儅儞僪, gggstrary, "")
                Call p僒僂儞僪僼傽僀儖_RW(僾儘僷僐儅儞僪)
                Call p僒僂儞僪傪柭傜偡_RW(僾儘僷僐儅儞僪)
                Call p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(僾儘僷僐儅儞僪)
                '-----------------------------------------------------------------
                '埲壓偼丂僺僞儁僞丂僆儕僕僫儖
                Call p僇乕僪偺廳側傝傪尭傜偡_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪宆_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪偺僒僀僘_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(僾儘僷僐儅儞僪)
                Call p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(僾儘僷僐儅儞僪)
                Call p僗僀僗僀僇乕僪宆_RW(僾儘僷僐儅儞僪)

            Case gco僾儘僷iniRD
                Const ads As String = "="
                Dim Hedp儐乕僓乕僇乕僪偺僨乕僞乕_RW As String = p儐乕僓乕僇乕僪偺僨乕僞乕_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW As String = p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷柤) + ads
                Dim Hedp尰嵼偺僇乕僪枃悢_RW As String = p尰嵼偺僇乕僪枃悢_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉攝怓奜榞_RW As String = p僎乕儉攝怓奜榞_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉攝怓奜榞僪儔僢僌_RW As String = p僎乕儉攝怓奜榞僪儔僢僌_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉攝怓敳偗攚宨_RW As String = p僎乕儉攝怓敳偗攚宨_RW(gco僾儘僷柤) + ads
                Dim Hedp僇乕僪堦抳偱斀揮偡傞_RW As String = p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷柤) + ads
                Dim Hedp僇乕僪堏摦偺婳愓傪巆偡_RW As String = p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉梡僼傽僀儖偺柧傞偝_RW As String = p僎乕儉梡僼傽僀儖偺柧傞偝_RW(gco僾儘僷柤) + ads
                Dim Hedp僇乕僪僒僀僘榞偺懢偝_RW As String = p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷柤) + ads
                Dim Hedp僇乕僪僗僺乕僪_RW As String = p僇乕僪僗僺乕僪_RW(gco僾儘僷柤) + ads
                Dim Hedp僒僂儞僪僼傽僀儖偺攝楍_RW As String = p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷柤, gggstrary, "") + ads
                Dim Hedp僒僂儞僪僼傽僀儖_RW As String = p僒僂儞僪僼傽僀儖_RW(gco僾儘僷柤) + ads
                Dim Hedp僒僂儞僪傪柭傜偡_RW As String = p僒僂儞僪傪柭傜偡_RW(gco僾儘僷柤) + ads
                Dim Hedp僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW As String = p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(gco僾儘僷柤) + ads
                '-----------------------------------------------------------------
                '埲壓偼丂僺僞儁僞丂僆儕僕僫儖
                Dim Hedp僇乕僪偺廳側傝傪尭傜偡_RW As String = p僇乕僪偺廳側傝傪尭傜偡_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉僇乕僪偺僒僀僘戝拞彫_RW As String = p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉僇乕僪宆_RW As String = p僎乕儉僇乕僪宆_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉僇乕僪偺僒僀僘_RW As String = p僎乕儉僇乕僪偺僒僀僘_RW(gco僾儘僷柤) + ads
                Dim Hedp僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW As String = p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(gco僾儘僷柤) + ads
                Dim Hedp巆傝枃悢偱僇乕僪僒僀僘曄峏_RW As String = p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷柤) + ads
                Dim Hedp僗僀僗僀僇乕僪宆_RW As String = p僗僀僗僀僇乕僪宆_RW(gco僾儘僷柤) + ads

                For CurIDX = 1 To UBound(ini攝楍)
                    ssss = ini攝楍(CurIDX)
                    If InStr(ssss, Hedp儐乕僓乕僇乕僪偺僨乕僞乕_RW) = 1 Then
                        Call p儐乕僓乕僇乕僪偺僨乕僞乕_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW) = 1 Then
                        Call p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp尰嵼偺僇乕僪枃悢_RW) = 1 Then
                        Call p尰嵼偺僇乕僪枃悢_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉攝怓奜榞_RW) = 1 Then
                        Call p僎乕儉攝怓奜榞_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉攝怓奜榞僪儔僢僌_RW) = 1 Then
                        Call p僎乕儉攝怓奜榞僪儔僢僌_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉攝怓敳偗攚宨_RW) = 1 Then
                        Call p僎乕儉攝怓敳偗攚宨_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僇乕僪堦抳偱斀揮偡傞_RW) = 1 Then
                        Call p僇乕僪堦抳偱斀揮偡傞_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僇乕僪堏摦偺婳愓傪巆偡_RW) = 1 Then
                        Call p僇乕僪堏摦偺婳愓傪巆偡_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉梡僼傽僀儖偺柧傞偝_RW) = 1 Then
                        Call p僎乕儉梡僼傽僀儖偺柧傞偝_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僇乕僪僒僀僘榞偺懢偝_RW) = 1 Then
                        Call p僇乕僪僒僀僘榞偺懢偝_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僇乕僪僗僺乕僪_RW) = 1 Then
                        Call p僇乕僪僗僺乕僪_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僒僂儞僪僼傽僀儖偺攝楍_RW) = 1 Then
                        Call p僒僂儞僪僼傽僀儖偺攝楍_RW(僾儘僷僐儅儞僪, gggstrary, ssss)
                    ElseIf InStr(ssss, Hedp僒僂儞僪僼傽僀儖_RW) = 1 Then
                        Call p僒僂儞僪僼傽僀儖_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僒僂儞僪傪柭傜偡_RW) = 1 Then
                        Call p僒僂儞僪傪柭傜偡_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW) = 1 Then
                        Call p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(僾儘僷僐儅儞僪, ssss)
                        '-----------------------------------------------------------------
                        '埲壓偼丂僺僞儁僞丂僆儕僕僫儖
                    ElseIf InStr(ssss, Hedp僇乕僪偺廳側傝傪尭傜偡_RW) = 1 Then
                        Call p僇乕僪偺廳側傝傪尭傜偡_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉僇乕僪偺僒僀僘戝拞彫_RW) = 1 Then
                        Call p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉僇乕僪宆_RW) = 1 Then
                        Call p僎乕儉僇乕僪宆_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉僇乕僪偺僒僀僘_RW) = 1 Then
                        Call p僎乕儉僇乕僪偺僒僀僘_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW) = 1 Then
                        Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp巆傝枃悢偱僇乕僪僒僀僘曄峏_RW) = 1 Then
                        Call p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(僾儘僷僐儅儞僪, ssss)
                    ElseIf InStr(ssss, Hedp僗僀僗僀僇乕僪宆_RW) = 1 Then
                        Call p僗僀僗僀僇乕僪宆_RW(僾儘僷僐儅儞僪, ssss)
                    End If
                Next

            Case gco僾儘僷iniWR
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p儐乕僓乕僇乕僪偺僨乕僞乕_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p尰嵼偺僇乕僪枃悢_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉攝怓奜榞_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉攝怓奜榞僪儔僢僌_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉攝怓敳偗攚宨_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僇乕僪堦抳偱斀揮偡傞_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僇乕僪堏摦偺婳愓傪巆偡_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉梡僼傽僀儖偺柧傞偝_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僇乕僪僒僀僘榞偺懢偝_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僇乕僪僗僺乕僪_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僒僂儞僪僼傽僀儖偺攝楍_RW(僾儘僷僐儅儞僪, gggstrary, "") Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僒僂儞僪僼傽僀儖_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僒僂儞僪傪柭傜偡_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(僾儘僷僐儅儞僪) Else Return True
                '-----------------------------------------------------------------
                '埲壓偼丂僺僞儁僞丂僆儕僕僫儖
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僇乕僪偺廳側傝傪尭傜偡_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉僇乕僪宆_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉僇乕僪偺僒僀僘_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(僾儘僷僐儅儞僪) Else Return True
                CurIDX = CurIDX + 1 : If CurIDX <= AryMax Then ini攝楍(CurIDX) = p僗僀僗僀僇乕僪宆_RW(僾儘僷僐儅儞僪) Else Return True
        End Select
        gggbol = DlgFile僎乕儉梡.aa僾儘僷僥傿弶婜壔_INI撉弌偟彂崬傒sub(僾儘僷僐儅儞僪, ini攝楍, CurIDX)
        Return True
    End Function

#End Region

#Region "僇乕僪宆嶌惉偺僀儞僞僼僃僀僗"
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aaDlgCardRgnMakeIO(ByRef op As Integer, Optional ByRef rw巊梡僇乕僪孮 As String = "", Optional ByRef DlgList As ListBox = Nothing, Optional ByRef 僇乕僪宆 As Integer = 0, Optional ByRef 僇乕僪WDHT As Integer = 0, Optional ByRef 榞暆幚悺 As Integer = 0, Optional ByRef Rgn夋 As Integer = 0, Optional ByRef Rgn榞 As Integer = 0, Optional ByRef w僇乕僪暆 As Integer = 0, Optional ByRef w僇乕僪崅 As Integer = 0, Optional ByRef wRgn夋DefUser As Integer = 0, Optional ByRef wRgn榞DefUser As Integer = 0, Optional ByRef w僇乕僪暆DefUser As Integer = 0, Optional ByRef w僇乕僪崅DefUser As Integer = 0) As Integer
        Select Case op
            Case 2000, 2002, 2009 '***********2022/10/07 chg
                Return aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(op, rw巊梡僇乕僪孮, DlgList, 僇乕僪宆, 僇乕僪WDHT, 榞暆幚悺, Rgn夋, Rgn榞, w僇乕僪暆, w僇乕僪崅, wRgn夋DefUser, wRgn榞DefUser, w僇乕僪暆DefUser, w僇乕僪崅DefUser)
            Case 10020, 10021, 10022, 10023 '
                Return aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪(op, rw巊梡僇乕僪孮, DlgList, 僇乕僪宆, 僇乕僪WDHT, 榞暆幚悺, Rgn夋, Rgn榞, w僇乕僪暆, w僇乕僪崅, wRgn夋DefUser, wRgn榞DefUser, w僇乕僪暆DefUser, w僇乕僪崅DefUser)
            Case 30001, 30000  '2022/10/07  傕偟丄僎乕儉幚峴拞偱丄曄峏僇乕僪偑巊梡偝傟偰偄傟偽丄嵞昤夋偡傞丅
                Return aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪(op, rw巊梡僇乕僪孮, DlgList, 僇乕僪宆)
        End Select
        Return 0
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aaDlgCardRgnMakeIOEX(ByRef rOld僇乕僪宆 As Integer, ByRef r儊僯儏乕僞僀僩儖 As String, ByRef r儊僯儏乕偵昞帵 As Boolean, ByRef r廲墶斾棪 As Single, ByRef r婎弨偺攞悢抣墶 As Single, ByRef r婎弨偺攞悢抣廲 As Single, ByRef r億儕僑儞梫慺悢 As Integer, ByRef r億儕僑儞() As POINTAPI, ByRef rUserCardMakeBox僗働乕儖婎悢WD As Integer, ByRef rUserCardMakeBox僗働乕儖婎悢HT As Integer) As Boolean
        aaDlgCardRgnMakeIOEX = aa僇乕僪嶌惉僨乕僞乕愝掕(rOld僇乕僪宆, r儊僯儏乕僞僀僩儖, r儊僯儏乕偵昞帵, r廲墶斾棪, r婎弨偺攞悢抣墶, r婎弨偺攞悢抣廲, r億儕僑儞梫慺悢, r億儕僑儞, rUserCardMakeBox僗働乕儖婎悢WD, rUserCardMakeBox僗働乕儖婎悢HT)
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Function p儐乕僓乕僇乕僪偺僨乕僞乕_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p儐乕僓乕僇乕僪偺僨乕僞乕" : Const cut As String = Chr(14) + "仛仛仛仛仛仛仛仛仛" + Chr(14)
        Dim 抣 As String = ""
        Dim rw巊梡僇乕僪孮 As String = ""
        Dim b As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                gggbol = aa僇乕僪宆僨乕僞乕撉傒彂偒(1001, "", 0)

            Case gco僾儘僷iniWR
                抣 = "" : rw巊梡僇乕僪孮 = "" : b = 0
                Do
                    b = b + 1
                    gggbol = aa僇乕僪宆僨乕僞乕撉傒彂偒(1005, rw巊梡僇乕僪孮, b)
                    If rw巊梡僇乕僪孮 <> "" Then
                        抣 = 抣 + rw巊梡僇乕僪孮 + cut : rw巊梡僇乕僪孮 = ""
                    Else
                        Exit Do
                    End If
                Loop
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, 抣)

            Case gco僾儘僷iniRD
                抣 = 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)
                Dim rwAry() As String = {""}
                Dim max As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(抣, cut, rwAry)
                For b = 1 To max
                    rw巊梡僇乕僪孮 = rwAry(b)
                    gggbol = aa僇乕僪宆僨乕僞乕撉傒彂偒(1004, rw巊梡僇乕僪孮, b)
                Next

        End Select
        Return 抣
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僇乕僪宆僨乕僞乕撉傒彂偒(ByRef rOp As Integer, ByRef rw巊梡僇乕僪孮 As String, ByRef r僔儑乕僇乕僪宆 As Integer) As Boolean
        Dim TTT() As String = {""} : Dim ppp() As String = {""} : Dim a As Integer
        Dim o僇乕僪宆僨乕僞乕暥帤楍() As String = {""}
        Dim o僇乕僪宆僨乕僞乕暥帤楍_index, o僇乕僪宆ID As Integer
        Select Case rOp
            Case 1001 '
                For a = 0 To c僇乕僪宆Allmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        .儊僯儏乕僞僀僩儖 = "" : .儊僯儏乕偵昞帵 = True : .廲墶斾棪 = 1 : .婎弨偺攞悢抣墶 = 1 : .婎弨偺攞悢抣廲 = 1 : .億儕僑儞梫慺悢 = 0 : ReDim .億儕僑儞(0)
                    End With
                Next
                '-------------------------------------------------------------
                '僇乕僪儕乕僕儑儞偺丂婎杮僨乕僞乕傪嶌傞偨傔丂暥帤楍偺攝楍傪嶌傞丅
                If Not oo僺僞儁僞僇乕僪.aa僇乕僪宆偺婯掕僨乕僞乕暥帤楍愝掕(o僇乕僪宆僨乕僞乕暥帤楍, c僇乕僪宆Allmax) Then Call zzErrorAppEnd() '傕偟僄儔乕偵側傟偽丄傾僾儕傪嫮惂廔椆偡傞丅
                '暥帤楍偺攝楍偐傜丂僇乕僪僨乕僞乕傪丂m僇乕僪宆僨乕僞乕婎杮愝掕()丂偵擖傟傞丅
                For a = 0 To c僇乕僪宆Allmax
                    o僇乕僪宆僨乕僞乕暥帤楍_index = a : o僇乕僪宆ID = a
                    gggbol = aa僇乕僪宆僨乕僞乕撉傒彂偒_SUB_SetData僇乕僪宆(o僇乕僪宆ID, o僇乕僪宆僨乕僞乕暥帤楍, o僇乕僪宆僨乕僞乕暥帤楍_index, TTT, ppp)      'GoSub SetData僇乕僪宆
                Next
                '-------------------------------------------------------------
                '儐乕僓乕僇乕僪偺昗弨偺僨乕僞乕傪僶僢僋傾僢僾偟偰偍偔
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax 'cUser0宍 = 20 ... cUser9宍 = 29, c僇乕僪宆Allmax = cUser9宍
                    Call zz僇乕僪宆僞僀僾僐僺乕(m僇乕僪宆僨乕僞乕儐乕僓乕(a), m僇乕僪宆僨乕僞乕婎杮愝掕(a))
                Next
                '-------------------------------------------------------------
            Case 1004 'Open from INI
                o僇乕僪宆ID = c僇乕僪宆APPmax + r僔儑乕僇乕僪宆
                If o僇乕僪宆ID > c僇乕僪宆Allmax Then Exit Function
                ReDim o僇乕僪宆僨乕僞乕暥帤楍(1)
                o僇乕僪宆僨乕僞乕暥帤楍(1) = rw巊梡僇乕僪孮
                o僇乕僪宆僨乕僞乕暥帤楍_index = 1
                gggbol = aa僇乕僪宆僨乕僞乕撉傒彂偒_SUB_SetData僇乕僪宆(o僇乕僪宆ID, o僇乕僪宆僨乕僞乕暥帤楍, o僇乕僪宆僨乕僞乕暥帤楍_index, TTT, ppp)      'GoSub SetData僇乕僪宆
                '-------------------------------------------------------------
            Case 1005 'Save into INI
                rw巊梡僇乕僪孮 = ""
                o僇乕僪宆ID = c僇乕僪宆APPmax + r僔儑乕僇乕僪宆
                If o僇乕僪宆ID > c僇乕僪宆Allmax Then Return False
                With m僇乕僪宆僨乕僞乕婎杮愝掕(o僇乕僪宆ID)
                    rw巊梡僇乕僪孮 = .儊僯儏乕僞僀僩儖 & "<>" + IIf(.儊僯儏乕偵昞帵, "1", "0") + "<>" + CStr(.廲墶斾棪) + "<>" + CStr(.婎弨偺攞悢抣墶) + "<>" + CStr(.婎弨偺攞悢抣廲) + "<>" + CStr(.億儕僑儞梫慺悢) + "<>"
                    For a = 0 To .億儕僑儞梫慺悢 - 1
                        rw巊梡僇乕僪孮 = rw巊梡僇乕僪孮 & CStr(.億儕僑儞(a).X) & "," & CStr(.億儕僑儞(a).Y) & ","
                    Next
                    rw巊梡僇乕僪孮 = rw巊梡僇乕僪孮 & "<>"
                End With
        End Select
        Return True
        '*******************************************************************
    End Function
    Friend Function aa僇乕僪宆僨乕僞乕撉傒彂偒_SUB_SetData僇乕僪宆(ByVal o僇乕僪宆ID As Integer, ByRef o僇乕僪宆僨乕僞乕暥帤楍() As String, ByRef o僇乕僪宆僨乕僞乕暥帤楍_index As Integer, ByRef TTT() As String, ByRef ppp() As String) As Boolean
        Dim b As Integer : Dim c As Integer : Dim d As Integer
        With m僇乕僪宆僨乕僞乕婎杮愝掕(o僇乕僪宆ID)
            If 7 = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(o僇乕僪宆僨乕僞乕暥帤楍(o僇乕僪宆僨乕僞乕暥帤楍_index), "<>", TTT) Then
                .儊僯儏乕僞僀僩儖 = TTT(1)
                .儊僯儏乕偵昞帵 = (TTT(2) = "1")
                .廲墶斾棪 = Val(TTT(3))
                .婎弨偺攞悢抣墶 = Val(TTT(4))
                .婎弨偺攞悢抣廲 = Val(TTT(5))
                .億儕僑儞梫慺悢 = Val(TTT(6))
                ReDim .億儕僑儞(0)
                If .億儕僑儞梫慺悢 > 0 Then
                    c = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(TTT(7), ",", ppp)
                    If c > 5 Then
                        ReDim .億儕僑儞(c \ 2) : d = -1
                        For b = 1 To c Step 2
                            d = d + 1 : .億儕僑儞(d).X = Val(ppp(b)) : .億儕僑儞(d).Y = Val(ppp(b + 1))
                        Next
                        ReDim Preserve .億儕僑儞(d)
                    End If
                End If
                'Call zzMenuCaptionSetAdd僾儔僗儅乕僋(o僇乕僪宆ID)
            End If
        End With
        Return True
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪(ByRef op As Integer, Optional ByRef rw巊梡僇乕僪孮 As String = "", Optional ByRef DlgList As ListBox = Nothing, Optional ByRef 僔儑乕僇乕僪宆 As Integer = 0, Optional ByRef 僔儑乕僇乕僪WDHT As Integer = 0, Optional ByRef 僔儑乕榞暆幚悺 As Integer = 0, Optional ByRef 僔儑乕Rgn夋 As Integer = 0, Optional ByRef 僔儑乕Rgn榞 As Integer = 0, Optional ByRef w僔儑乕僇乕僪暆 As Integer = 0, Optional ByRef w僔儑乕僇乕僪崅 As Integer = 0, Optional ByRef wRgn夋DefUser As Integer = 0, Optional ByRef wRgn榞DefUser As Integer = 0, Optional ByRef w僔儑乕僇乕僪暆DefUser As Integer = 0, Optional ByRef w僔儑乕僇乕僪崅DefUser As Integer = 0) As Integer
        '儐乕僓乕僇乕僪傪昗弨偵栠偡偨傔偺僐儅儞僪孮
        Dim n, a, o僇乕僪宆ID As Integer
        Select Case op
            Case 10020 'from  mnu仠儐乕僓乕僇乕僪傪昗弨偵栠偡_Click
                n = 0
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax 'cUser0宍 = 20 ... cUser9宍 = 29, c僇乕僪宆Allmax = cUser9宍
                    If Not zz僇乕僪宆僨乕僞乕偼摍偟偄(m僇乕僪宆僨乕僞乕儐乕僓乕(a), m僇乕僪宆僨乕僞乕婎杮愝掕(a)) Then n = n + 1
                Next
                aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪 = n
            Case 10021 'from  frmUserCardReset.DlgShow()
                With DlgList
                    .Items.Clear()
                    For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax 'cUser0宍 = 20 ... cUser9宍 = 29, c僇乕僪宆Allmax = cUser9宍
                        If Not zz僇乕僪宆僨乕僞乕偼摍偟偄(m僇乕僪宆僨乕僞乕儐乕僓乕(a), m僇乕僪宆僨乕僞乕婎杮愝掕(a)) Then
                            .Items.Add(CStr(a - c僇乕僪宆USERmin) & " : " & m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖)
                        End If
                    Next
                End With
            Case 10022 'from  frmUserCardReset.lst_Click()
                Call aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(2022, rw巊梡僇乕僪孮, DlgList, 僔儑乕僇乕僪宆, 僔儑乕僇乕僪WDHT, 僔儑乕榞暆幚悺, 僔儑乕Rgn夋, 僔儑乕Rgn榞, w僔儑乕僇乕僪暆, w僔儑乕僇乕僪崅, wRgn夋DefUser, wRgn榞DefUser, w僔儑乕僇乕僪暆DefUser, w僔儑乕僇乕僪崅DefUser)
            Case 10023 'from  frmUserCardReset.btn_Click() '慖戰偟偨儐乕僓乕僇乕僪偺宍傪昗弨偵栠偡
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax 'cUser0宍 = 20 ... cUser9宍 = 29, c僇乕僪宆Allmax = cUser9宍
                    If (a = 僔儑乕僇乕僪宆) Or (rw巊梡僇乕僪孮 <> "" And rw巊梡僇乕僪孮 = m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖) Then  '2023/01/14 chg add    old --->  If m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖 = rw巊梡僇乕僪孮 Then
                        Call zz僇乕僪宆僞僀僾僐僺乕(m僇乕僪宆僨乕僞乕婎杮愝掕(a), m僇乕僪宆僨乕僞乕儐乕僓乕(a))
                        o僇乕僪宆ID = a
                        僔儑乕僇乕僪宆 = a 'return index
                        ' ''Call zzMenuCaptionSetAdd僾儔僗儅乕僋(o僇乕僪宆ID)
                        ' ''Call aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(2009, , , a - c僇乕僪宆USERmin)
                        Exit Function
                    End If
                Next
            Case 30001, 30000  '2022/10/07  傕偟丄僎乕儉幚峴拞偱丄曄峏僇乕僪偑巊梡偝傟偰偄傟偽丄嵞昤夋偡傞丅        ' gm傾僾儕屌桳僋儔僗.aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪(op, rw巊梡僇乕僪孮, DlgList, 僇乕僪宆)
                If Not pp僎乕儉幚峴拞 Then Return -1
                Dim nnn As Integer = 僔儑乕僇乕僪宆 + IIf(op = 30001, cUser0宍, 0)  '30001 偺応崌偼丄僟僀傾儘僌撪偺儕僗僩僀儞僨僢僋僗傪巊梡偟偰偄傞丅
                If Not p僎乕儉僇乕僪宆_巊梡拞偱偡(nnn) Then Return -1
                Call aa僇乕僪偺攝抲偲嵞昤夋(3, 2)
        End Select
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(ByRef op As Integer, Optional ByRef rw巊梡僇乕僪孮 As String = "", Optional ByRef DlgList As ListBox = Nothing, Optional ByRef 僔儑乕僇乕僪宆 As Integer = -1, Optional ByRef 僔儑乕僇乕僪WDHT As Integer = 0, Optional ByRef 僔儑乕榞暆幚悺 As Integer = 0, Optional ByRef 僔儑乕Rgn夋 As Integer = 0, Optional ByRef 僔儑乕Rgn榞 As Integer = 0, Optional ByRef w僔儑乕僇乕僪暆 As Integer = 0, Optional ByRef w僔儑乕僇乕僪崅 As Integer = 0, Optional ByRef wRgn夋DefUser As Integer = 0, Optional ByRef wRgn榞DefUser As Integer = 0, Optional ByRef w僔儑乕僇乕僪暆DefUser As Integer = 0, Optional ByRef w僔儑乕僇乕僪崅DefUser As Integer = 0) As Integer
        Dim w, a, 僇乕僪宆ID As Integer
        Dim rc As RECT
        Select Case op 'aaIO_frmRgnCardSet
            Case 2000 'List Box Set
                DlgList.Items.Clear()
                For a = c僇乕僪宆APPmax + 1 To c僇乕僪宆Allmax
                    DlgList.Items.Add(m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖)
                Next
            Case 2002, 2022 'Rturn RGN                              2022 'from  frmUserCardReset.lst_Click()
                For a = c僇乕僪宆APPmax + 1 To c僇乕僪宆Allmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        If (a = 僔儑乕僇乕僪宆) Or (rw巊梡僇乕僪孮 <> "" And rw巊梡僇乕僪孮 = .儊僯儏乕僞僀僩儖) Then  '2023/01/14 chg add    old ---> If rw巊梡僇乕僪孮 = .儊僯儏乕僞僀僩儖 Then 
                            'qqqqq("*****曄峏 aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚() 2002,2022")
                            w = 僔儑乕僇乕僪WDHT \ 2
                            w僔儑乕僇乕僪暆 = (w * .婎弨偺攞悢抣墶) * 2
                            w僔儑乕僇乕僪崅 = (w * .婎弨偺攞悢抣廲) * 2
                            gggint = SetRect(rc, 0, 0, w僔儑乕僇乕僪暆, w僔儑乕僇乕僪崅)
                            Call oo僺僞儁僞僇乕僪.aa僇乕僪宆儕乕僕儑儞嶌惉(m僇乕僪宆僨乕僞乕婎杮愝掕(a).億儕僑儞, 僔儑乕Rgn夋, 僔儑乕Rgn榞, a, rc, 僔儑乕榞暆幚悺, c挿曽宍, c惓曽宍, c懭墌宍, c墌宍, c榋妏宍, c傂偟宍, c嶰妏宍, c廫帤宍, c偩傞傑宍, c僟僀儎宍, c惎宍, c傾儗僀宍, c僴乕僩宍, c巐偮梩宍, c偍傢傫宍, c傾僩儉宍, c偝偐側宍, c挶宍, c僔儍僩儖宍, cUFO_宍, cUserCard僗働乕儖婎悢WD, cUserCard僗働乕儖婎悢HT)
                            '2016/10/17 add
                            If op = 2022 Then 'from  frmUserCardReset.lst_Click()
                                With m僇乕僪宆僨乕僞乕儐乕僓乕(a)
                                    w僔儑乕僇乕僪暆DefUser = (w * .婎弨偺攞悢抣墶) * 2
                                    w僔儑乕僇乕僪崅DefUser = (w * .婎弨偺攞悢抣廲) * 2
                                    gggint = SetRect(rc, 0, 0, w僔儑乕僇乕僪暆DefUser, w僔儑乕僇乕僪崅DefUser)
                                    Call oo僺僞儁僞僇乕僪.aa僇乕僪宆儕乕僕儑儞嶌惉(m僇乕僪宆僨乕僞乕儐乕僓乕(a).億儕僑儞, wRgn夋DefUser, wRgn榞DefUser, a, rc, 僔儑乕榞暆幚悺, c挿曽宍, c惓曽宍, c懭墌宍, c墌宍, c榋妏宍, c傂偟宍, c嶰妏宍, c廫帤宍, c偩傞傑宍, c僟僀儎宍, c惎宍, c傾儗僀宍, c僴乕僩宍, c巐偮梩宍, c偍傢傫宍, c傾僩儉宍, c偝偐側宍, c挶宍, c僔儍僩儖宍, cUFO_宍, cUserCard僗働乕儖婎悢WD, cUserCard僗働乕儖婎悢HT)
                                End With
                            End If
                            ' 2022 'from  frmUserCardReset.lst_Click()  return 昗弨偺儐乕僓乕僇乕僪 儊僯儏乕僞僀僩儖 ----> 仠儐乕僓乕侽宍 .... 仠儐乕僓乕俋宍
                            If op = 2022 Then
                                rw巊梡僇乕僪孮 = m僇乕僪宆僨乕僞乕儐乕僓乕(a).儊僯儏乕僞僀僩儖
                            End If
                            Exit Function
                        End If
                    End With
                Next
            Case 2003 'Change New User Card RGN
                a = c僇乕僪宆APPmax + 1 + 僔儑乕僇乕僪宆
                If a <= c僇乕僪宆Allmax Then
                    Call zz僇乕僪宆僞僀僾僐僺乕(m僇乕僪宆僨乕僞乕婎杮愝掕(a), m儐乕僓乕嶌惉僨乕僞乕)
                    僇乕僪宆ID = a
                    'Call zzMenuCaptionSetAdd僾儔僗儅乕僋(僇乕僪宆ID) 'GoSub 儐乕僓乕僇乕僪MenuCaptionSet
                End If
        End Select
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僇乕僪宆儕乕僕儑儞傪嶌傞_UserCardMake(ByVal rRgn榞傕昁梫 As Boolean, ByRef r僇乕僪宆儐乕僓乕宆IDX As Integer, ByRef r夋暆崅暯嬒 As Integer, ByRef r榞暆幚悺 As Integer, ByRef wRgn夋 As Integer, ByRef wRgn榞 As Integer, ByRef w夋暆 As Integer, ByRef w夋崅 As Integer) As Boolean
        Dim idx As Integer = c僇乕僪宆USERmin + r僇乕僪宆儐乕僓乕宆IDX
        gggbol = aa僇乕僪宆儕乕僕儑儞傪嶌傞(idx, r夋暆崅暯嬒, r榞暆幚悺, wRgn夋, wRgn榞, w夋暆, w夋崅)
        If Not rRgn榞傕昁梫 Then
            If wRgn榞 <> 0 Then DeleteObject(wRgn榞)
            wRgn榞 = 0
        End If
        Return True
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僇乕僪宆儕乕僕儑儞傪嶌傞(ByRef r僇乕僪宆IDX As Integer, ByRef r夋暆崅暯嬒 As Integer, ByRef r榞暆幚悺 As Integer, ByRef wRgn夋 As Integer, ByRef wRgn榞 As Integer, ByRef w夋暆 As Integer, ByRef w夋崅 As Integer) As Boolean
        Dim w As Integer : Dim rc As RECT
        If r僇乕僪宆IDX < 0 Then r僇乕僪宆IDX = 0
        w = r夋暆崅暯嬒 \ 2
        w夋暆 = (w * m僇乕僪宆僨乕僞乕婎杮愝掕(r僇乕僪宆IDX).婎弨偺攞悢抣墶) * 2
        w夋崅 = (w * m僇乕僪宆僨乕僞乕婎杮愝掕(r僇乕僪宆IDX).婎弨偺攞悢抣廲) * 2
        gggint = SetRect(rc, 0, 0, w夋暆, w夋崅)
        Return oo僺僞儁僞僇乕僪.aa僇乕僪宆儕乕僕儑儞嶌惉(m僇乕僪宆僨乕僞乕婎杮愝掕(r僇乕僪宆IDX).億儕僑儞, wRgn夋, wRgn榞, r僇乕僪宆IDX, rc, r榞暆幚悺, c挿曽宍, c惓曽宍, c懭墌宍, c墌宍, c榋妏宍, c傂偟宍, c嶰妏宍, c廫帤宍, c偩傞傑宍, c僟僀儎宍, c惎宍, c傾儗僀宍, c僴乕僩宍, c巐偮梩宍, c偍傢傫宍, c傾僩儉宍, c偝偐側宍, c挶宍, c僔儍僩儖宍, cUFO_宍, cUserCard僗働乕儖婎悢WD, cUserCard僗働乕儖婎悢HT)
    End Function

#End Region

    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僇乕僪偺攝抲偲嵞昤夋(ByRef rNew1_WndReSize2_PropChange3 As Integer, Optional ByRef r僇乕僪偺曄峏偩偗幚峴 As Integer = 0, Optional ByRef r僌儗乕儗儀儖偺曄峏 As Boolean = False) As Boolean
        On Error GoTo errop
        Const c墢偺嵟戝廳側傝 As Double = 0.29 '僇乕僪摨巑偺廳側傞椞堟偺斾棪丂0.15丂偱偼柍尷儖乕僾偵側傞丅
        '----------------------------------------------------------
        Dim o僇乕僪孮椞堟撪懁_WD(c僇乕僪宆Allmax) As Integer
        Dim o僇乕僪孮椞堟撪懁_HT(c僇乕僪宆Allmax) As Integer
        Dim o僇乕僪暆(c僇乕僪宆Allmax) As Integer
        Dim o僇乕僪崅(c僇乕僪宆Allmax) As Integer
        Dim o僇乕僪墢偺廳側傝暆(c僇乕僪宆Allmax) As Integer
        Dim o僇乕僪墢偺廳側傝崅(c僇乕僪宆Allmax) As Integer
        Dim o僼儗乕儉暆(c僇乕僪宆Allmax) As Integer
        '----------------------------------------------------------
        Dim o嵞攝抲梡僙儞僞乕愝掕 As Boolean
        Dim o尰嵼偺僇乕僪枃悢, omax枃悢, o嵞攝抲寁嶼夞悢巜掕抣 As Integer
        Dim o僇乕僪孮椞堟 As RECT
        Dim o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 As Single
        Dim o僇乕僪暆敿, otmp僇乕僪暆敿暘, otmp僇乕僪崅敿暘, o僇乕僪崅敿 As Integer
        Dim o巊梡僇乕僪孮chkstr As String
        Dim o墢偺嵟戝廳側傝, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢, ocur戝拞彫 As Single
        Dim RetChkAddDelXY As Boolean
        '----------------------------------------------------------
        Dim mMax僇乕僪崅 As Integer = 100, mMax僇乕僪暆 As Integer = 100
        '----------------------------------------------------------
        Dim chkcount, mm, a, n, w, h, dx, dy, x1, y1, ggg, oOvercount As Integer : Dim rc As RECT
        Dim o僎乕儉僇乕僪偺僒僀僘戝拞彫 As Boolean
        '----------------------------------------------------------
        '2022/10/04 new
        Dim oGotoRet100, oGotoRet200 As Integer : Dim www, hhh, xxx, yyy, dxx, dyy, mmm, nnn As Integer : Dim rcrc As RECT
        '----------------------------------------------------------
        '*****************************************************************************************************
        If gm傾僾儕廔椆偡傞 Then Return False
        If rNew1_WndReSize2_PropChange3 > 3 Then Return False
        If frmMain.mmLoading Then Return False
        If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then Return False
        '*****************************************************************************************************
        gm傾僾儕廔椆偡傞 = False
        '*****************************************************************************************************
        o尰嵼偺僇乕僪枃悢 = p尰嵼偺僇乕僪枃悢
        '*****************************************************************************************************
        '怴婯偵攝傞偐丄僼僅乕儉儕僒僀僘偺応崌偵偼丄丄丄
        If rNew1_WndReSize2_PropChange3 <> 3 Or r僇乕僪偺曄峏偩偗幚峴 > 0 Then
            'o僇乕僪孮椞堟傪揔惓側僒僀僘偵偡傞
            With o僇乕僪孮椞堟
                With frmMain.pct儊僀儞
                    w = .Width : h = .Height : a = Math.Min(w, h) \ 100 'change 2022/07/29
                End With
                .lll = a : .ttt = a : .rrr = w - a : .bbb = h - a
            End With
            '*****************************************************************************************************
            '僇乕僪偺僒僀僘偺幚悺傪愝掕偡傞
            o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 = p僎乕儉僇乕僪偺僒僀僘 / Math.Sqrt(o尰嵼偺僇乕僪枃悢) * Math.Log(Math.Log(o尰嵼偺僇乕僪枃悢 * 10)) / 1.8 '偙傟埲忋斾棪傪戝偒偔偡傞偲柍尷儖乕僾偵側傞 2015/05/17
            '*****************************************************************************************************
            otmp僇乕僪暆敿暘 = 0.44 * (嘳Rect暆(o僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪) : otmp僇乕僪崅敿暘 = 0.44 * (嘳Rect崅(o僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪)
            '*****************************************************************************************************
            '2017-11-5 add  僂僀儞僪僂僒僀僘偑嵍塃俀夋柺偵側傞偲丄僇乕僪僒僀僘偑戝偒偔側傝偡偓傞偺偱偦偺懳嶔偺偨傔偺捛壛僐乕僪
            otmp僇乕僪暆敿暘 = otmp僇乕僪暆敿暘 * Math.Min(1, CSng(2450) / CSng(嘳Rect暆(o僇乕僪孮椞堟))) : otmp僇乕僪崅敿暘 = otmp僇乕僪崅敿暘 * Math.Min(1, CSng(1300) / CSng(嘳Rect崅(o僇乕僪孮椞堟)))
            '*****************************************************************************************************
            '-------------------------------------------
            o墢偺嵟戝廳側傝 = c墢偺嵟戝廳側傝 + (p僎乕儉僇乕僪偺僒僀僘 - 0.7) * 0.9 ''僇乕僪偺戝偒偝偱曄峏偡傞  p僎乕儉僇乕僪偺僒僀僘 = 0.7 - 0.9
            'qqqqq CStr(p僎乕儉僇乕僪偺僒僀僘) + "  -----  " + CStr(o墢偺嵟戝廳側傝)
            '-------------------------------------------
            o僎乕儉僇乕僪偺僒僀僘戝拞彫 = p僎乕儉僇乕僪偺僒僀僘戝拞彫
            For a = 0 To c僇乕僪宆Allmax
                '-------------------------------------------
                o僇乕僪暆敿 = otmp僇乕僪暆敿暘 : o僇乕僪崅敿 = otmp僇乕僪崅敿暘
                w = (o僇乕僪暆敿 + o僇乕僪崅敿) \ 2
                h = w
                '-------------------------------------------
                o僇乕僪暆敿 = w * m僇乕僪宆僨乕僞乕婎杮愝掕(a).婎弨偺攞悢抣墶 : o僇乕僪崅敿 = h * m僇乕僪宆僨乕僞乕婎杮愝掕(a).婎弨偺攞悢抣廲
                o僇乕僪暆(a) = o僇乕僪暆敿 + o僇乕僪暆敿 : o僇乕僪崅(a) = o僇乕僪崅敿 + o僇乕僪崅敿
                o僇乕僪墢偺廳側傝暆(a) = o僇乕僪暆(a) * o墢偺嵟戝廳側傝 : o僇乕僪墢偺廳側傝崅(a) = o僇乕僪崅(a) * o墢偺嵟戝廳側傝
                '-------------------------------------------
                o僼儗乕儉暆(a) = Math.Max(2, 2.5 * System.Math.Sqrt(((o僇乕僪暆(a) + o僇乕僪崅(a)) \ 2) * p僇乕僪僒僀僘榞偺懢偝幚岠抣_尰嵼()))
                '-------------------------------------------
                With o僇乕僪孮椞堟
                    o僇乕僪孮椞堟撪懁_WD(a) = .rrr - .lll - (o僇乕僪暆敿 * 2) : o僇乕僪孮椞堟撪懁_HT(a) = .bbb - .ttt - (o僇乕僪崅敿 * 2)
                End With
                '-------------------------------------------
            Next
            '*****************************************************************************************************
            '怴偟偔僇乕僪傪攝傞応崌偼丄偁傞偄偼傾僾儕僗僞乕僩帪偺儕僒僀僘偱偼丄嵞攝抲梡僙儞僞乕x, y 傪愝掕偡傞
            o嵞攝抲梡僙儞僞乕愝掕 = (rNew1_WndReSize2_PropChange3 = 1 Or m僇乕僪攝楍(1).嵞攝抲梡僙儞僞乕x = 0)
            If o嵞攝抲梡僙儞僞乕愝掕 Then
                Call p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢偺儕僙僢僩()
            End If
            '*****************************************************************************************************
            o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 = p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢()
            omax枃悢 = o尰嵼偺僇乕僪枃悢 * 2
            ocur戝拞彫 = 1.0#
            Randomize()
            '*****************************************************************************************************
            Dim oAry僇乕僪宆IDXmax As Integer, oAry僇乕僪宆IDXcur As Integer, oAry僇乕僪宆(0) As Integer
            oAry僇乕僪宆IDXmax = p僎乕儉僇乕僪宆_巊梡拞_僇乕僪宆ID_Ary(oAry僇乕僪宆)
            oAry僇乕僪宆IDXcur = 0
            '*****************************************************************************************************
            o巊梡僇乕僪孮chkstr = 惎 & m巊梡僇乕僪孮
            o嵞攝抲寁嶼夞悢巜掕抣 = IIf(p僇乕僪偺廳側傝傪尭傜偡, 500, 10)  '1000, 10)
            '-------------------------------------------
            'ggg = 1000 '嵟彫僒僀僘偺僠僃僢僋
            ''-------------------------------------------
            For a = 1 To omax枃悢
                With m僇乕僪攝楍(a)
                    '***************************************************************************
                    If r僇乕僪偺曄峏偩偗幚峴 = 5 Then  '戝拞彫
                        If o僎乕儉僇乕僪偺僒僀僘戝拞彫 Then
                            If a <= o尰嵼偺僇乕僪枃悢 Then
                                .戝拞彫 = ocur戝拞彫 * (0.9 + (Rnd() - 0.5) / 3)
                                ocur戝拞彫 = 0.7 + (Rnd() * 0.7)
                            Else
                                n = a - o尰嵼偺僇乕僪枃悢
                                .戝拞彫 = m僇乕僪攝楍(n).戝拞彫
                            End If
                        Else
                            .戝拞彫 = 1.0#
                        End If
                        oGotoRet100 = 110 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
gotoret_110:
                        '-------------------------------------------
                    ElseIf r僇乕僪偺曄峏偩偗幚峴 = 2 Then  '
                        oGotoRet100 = 120 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
gotoret_120:
                        '-------------------------------------------
                    ElseIf r僇乕僪偺曄峏偩偗幚峴 = 1 Then
                        If .摉傝嶍彍偢傒 = False Then
                            '-------------------------------------------
                            oAry僇乕僪宆IDXcur = oAry僇乕僪宆IDXcur + 1
                            If oAry僇乕僪宆IDXcur > oAry僇乕僪宆IDXmax Then oAry僇乕僪宆IDXcur = 1
                            '-------------------------------------------
                            If a <= o尰嵼偺僇乕僪枃悢 Then
                                .僇乕僪宆 = oAry僇乕僪宆(oAry僇乕僪宆IDXcur)
                                .夋慺僇乕僪ID = a + o尰嵼偺僇乕僪枃悢
                            Else
                                .僇乕僪宆 = m僇乕僪攝楍(a - o尰嵼偺僇乕僪枃悢).僇乕僪宆
                                .夋慺僇乕僪ID = 0
                            End If
                            '-------------------------------------------
                        End If
                        '-------------------------------------------
                        oGotoRet100 = 130 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
gotoret_130:
                        '-------------------------------------------
                        '***************************************************************************

                    Else
                        '-------------------------------------------
                        oAry僇乕僪宆IDXcur = oAry僇乕僪宆IDXcur + 1
                        If oAry僇乕僪宆IDXcur > oAry僇乕僪宆IDXmax Then oAry僇乕僪宆IDXcur = 1
                        '-------------------------------------------
                        If a <= o尰嵼偺僇乕僪枃悢 Then
                            .僇乕僪宆 = oAry僇乕僪宆(oAry僇乕僪宆IDXcur)
                            .夋慺僇乕僪ID = a + o尰嵼偺僇乕僪枃悢
                        Else
                            .僇乕僪宆 = m僇乕僪攝楍(a - o尰嵼偺僇乕僪枃悢).僇乕僪宆
                            .夋慺僇乕僪ID = 0
                        End If
                        '-------------------------------------------
                        If o嵞攝抲梡僙儞僞乕愝掕 Then
                            '-------------------------------------------
                            If a <= o尰嵼偺僇乕僪枃悢 Then m昤夋専嵏攝楍(a) = a
                            '-------------------------------------------
                            .摉傝嶍彍偢傒 = False
                            '-------------------------------------------
                            If o僎乕儉僇乕僪偺僒僀僘戝拞彫 Then
                                If a <= o尰嵼偺僇乕僪枃悢 Then
                                    .戝拞彫 = ocur戝拞彫 * (0.9 + (Rnd() - 0.5) / 3)
                                    ocur戝拞彫 = 0.7 + (Rnd() * 0.7)
                                Else
                                    n = a - o尰嵼偺僇乕僪枃悢
                                    .戝拞彫 = m僇乕僪攝楍(n).戝拞彫
                                End If
                            Else
                                .戝拞彫 = 1.0#
                            End If
                            '------------------------------
                            chkcount = 0
                            '------------------------------
                            Do
                                .嵞攝抲梡僙儞僞乕x = Rnd()
                                .嵞攝抲梡僙儞僞乕y = Rnd()
                                oGotoRet100 = 140 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 
gotoret_140:
                                mm = a - 1
                                For n = 1 To mm
                                    If 0 <> IntersectRect(rc, .幚悺椞堟, m僇乕僪攝楍(n).廳側傝挷嵏梡椞堟) Then Exit For
                                Next
                                If n > mm Then
                                    Exit Do
                                Else
                                    .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
                                    oGotoRet200 = 210 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY	
gotoret_210:
                                    If RetChkAddDelXY Then
                                        Exit Do
                                    Else
                                        .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.96
                                        oGotoRet200 = 220 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_220:
                                        If RetChkAddDelXY Then
                                            Exit Do
                                        Else
                                            .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 0.98
                                            oGotoRet200 = 230 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_230:
                                            If RetChkAddDelXY Then
                                                Exit Do
                                            Else
                                                '------------------------------
                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
                                                oGotoRet200 = 240 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_240:
                                                If RetChkAddDelXY Then
                                                    Exit Do
                                                Else
                                                    .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
                                                    oGotoRet200 = 250 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_250:
                                                    If RetChkAddDelXY Then
                                                        Exit Do
                                                    Else
                                                        .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 1.04
                                                        oGotoRet200 = 260 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_260:
                                                        If RetChkAddDelXY Then
                                                            Exit Do
                                                        Else
                                                            .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
                                                            oGotoRet200 = 270 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_270:
                                                            If RetChkAddDelXY Then
                                                                Exit Do
                                                            Else
                                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
                                                                oGotoRet200 = 280 : GoTo goto200  'RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
gotoret_280:
                                                                If RetChkAddDelXY Then
                                                                    Exit Do
                                                                End If
                                                            End If
                                                        End If
                                                    End If
                                                End If
                                                '------------------------------
                                            End If
                                        End If
                                    End If
                                End If
                                '------------------------------
                                chkcount = chkcount + 1
                                If chkcount > o嵞攝抲寁嶼夞悢巜掕抣 Then
                                    oOvercount = oOvercount + 1
                                    'qqqqq(Format(oOvercount, "00") + "丂嵞攝抲寁嶼 " + CStr(o嵞攝抲寁嶼夞悢巜掕抣) + " 夞挻")
                                    Exit Do
                                End If
                                '------------------------------
                            Loop
                            'End If
                        Else
                            oGotoRet100 = 150 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub SetNewPostSize
gotoret_150:
                        End If
                    End If
                    .幚悺WD = 嘳Rect暆(.幚悺椞堟) '幚悺椞堟.Width
                    .幚悺HT = 嘳Rect崅(.幚悺椞堟) '幚悺椞堟.Height
                    .僇乕僪榞暆 = Math.Max(2, o僼儗乕儉暆(.僇乕僪宆) * .戝拞彫 * o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
                    '-------------------------------------------
                    If rNew1_WndReSize2_PropChange3 = 1 Then
                        .摉傝嶍彍偢傒 = False
                        .DoDraw = True
                    End If
                    '傑偩偁偨偭偰偄側偄僇乕僪偩偗儕乕僕儑儞傪嶌傞
                    If .摉傝嶍彍偢傒 = False Then
                        Call zz儕乕僕儑儞僨乕僞乕嶍彍(m僇乕僪攝楍(a))
                        If Not oo僺僞儁僞僇乕僪.aa僇乕僪宆儕乕僕儑儞嶌惉(m僇乕僪宆僨乕僞乕婎杮愝掕(.僇乕僪宆).億儕僑儞, .儕乕僕儑儞, .儕乕僕儑儞榞, .僇乕僪宆, .幚悺椞堟, .僇乕僪榞暆, c挿曽宍, c惓曽宍, c懭墌宍, c墌宍, c榋妏宍, c傂偟宍, c嶰妏宍, c廫帤宍, c偩傞傑宍, c僟僀儎宍, c惎宍, c傾儗僀宍, c僴乕僩宍, c巐偮梩宍, c偍傢傫宍, c傾僩儉宍, c偝偐側宍, c挶宍, c僔儍僩儖宍, cUFO_宍, cUserCard僗働乕儖婎悢WD, cUserCard僗働乕儖婎悢HT) Then
                            Call zzErrorAppEnd() '傕偟僄儔乕偵側傟偽丄傾僾儕傪嫮惂廔椆偡傞丅
                        End If
                        'n = GetRgnBox(.儕乕僕儑儞, rc)
                        'qqqqq(CStr(a) & ", " & CStr(.僇乕僪宆) & ", " & CStr(.幚悺椞堟.lll) & "/" & CStr(.幚悺椞堟.ttt) & ", " & CStr(rc.lll) & "/" & CStr(rc.ttt) & ", " & CStr(rc.rrr) & "/" & CStr(rc.bbb) & ", " & CStr(.儕乕僕儑儞) & ", " & CStr(.儕乕僕儑儞榞))
                    Else
                        'qqqqq CStr(a)
                    End If
                    'qqqqq(Format(a, "000") + "  " + CStr(.幚悺椞堟.lll))  '2022/07/23  OK
                    '-------------------------------------------
                    If ggg > .幚悺WD Then ggg = .幚悺WD '嵟彫僒僀僘偺僠僃僢僋
                    '-------------------------------------------
                    If mMax僇乕僪崅 < .幚悺WD Then mMax僇乕僪崅 = .幚悺WD
                    If mMax僇乕僪暆 < .幚悺HT Then mMax僇乕僪暆 = .幚悺HT
                    '-------------------------------------------
                    GoTo JmpToForNext_JmpToForNext_JmpToForNext_JmpToForNext
                    '-------------------------------------------
                    '仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧
                    '仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧
goto100:
                    '------------------------------------------------
                    If .戝拞彫 < 0.3 Then .戝拞彫 = 1.0#
                    '------------------------------------------------
                    www = o僇乕僪暆(.僇乕僪宆) * .戝拞彫 : hhh = o僇乕僪崅(.僇乕僪宆) * .戝拞彫
                    Do While www < 16 Or hhh < 16
                        www = (www * 2.5) \ 2 : hhh = (hhh * 2.5) \ 2
                    Loop
                    www = (www \ 2) * 2 : hhh = (hhh \ 2) * 2
                    '------------------------------------------------
                    xxx = o僇乕僪孮椞堟.lll + (o僇乕僪孮椞堟撪懁_WD(.僇乕僪宆) * .嵞攝抲梡僙儞僞乕x) + ((o僇乕僪暆(.僇乕僪宆) - www) \ 2)
                    yyy = o僇乕僪孮椞堟.ttt + (o僇乕僪孮椞堟撪懁_HT(.僇乕僪宆) * .嵞攝抲梡僙儞僞乕y) + ((o僇乕僪崅(.僇乕僪宆) - hhh) \ 2)
                    '------------------------------------------------
                    gggint = SetRect(.幚悺椞堟, xxx, yyy, xxx + www, yyy + hhh)
                    gggint = InflateRect(.幚悺椞堟, 嘳Rect暆(.幚悺椞堟) * (o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 - 1.0#), 嘳Rect崅(.幚悺椞堟) * (o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 - 1.0#))
                    Call 嘳RectIntoBigRect(.幚悺椞堟, o僇乕僪孮椞堟) '幚悺椞堟丂傪丂o僇乕僪孮椞堟丂偺撪懁偵堏摦偡傞
                    '------------------------------------------------
                    dxx = o僇乕僪墢偺廳側傝暆(.僇乕僪宆) * .戝拞彫
                    dyy = o僇乕僪墢偺廳側傝崅(.僇乕僪宆) * .戝拞彫
                    With .幚悺椞堟
                        gggint = SetRect(m僇乕僪攝楍(a).廳側傝挷嵏梡椞堟, .lll + dxx, .ttt + dyy, .rrr - dxx, .bbb - dyy)
                    End With
                    '------------------------------------------------
                    Select Case oGotoRet100
                        Case 110 : GoTo gotoret_110
                        Case 120 : GoTo gotoret_120
                        Case 130 : GoTo gotoret_130
                        Case 140 : GoTo gotoret_140
                        Case 150 : GoTo gotoret_150
                        Case 160 : GoTo gotoret_160
                    End Select
                    '仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧
goto200:
                    .嵞攝抲梡僙儞僞乕x = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕x)
                    .嵞攝抲梡僙儞僞乕y = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕y)
                    '------------------------------------------------
                    oGotoRet100 = 160 : GoTo goto100  'gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) '	GoSub SetNewPostSize
gotoret_160:
                    '------------------------------------------------
                    mmm = a - 1
                    For nnn = 1 To mmm
                        If 0 <> IntersectRect(rcrc, .幚悺椞堟, m僇乕僪攝楍(nnn).廳側傝挷嵏梡椞堟) Then Exit For
                    Next
                    If nnn > mmm Then RetChkAddDelXY = True Else RetChkAddDelXY = False
                    '------------------------------------------------
                    Select Case oGotoRet200
                        Case 210 : GoTo gotoret_210
                        Case 220 : GoTo gotoret_220
                        Case 230 : GoTo gotoret_230
                        Case 240 : GoTo gotoret_240
                        Case 250 : GoTo gotoret_250
                        Case 260 : GoTo gotoret_260
                        Case 270 : GoTo gotoret_270
                        Case 280 : GoTo gotoret_280
                    End Select
                    '仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧
                    '仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧仧
                End With
                '-------------------------------------------
JmpToForNext_JmpToForNext_JmpToForNext_JmpToForNext:
            Next
            '**********************************************************************************************************************************
            '**********************************************************************************************************************************
            'frmMain.pctCardHit.Image  僪儔僢僌僇乕僪偺昤夋梡偺僂僀儞僪僂偲僀儊乕僕偺嵞嶌惉丅丂
            w = mMax僇乕僪崅 * 1.1
            h = mMax僇乕僪暆 * 1.1
            With frmMain.pctCardHit
                .SetBounds(0, 0, w, h, BoundsSpecified.Width Or BoundsSpecified.Height)
                gggbol = 嘳Image_怴婯嶌惉_嵞嶌惉(.Image, w, h)
                'qqqqq("*****frmMain.pctCardHit.Image 嵞嶌惉*****")
            End With
            '**************************************************************
            If o嵞攝抲梡僙儞僞乕愝掕 Then Call mn1game僇乕僪偺廳側傝傪尭傜偡_CapSet(oOvercount)
            ''-------------------------------------------
            'qqqqq "嵟彫僒僀僘 = " + CStr(ggg) '嵟彫僒僀僘偺僠僃僢僋
            ''-------------------------------------------
            'qqqqq "Cards Post Set End *****************"
        End If
        pp僎乕儉幚峴拞 = Not zz巆傝僇乕僪偑側偄()
        '**************************************************************
        If r僌儗乕儗儀儖偺曄峏 And (rNew1_WndReSize2_PropChange3 = 3) Then
            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, CStr(CInt(Rnd() * 100000)), pp僎乕儉幚峴拞)
        Else
            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(frmMain, CStr(CInt(Rnd() * 100000)), pp僎乕儉幚峴拞)
        End If
        'qqqqq("aa僇乕僪偺攝抲偲嵞昤夋()  僙僢僩Image")
        '**************************************************************
        pp僎乕儉幚峴拞 = Not zz巆傝僇乕僪偑側偄()
        frmMain.pct儊僀儞.Visible = True
        frmMain.Invalidate()
        frmMain.Refresh()
        '-------------------------------------------
        If rNew1_WndReSize2_PropChange3 = 1 Then
            p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 = 0
            gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僞僀儅乕偺僆儞僆僼on僗僀僗僀onff(gmDlgFile僎乕儉梡, True)
            gggstr = 僀儀儞僩gAppEventMaker.MakeEvent僎乕儉奐巒偲掆巭(pp僎乕儉幚峴拞, "")
            '***********************************************************************
            gggbol = frmMain.僎乕儉僨乕僞乕昞帵(0, (p尰嵼偺僇乕僪枃悢), (p尰嵼偺僇乕僪枃悢))
            '***********************************************************************
        End If
        '-------------------------------------------
        'qqqqq "偡傋偰昤夋 *****************"
        'For a = 0 To 29: qqqqq m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖: Next
        '-------------------------------------------
        Return True
        '**********************************************************************************************************************************
errop:
        MsgBox(ErrorToString()) : Return False
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僼僅乕儉儅僂僗僀儀儞僩張棟(ByRef rEventFromWnd As Boolean, ByRef rMouseOp As Integer, ByRef rButton As Integer, ByRef RX As Integer, ByRef RY As Integer, ByRef wGameEnd As Boolean, ByRef rOnLoopCardID As Integer) As Boolean
        '------------------------------------------------
        wGameEnd = False
        '------------------------------------------------
        If DoeventCall Then Return False
        Static sta僪儔僢僌僇乕僪 As Integer '儅僂僗僟僂儞偺僪儔僢僌偝傟偰偄傞僇乕僪丄m僇乕僪攝楍() 攝楍撪偺僀儞僨僢僋僗丅
        Static sta僪儘僢僾愭僇乕僪 As Integer '僪儔僢僌僇乕僪偑僪儘僢僾偝傟偨埵抲偺僇乕僪丄m僇乕僪攝楍() 攝楍撪偺僀儞僨僢僋僗丅
        Static mDnX, mDnY As Integer '僼僅乕儉忋偺儅僂僗僟僂儞帪偺 X Y
        Static mDnPxtLeft, mDnPctTop As Integer '僼僅乕儉忋偺儅僂僗僟僂儞帪偺   (僇乕僪 = frmmain.pctCardHit)   偺 Left / Top
        Static mMouseFlag As Integer '嵍塃儅僂僗儃僞儞偑墴偝傟偨僼儔僢僌
        Dim MoveAryX() As Integer : Dim MoveAryY() As Integer
        Dim max, b, a, n As Integer
        Dim px, py As Single
        Dim rgn0, 徚偡CardID As Integer
        Dim hWnd僇乕僪 As Integer = 0 : Dim hDC僇乕僪 As Integer = 0 : Dim g As Graphics = Nothing
        Dim 僇乕僪 As PictureBox = frmMain.pctCardHit
        Select Case rMouseOp
            '*******************************************************************************
            '*******************************************************************************
            '2018/09/18----------------------------------
            Case 173 '奜晹偐傜偺丂sub僨乕僞乕僋儕傾:丂偺屇傃弌偟偩偗
                gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾 '
                '2018/09/18----------------------------------
                '*******************************************************************************
                '*******************************************************************************
            Case 1 'Form_MouseDown
                If pp僎乕儉僋儕傾忬懺 Then
                    gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                    mMouseFlag = 0
                ElseIf rButton = MouseButtons.Left Then
                    gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                    mMouseFlag = 1
                    sta僪儔僢僌僇乕僪 = 0
                    If rOnLoopCardID > 0 Then
                        sta僪儔僢僌僇乕僪 = rOnLoopCardID
                    Else
                        For a = p尰嵼偺僇乕僪枃悢 To 1 Step -1
                            n = m昤夋専嵏攝楍(a)
                            With m僇乕僪攝楍(n)
                                If .摉傝嶍彍偢傒 = False And sta僪儔僢僌僇乕僪 <> n Then
                                    If PtInRegion(.儕乕僕儑儞, RX, RY) Then
                                        sta僪儔僢僌僇乕僪 = n : Exit For
                                    End If
                                End If
                            End With
                        Next
                    End If
                    '----------------------------------------------
                    If sta僪儔僢僌僇乕僪 > 0 Then
                        gm僎乕儉幚峴拞_in_MouseEvent = True
                        hWnd僇乕僪 = 僇乕僪.Handle.ToInt32
                        If hWnd僇乕僪 <> 0 Then
                            With m僇乕僪攝楍(sta僪儔僢僌僇乕僪)
                                僇乕僪.Visible = True
                                僇乕僪.SetBounds(.幚悺椞堟.lll, .幚悺椞堟.ttt + frmMain.mMenuHight, .幚悺WD, .幚悺HT)
                                rgn0 = CreateRectRgn(0, 0, 1, 1)
                                gggint = CombineRgn(rgn0, .儕乕僕儑儞, .儕乕僕儑儞, RGN_COPY)
                                gggint = OffsetRgn(rgn0, -.幚悺椞堟.lll, -.幚悺椞堟.ttt)
                                gggint = SetWindowRgn(hWnd僇乕僪, 0, 0)
                                gggint = SetWindowRgn(hWnd僇乕僪, rgn0, 0)
                                gggint = DeleteObject(rgn0)
                                '----------------------------------------------
                                g = Graphics.FromImage(僇乕僪.Image)
                                If g IsNot Nothing Then
                                    gggbol = 嘳ImageDrawByGraphics(g, frmMain.pctBmp.Image, 0, 0, 僇乕僪.Width, 僇乕僪.Height, m僇乕僪攝楍(.夋慺僇乕僪ID).幚悺椞堟)
                                    hDC僇乕僪 = g.GetHdc
                                    If hDC僇乕僪 <> 0 Then
                                        gggint = OffsetRgn(.儕乕僕儑儞, -.幚悺椞堟.lll, -.幚悺椞堟.ttt)
                                        If .儕乕僕儑儞榞 <> 0 Then gggint = OffsetRgn(.儕乕僕儑儞榞, -.幚悺椞堟.lll, -.幚悺椞堟.ttt)
                                        Dim h僽儔僔僎乕儉攝怓奜榞儔僢僌 As Integer = CreateSolidBrush(p僎乕儉攝怓奜榞僪儔僢僌)
                                        If h僽儔僔僎乕儉攝怓奜榞儔僢僌 <> 0 Then
                                            If .儕乕僕儑儞榞 <> 0 Then
                                                gggint = FillRgn(hDC僇乕僪, .儕乕僕儑儞榞, h僽儔僔僎乕儉攝怓奜榞儔僢僌)
                                            Else
                                                gggint = FrameRgn(hDC僇乕僪, .儕乕僕儑儞, h僽儔僔僎乕儉攝怓奜榞儔僢僌, .僇乕僪榞暆, .僇乕僪榞暆)
                                            End If
                                            gggint = DeleteObject(h僽儔僔僎乕儉攝怓奜榞儔僢僌)
                                        End If
                                        gggint = FrameRgn(hDC僇乕僪, .儕乕僕儑儞, GetStockObject(BLACK_BRUSH), 1, 1)
                                        gggint = OffsetRgn(.儕乕僕儑儞, .幚悺椞堟.lll, .幚悺椞堟.ttt)
                                        If .儕乕僕儑儞榞 <> 0 Then gggint = OffsetRgn(.儕乕僕儑儞榞, .幚悺椞堟.lll, .幚悺椞堟.ttt)
                                        g.ReleaseHdc(hDC僇乕僪) : hDC僇乕僪 = 0
                                    End If
                                    g.Dispose()
                                End If
                            End With
                        End If
                        '----------------------------------------------
                        徚偡CardID = sta僪儔僢僌僇乕僪
                        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_僇乕僪傪徚偡(1, 徚偡CardID)

                        mDnPxtLeft = 僇乕僪.Left : mDnPctTop = 僇乕僪.Top : mDnX = RX : mDnY = RY
                    End If
                ElseIf mMouseFlag = 0 Then
                    gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                    mMouseFlag = 11 : mDnX = RX : mDnY = RY
                End If
                '*******************************************************************************
                '*******************************************************************************
            Case 2 'Form_MouseMove
                If (rButton = MouseButtons.Left) And mMouseFlag = 1 And sta僪儔僢僌僇乕僪 > 0 And 僇乕僪.Visible Then
                    僇乕僪.SetBounds(mDnPxtLeft + (RX - mDnX), mDnPctTop + (RY - mDnY), 0, 0, BoundsSpecified.X Or BoundsSpecified.Y)
                End If
                '*******************************************************************************
                '*******************************************************************************
            Case 3 'Form_MouseUp
                If rButton = MouseButtons.Left Then
                    If mMouseFlag = 1 And sta僪儔僢僌僇乕僪 > 0 And 僇乕僪.Visible Then
                        gm僎乕儉幚峴拞_in_MouseUp_張棟拞 = True
                        sta僪儘僢僾愭僇乕僪 = 0
                        If rOnLoopCardID > 0 Then
                            sta僪儘僢僾愭僇乕僪 = rOnLoopCardID
                        Else
                            n = sta僪儔僢僌僇乕僪 + p尰嵼偺僇乕僪枃悢
                            With m僇乕僪攝楍(n)
                                If .摉傝嶍彍偢傒 = False Then
                                    If PtInRegion(.儕乕僕儑儞, RX, RY) Then sta僪儘僢僾愭僇乕僪 = n
                                End If
                            End With
                        End If
                        If sta僪儘僢僾愭僇乕僪 <> m僇乕僪攝楍(sta僪儔僢僌僇乕僪).夋慺僇乕僪ID Then sta僪儘僢僾愭僇乕僪 = 0
                        '----------------------------------------------
                        If sta僪儘僢僾愭僇乕僪 = 0 Then '偼偢傟
                            '2021/04/03 add '夋柺忋偺幚懱偺嫍棧偵崌傢偣偰丄僇乕僪昤夋悢傪憹尭偡傞丅
                            max = 嘳夋柺撪偱偺堏摦梡攝楍偺梫慺悢偺愝掕_暯曽崻偱((僇乕僪.Left), (僇乕僪.Top), mDnPxtLeft, mDnPctTop, p僇乕僪僗僺乕僪幚岠抣(p僇乕僪僗僺乕僪) / 30, 2, 200)
                            max = Math.Max(2, max)
                            'qqqqq "*************** " + CStr(max)
                            ReDim MoveAryX(max) : px = (僇乕僪.Left - mDnPxtLeft) / max : For a = 1 To max : MoveAryX(a) = 僇乕僪.Left - (px * (a - 1)) : Next
                            ReDim MoveAryY(max) : py = (僇乕僪.Top - mDnPctTop) / max : For a = 1 To max : MoveAryY(a) = 僇乕僪.Top - (py * (a - 1)) : Next
                            For a = 1 To max
                                僇乕僪.SetBounds(MoveAryX(a), MoveAryY(a), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y) '偼偢傟偨僇乕僪偑尦偺埵抲偵栠傞
                                If p僇乕僪堏摦偺婳愓傪巆偡BOOL Then
                                    僇乕僪.Refresh()
                                    Call Sleep(5)
                                Else
                                    frmMain.Refresh()
                                End If
                            Next
                            '------------------------------------------------------
                            '僇乕僪傪栠偟偰嵟慜柺偵偟偰嵞昤夋
                            For a = 1 To p尰嵼偺僇乕僪枃悢
                                If m昤夋専嵏攝楍(a) = sta僪儔僢僌僇乕僪 Then
                                    For b = a To p尰嵼偺僇乕僪枃悢 - 1
                                        m昤夋専嵏攝楍(b) = m昤夋専嵏攝楍(b + 1)
                                    Next
                                    m昤夋専嵏攝楍(p尰嵼偺僇乕僪枃悢) = sta僪儔僢僌僇乕僪 '偼偢傟僇乕僪傪嵟慜柺偵偡傞丅
                                    Exit For
                                End If
                            Next
                            '------------------------------------------------------
                            max = p尰嵼偺僇乕僪枃悢 * 2
                            For a = 1 To max
                                m僇乕僪攝楍(a).DoDraw = False
                            Next
                            '------------------------------------------------------
                            m僇乕僪攝楍(sta僪儔僢僌僇乕僪).DoDraw = True
                            僇乕僪.Visible = False
                            gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_僇乕僪傪徚偡(2, sta僪儔僢僌僇乕僪)
                            frmMain.pct儊僀儞.Refresh()
                            '*******************************************************************************
                        Else '摉傝
                            With m僇乕僪攝楍(sta僪儘僢僾愭僇乕僪)
                                僇乕僪.SetBounds(.幚悺椞堟.lll, .幚悺椞堟.ttt + frmMain.mMenuHight, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
                                frmMain.Refresh()
                                If p僇乕僪堦抳偱斀揮偡傞BOOL Then
                                    hWnd僇乕僪 = 僇乕僪.Handle.ToInt32
                                    hDC僇乕僪 = GetDC(hWnd僇乕僪)
                                    If hDC僇乕僪 <> 0 Then
                                        Dim rgn As Integer = CreateRectRgn(0, 0, 1, 1)
                                        gggint = CombineRgn(rgn, .儕乕僕儑儞, .儕乕僕儑儞, RGN_COPY)
                                        gggint = OffsetRgn(rgn, -.幚悺椞堟.lll, -.幚悺椞堟.ttt)
                                        gggint = InvertRgn(hDC僇乕僪, rgn)
                                        gggint = DeleteObject(rgn)
                                        gggint = ReleaseDC(hWnd僇乕僪, hDC僇乕僪)
                                        hDC僇乕僪 = 0
                                        DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
                                    End If
                                End If
                            End With
                            Call Sleep(500)
                            '----------------------------------------------
                            m僇乕僪攝楍(sta僪儔僢僌僇乕僪).摉傝嶍彍偢傒 = True : m僇乕僪攝楍(sta僪儔僢僌僇乕僪).DoDraw = False
                            m僇乕僪攝楍(sta僪儘僢僾愭僇乕僪).摉傝嶍彍偢傒 = True : m僇乕僪攝楍(sta僪儘僢僾愭僇乕僪).DoDraw = False
                            '----------------------------------------------
                            徚偡CardID = sta僪儘僢僾愭僇乕僪
                            gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_僇乕僪傪徚偡(3, 徚偡CardID) 'GoSub 僇乕僪傪徚偡    '僸僢僩偟偨僇乕僪偺埵抲偺丄僇乕僪傪徚偟偰攚宨偵偡傞丅
                            '----------------------------------------------
                            Call zz儕乕僕儑儞僨乕僞乕嶍彍(m僇乕僪攝楍(sta僪儔僢僌僇乕僪))
                            Call zz儕乕僕儑儞僨乕僞乕嶍彍(m僇乕僪攝楍(sta僪儘僢僾愭僇乕僪))
                            '----------------------------------------------
                            僇乕僪.Visible = False
                            frmMain.pct儊僀儞.Refresh()
                            '----------------------------------------------
                            '偁偨傝壒傪柭傜偡丅
                            If p僒僂儞僪傪柭傜偡 And (Not zz巆傝僇乕僪偑側偄()) Then
                                Dim sfile As String = IIf(p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞, p僒僂儞僪僼傽僀儖偺攝楍_NEXT(), p僒僂儞僪僼傽僀儖)
                                gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僒僂儞僪僼傽僀儖偺幚峴傪奐巒偟傑偡(sfile)
                                gggbol = 嘳僒僂儞僪傪柭傜偡(sfile, 1, False, True)
                            End If
                            '----------------------------------------------
                            Call Sleep(500)
                            '----------------------------------------------
                            If zz巆傝僇乕僪偑側偄() Then

                                'Call aa僎乕儉僋儕傾(False)
                                '----------------------------------------------
                                If p僒僂儞僪傪柭傜偡 Then
                                    Dim sfile As String = p僒僂儞僪僼傽僀儖
                                    gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僒僂儞僪僼傽僀儖偺幚峴傪奐巒偟傑偡(sfile)
                                    gggbol = 嘳僒僂儞僪傪柭傜偡(sfile, 2, True, True)
                                End If
                                wGameEnd = True
                            Else
                                If p巆傝枃悢偱僇乕僪僒僀僘曄峏偺嵞昤夋偑梊掕() Then
                                    Call p巆傝枃悢偱僇乕僪僒僀僘曄峏偺専嵏偲嵞昤夋()
                                    'qqqqq "p巆傝枃悢偱僇乕僪僒僀僘曄峏偺専嵏偲嵞昤夋 Done" + CStr(aa巆傝僇乕僪枃悢)
                                End If
                            End If
                        End If
                        'qqqqq("pct儊僀儞_MouseUp END")
                        '*******************************************************************************
                        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                        '*******************************************************************************
                        DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
                        '*******************************************************************************
                        gm僎乕儉幚峴拞_in_MouseEvent = False
                        gm僎乕儉幚峴拞_in_MouseUp_張棟拞 = False
                        '***********************************************************************
                        If wGameEnd = True Then
                            gggbol = frmMain.僎乕儉僨乕僞乕昞帵(2, (p尰嵼偺僇乕僪枃悢), p僇乕僪枃悢_尰嵼偺巆傝枃悢)
                            pp僎乕儉僋儕傾忬懺 = True
                            Call aa僎乕儉僋儕傾(False)
                        End If
                        '***********************************************************************
                    Else
                        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                    End If
                Else
                    If mMouseFlag = 11 And System.Math.Abs(RX - mDnX) < 20 And System.Math.Abs(RY - mDnY) < 20 Then
                        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                        frmMain.pctBmp.Visible = True
                    ElseIf mMouseFlag <> 1 Then
                        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(sta僪儔僢僌僇乕僪, sta僪儘僢僾愭僇乕僪, mMouseFlag, mDnX, mDnY, mDnPxtLeft, mDnPctTop) 'GoSub sub僨乕僞乕僋儕傾
                    End If
                End If
        End Select
        Return True
    End Function
    Private Function aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_sub僨乕僞乕僋儕傾(ByRef sta僪儔僢僌僇乕僪 As Integer, ByRef sta僪儘僢僾愭僇乕僪 As Integer, ByRef mMouseFlag As Integer, ByRef mDnX As Integer, ByRef mDnY As Integer, ByRef mDnPxtLeft As Integer, ByRef mDnPctTop As Integer) As Boolean
        sta僪儔僢僌僇乕僪 = 0 : sta僪儘僢僾愭僇乕僪 = 0 : mMouseFlag = 0 : mDnX = 0 : mDnY = 0 : mDnPxtLeft = 0 : mDnPctTop = 0 : frmMain.pctCard.Visible = False : frmMain.pctBmp.Visible = False
        gm僎乕儉幚峴拞_in_MouseEvent = False
        Return True
    End Function
    Private Function aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_僇乕僪傪徚偡(ByVal Call_儁僀儞僩_0_僪儔僢僌奐巒_1_僴僘儗_2_摉偨傝_3 As Integer, ByRef 徚偡CardID As Integer) As Boolean
        Dim a As Integer, 徚偡CardRgn As Integer, rgnx As Integer
        '僸僢僩偟偨僇乕僪偺埵抲偺丄僇乕僪傪徚偟偰攚宨偵偡傞丅
        徚偡CardRgn = CreateRectRgn(0, 0, 1, 1)
        rgnx = CreateRectRgn(0, 0, 1, 1)
        gggint = CombineRgn(徚偡CardRgn, m僇乕僪攝楍(徚偡CardID).儕乕僕儑儞, m僇乕僪攝楍(徚偡CardID).儕乕僕儑儞, RGN_COPY)
        '----------------------------------------------
        '僸僢僩偟偨僇乕僪偺応強偵廳側傞丄暿偺僇乕僪偺昤夋偺昁梫惈傪挷傋傞
        For a = 1 To p尰嵼偺僇乕僪枃悢 * 2
            m僇乕僪攝楍(a).DoDraw = False
            With m僇乕僪攝楍(a)
                If .摉傝嶍彍偢傒 = False Then
                    If (NULLREGION = CombineRgn(rgnx, 徚偡CardRgn, .儕乕僕儑儞, RGN_AND)) Then
                    Else
                        .DoDraw = True
                        'qqqqq ".DoDraw = " + CStr(a)
                    End If
                End If
            End With
        Next
        m僇乕僪攝楍(徚偡CardID).DoDraw = (Call_儁僀儞僩_0_僪儔僢僌奐巒_1_僴僘儗_2_摉偨傝_3 = 2)
        gggint = DeleteObject(rgnx)
        '----------------------------------------------
        Call zz僇乕僪昤夋(Call_儁僀儞僩_0_僪儔僢僌奐巒_1_僴僘儗_2_摉偨傝_3, 徚偡CardID, 徚偡CardRgn)
        gggint = DeleteObject(徚偡CardRgn)
        '----------------------------------------------
        For a = 1 To p尰嵼偺僇乕僪枃悢 * 2
            With m僇乕僪攝楍(a)
                .DoDraw = (.摉傝嶍彍偢傒 = False)
            End With
        Next
        Return True
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa巆傝僇乕僪枃悢() As Integer
        Dim a, ccc As Integer
        ccc = 0
        For a = 1 To p尰嵼偺僇乕僪枃悢
            If m僇乕僪攝楍(a).摉傝嶍彍偢傒 = False Then ccc = ccc + 1
        Next
        Return ccc
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僎乕儉僋儕傾忬懺() As Boolean
        aa僎乕儉僋儕傾忬懺 = zz巆傝僇乕僪偑側偄()
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僎乕儉僋儕傾(ByVal On僎乕儉奐巒 As Boolean) As Boolean
        Dim a As Integer
        If gm傾僾儕廔椆偡傞 Then Return True
        If 僀儀儞僩gAppEventMaker Is Nothing Then Return True

        If pp僎乕儉幚峴拞 Then
            '************************************************
            gggbol = frmMain.僎乕儉僨乕僞乕昞帵(3, 0, 0)
            '************************************************
        End If
        For a = 1 To app嵟戝僇乕僪枃悢 * 2
            With m僇乕僪攝楍(a)
                .摉傝嶍彍偢傒 = True
                If .儕乕僕儑儞 <> 0 Then
                    gggint = DeleteObject(.儕乕僕儑儞) : .儕乕僕儑儞 = 0
                End If
                If .儕乕僕儑儞榞 <> 0 Then
                    gggint = DeleteObject(.儕乕僕儑儞榞) : .儕乕僕儑儞榞 = 0
                End If
            End With
        Next
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僞僀儅乕偺僆儞僆僼on僗僀僗僀onff(gmDlgFile僎乕儉梡, False)
        gggstr = 僀儀儞僩gAppEventMaker.MakeEvent僎乕儉奐巒偲掆巭(False, "")
        If pp僗僀僗僀僼儔僼儔_偄偢傟傕掆巭偟偰偄傞 Then frmMain.pct儊僀儞.Visible = True
        gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟(False, 173, 0, 0, 0, False, 0)
        If Not On僎乕儉奐巒 Then
            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(frmMain, CStr(CInt(Rnd() * 100000)), On僎乕儉奐巒)
        End If
        pp僎乕儉僋儕傾忬懺 = True
        'qqqqq("oo僺僞儁僞.aa僎乕儉僋儕傾()")
        Return True
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Friend Function aa僇乕僪嶌惉僨乕僞乕愝掕(ByRef rOld僇乕僪宆 As Integer, ByRef r儊僯儏乕僞僀僩儖 As String, ByRef r儊僯儏乕偵昞帵 As Boolean, ByRef r廲墶斾棪 As Single, ByRef r婎弨偺攞悢抣墶 As Single, ByRef r婎弨偺攞悢抣廲 As Single, ByRef r億儕僑儞梫慺悢 As Integer, ByRef r億儕僑儞() As POINTAPI, ByRef rUserCardMakeBox僗働乕儖婎悢WD As Integer, ByRef rUserCardMakeBox僗働乕儖婎悢HT As Integer) As Boolean
        Dim a, m As Integer
        aa僇乕僪嶌惉僨乕僞乕愝掕 = False
        With m儐乕僓乕嶌惉僨乕僞乕
            If r儊僯儏乕僞僀僩儖 <> "" Then .儊僯儏乕僞僀僩儖 = r儊僯儏乕僞僀僩儖
            .儊僯儏乕偵昞帵 = r儊僯儏乕偵昞帵
            .廲墶斾棪 = r廲墶斾棪
            .婎弨偺攞悢抣墶 = r婎弨偺攞悢抣墶
            .婎弨偺攞悢抣廲 = r婎弨偺攞悢抣廲
            .億儕僑儞梫慺悢 = r億儕僑儞梫慺悢
            m = r億儕僑儞梫慺悢 : ReDim .億儕僑儞(m)
            For a = 0 To m
                .億儕僑儞(a).X = r億儕僑儞(a).X * cUserCard僗働乕儖婎悢WD \ rUserCardMakeBox僗働乕儖婎悢WD
                .億儕僑儞(a).Y = r億儕僑儞(a).Y * cUserCard僗働乕儖婎悢HT \ rUserCardMakeBox僗働乕儖婎悢HT
            Next
        End With
        Call aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(2003, , , rOld僇乕僪宆)
        aa僇乕僪嶌惉僨乕僞乕愝掕 = True
    End Function

#End Region

#Region "儘乕僇儖"

    Private Function zz僇乕僪儕乕僕儑儞廳側傝晹暘偺嶍彍(ByVal CardID As Integer, ByRef wRGN As Integer) As Boolean
        Dim a As Integer, rc As RECT
        wRGN = CreateRectRgn(0, 0, 1, 1)
        gggint = CombineRgn(wRGN, m僇乕僪攝楍(CardID).儕乕僕儑儞, m僇乕僪攝楍(CardID).儕乕僕儑儞, RGN_COPY)
        For a = 1 To p尰嵼偺僇乕僪枃悢 * 2
            With m僇乕僪攝楍(a)
                If .摉傝嶍彍偢傒 = False Then
                    If (NULLREGION = CombineRgn(wRGN, wRGN, .儕乕僕儑儞, RGN_AND)) Then
                    Else
                        gggint = CombineRgn(wRGN, wRGN, .儕乕僕儑儞, RGN_DIFF)
                    End If
                End If
            End With
        Next
        Return (NULLREGION <> GetRgnBox(wRGN, rc))
    End Function

    Private Function zz僇乕僪昤夋(ByVal Call_儁僀儞僩_0_僪儔僢僌奐巒_1_僴僘儗_2_摉偨傝_3 As Integer, ByRef 徚偡CardID As Integer, ByRef 徚偡CardRgn As Integer) As Boolean
        If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then
            Return True 'True 傪曉偡
        ElseIf gm傾僾儕廔椆偡傞 Then
            Return True
        ElseIf frmMain.WindowState = FormWindowState.Minimized Then
            Return True 'True 傪曉偡
        Else
            'gm僆乕儖僋儕傾 = zz巆傝僇乕僪偑側偄()        '僇乕僪偑侾枃埲忋巆偭偰偄傞偐僠僃僢僋偡傞丅
            '--------------------------------------
            Dim CallTyp As Integer = Call_儁僀儞僩_0_僪儔僢僌奐巒_1_僴僘儗_2_摉偨傝_3
            Dim RET As Boolean = False : Dim 偙偙偱昤夋偟偨枃悢 As Integer = 0
            Dim a, n, m As Integer
            Dim g1 As Graphics = Nothing
            Dim h僽儔僔僎乕儉攝怓奜榞 As Integer = CreateSolidBrush(p僎乕儉攝怓奜榞)
            Dim h僽儔僔敳偗攚宨 As Integer = CreateSolidBrush(p僎乕儉攝怓敳偗攚宨)
            Dim rrggnn As Region = Nothing
            Dim rgn As Integer = 0
            Try
                If frmMain.pct儊僀儞.Visible = False Then frmMain.pct儊僀儞.Visible = True
                '------------------------------------------------------------------
                g1 = Graphics.FromImage(frmMain.pct儊僀儞.Image)
                If g1 IsNot Nothing Then
                    If CallTyp = 1 Or CallTyp = 3 Then
                        If 徚偡CardRgn <> 0 And 徚偡CardID <> 0 Then
                            '偙偪傜偼侾枃偺昤夋側偺偱丄娭悢屇傃弌偟偱傕傛偄
                            gggbol = 嘳ImageDrawByGraphics_With_Set_GDIrgn(g1, mImg尰嵼僒僀僘Gray, 徚偡CardRgn, m僇乕僪攝楍(徚偡CardID).幚悺椞堟, m僇乕僪攝楍(徚偡CardID).幚悺椞堟)
                            'qqqqq("call 嘳ImageDrawByGraphics_With_Set_GDIrgn() 徚偡CardID = " + CStr(徚偡CardID))
                        End If
                    End If
                    '------------------------------------------------------------------
                    If h僽儔僔敳偗攚宨 <> 0 Then
                        Dim HDC儊僀儞 As Integer = g1.GetHdc
                        If HDC儊僀儞 <> 0 Then
                            n = m僇乕僪攝楍(徚偡CardID).夋慺僇乕僪ID
                            m = p尰嵼偺僇乕僪枃悢
                            For a = m + 1 To m * 2
                                If (a <> 徚偡CardID) And (Not ((CallTyp = 3 And n = a))) Then
                                    With m僇乕僪攝楍(a)
                                        If (Not .摉傝嶍彍偢傒) And .DoDraw Then
                                            rgn = CreateRectRgn(0, 0, 1, 1)
                                            If 徚偡CardRgn <> 0 Then
                                                gggint = CombineRgn(rgn, 徚偡CardRgn, .儕乕僕儑儞, RGN_AND)
                                                gggint = SelectClipRgn(HDC儊僀儞, rgn)
                                            Else
                                                gggint = SelectClipRgn(HDC儊僀儞, .儕乕僕儑儞)
                                            End If
                                            gggint = FillRgn(HDC儊僀儞, .儕乕僕儑儞, h僽儔僔敳偗攚宨)
                                            gggint = FrameRgn(HDC儊僀儞, .儕乕僕儑儞, GetStockObject(BLACK_BRUSH), 1, 1)
                                            gggint = SelectClipRgn(HDC儊僀儞, 0)
                                            If rgn <> 0 Then gggint = DeleteObject(rgn)
                                            'End If
                                        End If
                                    End With

                                End If
                            Next
                            g1.ReleaseHdc(HDC儊僀儞)
                        End If
                    End If
                    '------------------------------------------------------------------
                    If h僽儔僔僎乕儉攝怓奜榞 <> 0 Then
                        For a = 1 To p尰嵼偺僇乕僪枃悢
                            n = m昤夋専嵏攝楍(a)
                            If n <> 徚偡CardID Or (CallTyp = 2 And n = 徚偡CardID) Then
                                With m僇乕僪攝楍(n)
                                    If (.DoDraw Or CallTyp = 0) And (Not .摉傝嶍彍偢傒) Then    'If CurAllDraw Or ((.DoDraw) And (Not .摉傝嶍彍偢傒)) Then  '
                                        '僇乕僪偑堦抳偟偨応強偺昤夋
                                        If 徚偡CardID > 0 And 徚偡CardRgn <> 0 Then
                                            If 徚偡CardID = n Then
                                                rgn = .儕乕僕儑儞
                                            Else
                                                rgn = CreateRectRgn(0, 0, 1, 1)
                                                gggint = CombineRgn(rgn, 徚偡CardRgn, .儕乕僕儑儞, RGN_AND)
                                            End If
                                        Else
                                            rgn = .儕乕僕儑儞
                                        End If
                                        '------------------------------------------------------------------
                                        '2022/09/16  昤夋僗僺乕僪偑抶傟傞  娭悢屇傃弌偟偼丂僟儊丂!!!!!!!!!!!!!!!!!!!!!!
                                        'gggbol = 嘳ImageDrawByGraphics_With_Set_GDIrgn(g1, frmMain.pctBmp.Image, rgn, .幚悺椞堟, m僇乕僪攝楍(.夋慺僇乕僪ID).幚悺椞堟)
                                        'qqqqq("call 嘳ImageDrawByGraphics_With_Set_GDIrgn() in loop Cardidx = " + CStr(n))
                                        '2022/09/16  昤夋僗僺乕僪偑抶傟傞  娭悢屇傃弌偟偼丂僟儊丂!!!!!!!!!!!!!!!!!!!!!!
                                        '------------------------------------------------------------------
                                        rrggnn = Region.FromHrgn(rgn)
                                        g1.SetClip(rrggnn, CombineMode.Replace)
                                        gggbol = 嘳ImageDrawByGraphics(g1, frmMain.pctBmp.Image, .幚悺椞堟, m僇乕僪攝楍(.夋慺僇乕僪ID).幚悺椞堟)
                                        rrggnn.Dispose()
                                        '------------------------------------------------------------------
                                        Dim HDC儊僀儞 As Integer = g1.GetHdc
                                        If HDC儊僀儞 <> 0 Then
                                            gggint = SelectClipRgn(HDC儊僀儞, rgn)   '2022/08/01 僼儗乕儉昤夋偱偺丂懠偺僇乕僪撪傊偺丂忋彂偒嬛巭偺丂僋儕僢僾儕乕僕儑儞傪愝掕偡傞
                                            If .儕乕僕儑儞榞 <> 0 Then
                                                gggint = FillRgn(HDC儊僀儞, .儕乕僕儑儞榞, h僽儔僔僎乕儉攝怓奜榞)
                                            Else
                                                gggint = FrameRgn(HDC儊僀儞, .儕乕僕儑儞, h僽儔僔僎乕儉攝怓奜榞, .僇乕僪榞暆, .僇乕僪榞暆)
                                            End If
                                            gggint = FrameRgn(HDC儊僀儞, .儕乕僕儑儞, GetStockObject(BLACK_BRUSH), 1, 1)
                                            gggint = SelectClipRgn(HDC儊僀儞, 0)
                                            g1.ReleaseHdc(HDC儊僀儞) : HDC儊僀儞 = 0
                                        End If
                                        '------------------------------------------------------------------
                                        rgn = 0
                                        .DoDraw = False
                                        偙偙偱昤夋偟偨枃悢 = 偙偙偱昤夋偟偨枃悢 + 1
                                    End If
                                End With
                            End If
                        Next
                    End If
                    '------------------------------------------------------------------
                    'qqqqq("zz僇乕僪昤夋() 昤夋悢=" + CStr(偙偙偱昤夋偟偨枃悢) + vbCrLf)
                    RET = True
                    '------------------------------------------------------------------
                End If
                '------------------------------------------------------------------
            Catch ex As Exception
                qqqqq("ERROR in zz僇乕僪昤夋()" + vbCrLf + ex.ToString)
                RET = False
            End Try
            If g1 IsNot Nothing Then g1.Dispose()
            gggint = DeleteObject(h僽儔僔僎乕儉攝怓奜榞)
            gggint = DeleteObject(h僽儔僔敳偗攚宨)
            Return RET
        End If
    End Function

    Private Function zz巆傝僇乕僪偑側偄() As Boolean
        zz巆傝僇乕僪偑側偄 = (aa巆傝僇乕僪枃悢() = 0)
    End Function

    Private Function zz儕乕僕儑儞僨乕僞乕嶍彍(ByRef dd As type僇乕僪乕僨乕僞乕) As Boolean
        With dd
            If .儕乕僕儑儞 <> 0 Then gggint = DeleteObject(.儕乕僕儑儞)
            If .儕乕僕儑儞榞 <> 0 Then gggint = DeleteObject(.儕乕僕儑儞榞)
            .儕乕僕儑儞 = 0
            .儕乕僕儑儞榞 = 0
        End With
        Return True
    End Function

    Private Function zz僇乕僪宆僨乕僞乕偼摍偟偄(ByRef cd1 As type僇乕僪宆, ByRef cd2 As type僇乕僪宆) As Boolean
        Dim a, m As Integer
        zz僇乕僪宆僨乕僞乕偼摍偟偄 = False
        With cd1
            If .儊僯儏乕僞僀僩儖 <> cd2.儊僯儏乕僞僀僩儖 Then Exit Function
            If .儊僯儏乕偵昞帵 <> cd2.儊僯儏乕偵昞帵 Then Exit Function
            If .廲墶斾棪 <> cd2.廲墶斾棪 Then Exit Function
            If .婎弨偺攞悢抣墶 <> cd2.婎弨偺攞悢抣墶 Then Exit Function
            If .婎弨偺攞悢抣廲 <> cd2.婎弨偺攞悢抣廲 Then Exit Function
            If .億儕僑儞梫慺悢 <> cd2.億儕僑儞梫慺悢 Then Exit Function
            '--------------------------------------------------
            '2016/10/15  error 掶惓
            m = UBound(cd2.億儕僑儞)
            For a = 0 To m
                If .億儕僑儞(a).X <> cd2.億儕僑儞(a).X Then Exit Function
                If .億儕僑儞(a).Y <> cd2.億儕僑儞(a).Y Then Exit Function
            Next
            '--------------------------------------------------
        End With
        zz僇乕僪宆僨乕僞乕偼摍偟偄 = True
    End Function

    Private Function zz僇乕僪宆僞僀僾僐僺乕(ByRef uke As type僇乕僪宆, ByRef oku As type僇乕僪宆) As Boolean
        Dim a, m As Integer
        With uke
            .儊僯儏乕僞僀僩儖 = oku.儊僯儏乕僞僀僩儖
            .儊僯儏乕偵昞帵 = oku.儊僯儏乕偵昞帵
            .廲墶斾棪 = oku.廲墶斾棪
            .婎弨偺攞悢抣墶 = oku.婎弨偺攞悢抣墶
            .婎弨偺攞悢抣廲 = oku.婎弨偺攞悢抣廲
            .億儕僑儞梫慺悢 = oku.億儕僑儞梫慺悢
            '--------------------------------------------------
            '2016/10/15  error 掶惓
            m = UBound(oku.億儕僑儞)
            ReDim .億儕僑儞(m)
            For a = 0 To m : .億儕僑儞(a).X = oku.億儕僑儞(a).X : .億儕僑儞(a).Y = oku.億儕僑儞(a).Y : Next
            '--------------------------------------------------
        End With
        Return True
    End Function

    Private Function zzErrorAppEnd() As Boolean
        gm傾僾儕廔椆偡傞 = True
        Call aa僎乕儉僋儕傾(False)
        gggint = MsgBox("儕僜乕僗妋曐偺僄儔乕偑敪惗偟傑偟偨丅丂偙偺傾僾儕傪廔椆偟傑偡丅" & vbCrLf & vbCrLf & "昁梫偱偁傟偽丄偙偺傾僾儕傪嵞婲摦偟偰偔偩偝偄丅", MsgBoxStyle.OkOnly, frmMain.Text)
        End
        Return False
    End Function
#End Region

#Region "僞僀儅乕偱偺夋憸帺摦愗傝懼偊"
    '***********************************************************************
    Friend Function p僎乕儉梡僼傽僀儖偺愗傝懼偊_僞僀儉僇僂儞僩僆乕僶乕() As Boolean
        Return CBool(p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(67021))
    End Function
    Friend Function p僎乕儉梡僼傽僀儖偺愗傝懼偊_師偺夋憸偵_嫮惂揑偵() As Boolean
        p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 = 10000000
        Call DlgFile僎乕儉梡.tim愗傝懼偊僞僀儅乕_Tick(Nothing, Nothing)
        Return True
    End Function
    Friend Property p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
        Get
            Return CBool(p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(20050, ""))
        End Get
        Set(ByVal Value As Boolean)
            Call p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(200100, CStr(Value))
        End Set
    End Property
    Friend Property p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩() As Integer
        Get
            Return CInt(p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(123400, ""))
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(123500, CStr(Value))
        End Set
    End Property
    Friend Function aa_mn1game僎乕儉夋憸偺愗傝懼偊帪娫娫妘Do_Click(ByRef Index As Integer) As String
        Return p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷MenuClick, CStr(Index))
    End Function
    Friend Property p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘() As Integer
        Get
            Return CInt(p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉梡僼傽僀儖偺愗傝懼偊帪娫娫妘" : Const 抣DEF As Integer = 60 : Static 抣 As Integer : Dim 抣old As Integer
        Static 壓, 忋 As Integer : Static 儊僰() As ToolStripMenuItem
        '--------------------------------------------------------------------------------------------
        Static 愗懼僇僂儞僩昩悢尰嵼 As Integer = 0 ' Static DTM As DateTime
        '--------------------------------------------------------------------------------------------
        '幚嵺偺巊梡僨乕僞乕丂20 - 300丂昩扨埵
        Const m1 As String = "20" : Const m2 As String = "60" : Const m3 As String = "120" : Const m4 As String = "300" : Const 柍偟娫妘 As String = "1000000"
        ''--------------------------------------------------------------------------------------------
        ''僥僗僩偵偺傒巊梡偡傞僨乕僞乕
        'Const m1 = "3", m2 = "6", m3 = "10", m4 = "20", 柍偟娫妘 = "1000000"
        '--------------------------------------------------------------------------------------------
        抣old = 抣
        '--------------------------------------------------------------------------------------------
        Select Case 僾儘僷僐儅儞僪
            Case 67021  'p僎乕儉梡僼傽僀儖偺愗傝懼偊_僞僀儉僇僂儞僩僆乕僶乕() 
                Return CStr(抣 > 1000)
                '-----------------------------------------------------
            Case 123400 'GET   p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                'qqqqq(CStr(愗懼僇僂儞僩昩悢尰嵼))
                Return CStr(愗懼僇僂儞僩昩悢尰嵼)
            Case 123500 'SET   p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                愗懼僇僂儞僩昩悢尰嵼 = CInt(s)

                ''-----------------------------------------------------
                ''2022/11/27 埲壓偼丄儅僂僗偱僇乕僪傪堏摦拞偺帪娫傕僇僂儞僩偡傞傛偆偵偟偨偑丄僼傽僀儖僟僀傾儘僌僂僀儞僪僂偑昞帵偝傟偰偄傞娫傕僇僂儞僩偝傟偰偟傑偆偺偱丄拞巭丅
                ''-----------------------------------------------------
                '    '2022/11/26 new 儅僂僗憖嶌側偳偱丄僞僀儅乕偺僀儀儞僩偑敳偗偰傕丄惓偟偄宱夁帪娫傪庢傝弌偡丅
                'Case 20050 'GET  p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                '    'If 愗懼僇僂儞僩昩悢尰嵼 = 0 Then
                '    '    Dim a As Integer = 嘳僞僀儉_宱夁帪娫_昩悢(0, DTM)
                '    '    愗懼僇僂儞僩昩悢尰嵼 = 1
                '    '    Return CStr(False)
                '    'Else
                '    '    愗懼僇僂儞僩昩悢尰嵼 = 嘳僞僀儉_宱夁帪娫_昩悢(1, DTM)
                '    '    qqqqq(CStr(愗懼僇僂儞僩昩悢尰嵼))
                '    '    Dim bol As Boolean = (愗懼僇僂儞僩昩悢尰嵼 >= 抣)
                '    '    If bol Then 愗懼僇僂儞僩昩悢尰嵼 = 0
                '    '    Return CStr(bol)
                '    'End If

                '-----------------------------------------------------
            Case 20050 'GET  p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                愗懼僇僂儞僩昩悢尰嵼 = 愗懼僇僂儞僩昩悢尰嵼 + 1
                'qqqqq(CStr(愗懼僇僂儞僩昩悢尰嵼))
                Dim bol As Boolean = (愗懼僇僂儞僩昩悢尰嵼 >= 抣)
                If bol Then 愗懼僇僂儞僩昩悢尰嵼 = 0
                Return CStr(bol)
                '-----------------------------------------------------
            Case 200100 'SET  p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                愗懼僇僂儞僩昩悢尰嵼 = 抣 + 10
                '-----------------------------------------------------
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = 抣DEF
                Call frmMain.aa儊僯儏乕僆僽僕僃愝掕(PropName, 儊僰, 壓, 忋) : 儊僰(1).Tag = m1 : 儊僰(2).Tag = m2 : 儊僰(3).Tag = m3 : 儊僰(4).Tag = m4 : 儊僰(5).Tag = 柍偟娫妘
                愗懼僇僂儞僩昩悢尰嵼 = 0
            Case gco僾儘僷Get
                Return CStr(抣)
            Case gco僾儘僷Let
                抣 = 嘳悢抣斖埻Int(Val(m1), Val(柍偟娫妘), Val(s))
            Case gco僾儘僷MenuClick
                Select Case Val(s) : Case 1 : 抣 = Val(m1) : Case 2 : 抣 = Val(m2) : Case 3 : 抣 = Val(m3) : Case 4 : 抣 = Val(m4) : Case Else : 抣 = Val(柍偟娫妘) : End Select
                抣 = 嘳悢抣斖埻Int(Val(m1), Val(柍偟娫妘), 抣)
                愗懼僇僂儞僩昩悢尰嵼 = 0
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                抣 = Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷MenuClick
                Try
                    Dim a As Integer : Dim cap As String = ""
                    For a = 壓 To 忋
                        儊僰(a).Checked = (抣 = Val(儊僰(a).Tag))
                        If 儊僰(a).Checked Then cap = 儊僰(a).Text
                    Next
                Catch
                End Try
        End Select
        '--------------------------------------------------------------------------------------------
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷Let, gco僾儘僷MenuClick 'p僞僀儅乕偱偺夋憸帺摦愗傝懼偊_ChkStart_On_AppStart
                If 抣old <> 抣 Then
                    Dim ret As Boolean = False
                    gggbol = 僀儀儞僩gAppEventMaker.MakeEvent夋憸愗傝懼偊僞僀儅乕偺僆儞僆僼(gmDlgFile僎乕儉梡, (抣 < Val(柍偟娫妘)), ret)
                End If
        End Select
        '--------------------------------------------------------------------------------------------
        Return CStr(抣)
    End Function
#End Region

#Region "僾儘僷僥傿嫟捠"
    '***********************************************************************
    Friend Function p僇乕僪枃悢_尰嵼偺巆傝枃悢() As Integer
        Return aa巆傝僇乕僪枃悢()
    End Function
    Friend Function mn1game僇乕僪枃悢巜掕Do_Enabled愝掕() As String
        Return p尰嵼偺僇乕僪枃悢_RW(371)
    End Function
    Friend Function mn1game僇乕僪枃悢巜掕DoNextUp() As String
        Return p尰嵼偺僇乕僪枃悢_RW(10)
    End Function
    Friend ReadOnly Property p尰嵼偺僇乕僪枃悢MenuIndex() As Integer
        Get
            p尰嵼偺僇乕僪枃悢MenuIndex = CInt(p尰嵼偺僇乕僪枃悢_RW(1010365))
        End Get
    End Property
    Friend Property p尰嵼偺僇乕僪枃悢() As Integer
        Get
            p尰嵼偺僇乕僪枃悢 = CInt(p尰嵼偺僇乕僪枃悢_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p尰嵼偺僇乕僪枃悢_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p尰嵼偺僇乕僪枃悢_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p尰嵼偺僇乕僪枃悢" : Const 抣DEF As Integer = 81 : Static 抣 As Integer
        Static 壓, 忋 As Integer : Static 儊僰() As ToolStripMenuItem
        Dim a, b, c As Integer : Dim e As Boolean
        'With frmMain
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = 抣DEF : Call frmMain.aa儊僯儏乕僆僽僕僃愝掕(PropName, 儊僰, 壓, 忋)
            Case gco僾儘僷Get
                Return CStr(抣)
            Case gco僾儘僷Let 's = 枃悢偺幚悢抣
                c = 嘳悢抣斖埻Int(app嵟彫僇乕僪枃悢, app嵟戝僇乕僪枃悢, Val(s))
                抣 = c
                For a = 壓 To 忋
                    b = Val(儊僰(a).Tag)
                    If c <= b Then
                        抣 = b : Exit For
                    End If
                Next
            Case gco僾儘僷MenuClick '.mn1game僇乕僪枃悢巜掕Do_Click()丂    s = 儊僯儏乕偺僀儞僨僢僋僗
                '2019/09/24  尰嵼偺慖戰枃悢偱僇乕僪傪攝傞
                If Val(s) = -1 Then
                    For a = 壓 To 忋
                        If 儊僰(a).Checked Then
                            s = CStr(a) : Exit For
                        End If
                    Next
                    If Val(s) = -1 Then s = CStr(1)
                End If
                p尰嵼偺僇乕僪枃悢 = Val(儊僰(嘳悢抣斖埻Int(壓, 忋, Val(s))).Tag)

                '***********************************************************************
                '僎乕儉奐巒偺僗僞乕僩億僀儞僩
                e = aa僇乕僪偺攝抲偲嵞昤夋(1)
                '僎乕儉奐巒偺僗僞乕僩億僀儞僩
                '***********************************************************************
                gmDlg僎乕儉僇乕僪宆傪愝掕_偼_僎乕儉奐巒帪偵偼昞帵偝傟偰偄傞 = False
                '***********************************************************************

            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                p尰嵼偺僇乕僪枃悢 = Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))

            Case 1010365 'p尰嵼偺僇乕僪枃悢MenuIndex   add 2022/05/07
                Try
                    For a = 壓 To 忋
                        If 儊僰(a).Checked Then
                            Return CStr(a) : Exit For
                        End If
                    Next
                Catch
                    Return "2"
                End Try

        End Select
        'End With
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, 10
                Try
                    For a = 壓 To 忋 : 儊僰(a).Checked = (抣 = Val(儊僰(a).Tag)) : Next
                Catch : End Try
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend ReadOnly Property p僎乕儉攝怓奜榞DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓奜榞_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僎乕儉攝怓奜榞() As Integer
        Get
            Return CInt(p僎乕儉攝怓奜榞_RW(gco僾儘僷Get))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓奜榞_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Friend Function p僎乕儉攝怓奜榞_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉攝怓奜榞" : Const 抣DEF As Integer = &HFF0060& : Static 抣 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(s)))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CInt(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷Let
                If pp僗僀僗僀僼儔僼儔_偄偢傟傕掆巭偟偰偄傞 And pp僎乕儉幚峴拞 Then Call aa僇乕僪偺攝抲偲嵞昤夋(3)
        End Select
        Return ""
    End Function

    Friend ReadOnly Property p僎乕儉攝怓奜榞僪儔僢僌DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓奜榞僪儔僢僌_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僎乕儉攝怓奜榞僪儔僢僌() As Integer
        Get
            Return CInt(p僎乕儉攝怓奜榞僪儔僢僌_RW(gco僾儘僷Get))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓奜榞僪儔僢僌_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Friend Function p僎乕儉攝怓奜榞僪儔僢僌_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉攝怓奜榞僪儔僢僌" : Const 抣DEF As Integer = &HFFE0& : Static 抣 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(s)))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CInt(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Return ""
    End Function

    Friend ReadOnly Property p僎乕儉攝怓敳偗攚宨DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓敳偗攚宨_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僎乕儉攝怓敳偗攚宨() As Integer
        Get
            Return CInt(p僎乕儉攝怓敳偗攚宨_RW(gco僾儘僷Get))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓敳偗攚宨_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Friend Function p僎乕儉攝怓敳偗攚宨_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉攝怓敳偗攚宨" : Const 抣DEF As Integer = &H408020& : Static 抣 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(s)))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CInt(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷iniRD, gco僾儘僷Let
                'If frmMain.pnl壖昞帵 IsNot Nothing Then
                '    frmMain.pnl壖昞帵.BackColor = 嘳Color峔憿懱_from_怓抣(抣)
                'End If
                If pp僎乕儉幚峴拞 Then
                    frmMain.Invalidate()
                    frmMain.Refresh()
                End If
        End Select
        Return ""
    End Function
    '***********************************************************************
    Friend Function p僇乕僪堦抳偱斀揮偡傞_ListBox弶婜壔(ByRef lst As ListBox) As Boolean
        Dim a As Integer
        With lst
            .Items.Clear() : For a = 0 To 1 : .Items.Add(p僇乕僪堦抳偱斀揮偡傞_RW(100 + a)) : Next
            .SelectedIndex = p僇乕僪堦抳偱斀揮偡傞
        End With
        Return True
    End Function
    Friend ReadOnly Property p僇乕僪堦抳偱斀揮偡傞DEF() As Integer
        Get
            Return CInt(p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僇乕僪堦抳偱斀揮偡傞BOOL() As Boolean
        Get
            Return (0 = CInt(p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷Get)))
        End Get
        Set(ByVal value As Boolean)
            Call p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷Let, IIf(value, "0", "1"))
        End Set
    End Property
    Friend Property p僇乕僪堦抳偱斀揮偡傞() As Integer
        Get
            Return CInt(p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷Get))
        End Get
        Set(ByVal value As Integer)
            Call p僇乕僪堦抳偱斀揮偡傞_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Private Function p僇乕僪堦抳偱斀揮偡傞_RW(ByVal 僾儘僷僐儅儞僪 As Integer, Optional ByVal s As String = "") As String
        Const PropName As String = "p僇乕僪堦抳偱斀揮偡傞" : Const 抣DEF As Integer = 0 : Const 壓 As Integer = 0 : Const 忋 As Integer = 1   '0, 1
        Static ListItemText() As String = {"偡傞", "偟側偄"}
        Static 抣 As Integer : Dim 媽抣 As Integer, a As Integer
        媽抣 = 抣
        Select Case 僾儘僷僐儅儞僪
            Case 100 To 101 : a = 僾儘僷僐儅儞僪 - 100 : Return ListItemText(a)
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let, gco僾儘僷MenuClick : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(s))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Function p僇乕僪堏摦偺婳愓傪巆偡_ListBox弶婜壔(ByRef lst As ListBox) As Boolean
        Dim a As Integer
        With lst
            .Items.Clear() : For a = 0 To 1 : .Items.Add(p僇乕僪堏摦偺婳愓傪巆偡_RW(100 + a)) : Next
            .SelectedIndex = p僇乕僪堏摦偺婳愓傪巆偡
        End With
        Return True
    End Function
    Friend ReadOnly Property p僇乕僪堏摦偺婳愓傪巆偡DEF() As Integer
        Get
            Return CInt(p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僇乕僪堏摦偺婳愓傪巆偡BOOL() As Boolean
        Get
            Return (0 = CInt(p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷Get)))
        End Get
        Set(ByVal value As Boolean)
            Call p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷Let, IIf(value, "0", "1"))
        End Set
    End Property
    Friend Property p僇乕僪堏摦偺婳愓傪巆偡() As Integer
        Get
            Return CInt(p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷Get))
        End Get
        Set(ByVal value As Integer)
            Call p僇乕僪堏摦偺婳愓傪巆偡_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Private Function p僇乕僪堏摦偺婳愓傪巆偡_RW(ByVal 僾儘僷僐儅儞僪 As Integer, Optional ByVal s As String = "") As String
        Const PropName As String = "p僇乕僪堏摦偺婳愓傪巆偡" : Const 抣DEF As Integer = 0 : Const 壓 As Integer = 0 : Const 忋 As Integer = 1   '0, 1
        Static ListItemText() As String = {"偡傞", "偟側偄"}
        Static 抣 As Integer : Dim 媽抣 As Integer, a As Integer
        媽抣 = 抣
        Select Case 僾儘僷僐儅儞僪
            Case 100 To 101 : a = 僾儘僷僐儅儞僪 - 100 : Return ListItemText(a)
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let, gco僾儘僷MenuClick : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(s))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Sub p僎乕儉梡僼傽僀儖偺柧傞偝ListBox偵愝掕(ByRef box As ListBox)
        If box IsNot Nothing Then box.SelectedIndex = 嘳悢抣斖埻Int(-1, box.Items.Count - 1, p僎乕儉梡僼傽僀儖偺柧傞偝)
    End Sub
    Friend Sub p僎乕儉梡僼傽僀儖偺柧傞偝ListBox偐傜撉弌偟(ByRef box As ListBox)
        If box IsNot Nothing Then p僎乕儉梡僼傽僀儖偺柧傞偝 = box.SelectedIndex
    End Sub
    Friend Function p僎乕儉梡僼傽僀儖偺柧傞偝幚岠抣(ByVal Idx As Integer) As Single '僀儞僨僢僋僗 0 - 5 偐傜幚嵺偺抣  Single 0.6 - 1.6 傪曉偡丅
        Return CSng(p僎乕儉梡僼傽僀儖偺柧傞偝_RW(gco僾儘僷Get尰嵼偺幚岠抣傪, CStr(Idx)))
    End Function
    Friend ReadOnly Property p僎乕儉梡僼傽僀儖偺柧傞偝DEF() As Integer
        Get
            Return CInt(p僎乕儉梡僼傽僀儖偺柧傞偝_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僎乕儉梡僼傽僀儖偺柧傞偝() As Integer  'index 0 to 5
        Get
            Return CInt(p僎乕儉梡僼傽僀儖偺柧傞偝_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉梡僼傽僀儖偺柧傞偝_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僎乕儉梡僼傽僀儖偺柧傞偝_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉梡僼傽僀儖偺柧傞偝" : Const idxMAX As Integer = 5 : Const idxDEF As Integer = 3 : Static 抣(idxMAX) As Single : Static idx尰嵼 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣(0) = 0.6 : 抣(1) = 0.8 : 抣(2) = 1.0 : 抣(3) = 1.2 : 抣(4) = 1.4 : 抣(5) = 1.6 : idx尰嵼 = idxDEF
            Case gco僾儘僷婯掕抣 : Return CStr(idxDEF)
            Case gco僾儘僷Get : Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
            Case gco僾儘僷Let : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX
            Case gco僾儘僷MenuClick : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(idx尰嵼))
            Case gco僾儘僷iniRD : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))) '0 - idxMAX
            Case gco僾儘僷Get尰嵼偺幚岠抣傪 : Return CStr(抣(嘳悢抣斖埻Int(0, idxMAX, Val(s))))  '僀儞僨僢僋僗偐傜幚嵺偺抣  Single 0.6 - 1.6 傪曉偡丅
        End Select
        Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
    End Function
    '***********************************************************************
    Friend Sub p僇乕僪僒僀僘榞偺懢偝ListBox偵愝掕(ByRef box As ListBox)
        If box IsNot Nothing Then box.SelectedIndex = 嘳悢抣斖埻Int(-1, box.Items.Count - 1, p僇乕僪僒僀僘榞偺懢偝)
    End Sub
    Friend Sub p僇乕僪僒僀僘榞偺懢偝ListBox偐傜撉弌偟(ByRef box As ListBox)
        If box IsNot Nothing Then p僇乕僪僒僀僘榞偺懢偝 = box.SelectedIndex
    End Sub
    Friend Function p僇乕僪僒僀僘榞偺懢偝幚岠抣(ByVal Idx As Integer) As Single '僀儞僨僢僋僗 0 - 5 偐傜幚嵺偺抣  Single 0.02 - 0.06 傪曉偡丅
        Return CSng(p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷Get尰嵼偺幚岠抣傪, CStr(Idx)))
    End Function
    Friend Function p僇乕僪僒僀僘榞偺懢偝幚岠抣_尰嵼() As Single              '尰嵼偺僀儞僨僢僋僗愝掕偺丂幚嵺偺抣  Single 0.02 - 0.06 傪曉偡丅
        Return CSng(p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷Get尰嵼偺幚岠抣傪, CStr(p僇乕僪僒僀僘榞偺懢偝)))
    End Function
    Friend ReadOnly Property p僇乕僪僒僀僘榞偺懢偝DEF() As Integer
        Get
            Return CInt(p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僇乕僪僒僀僘榞偺懢偝() As Integer
        Get
            Return CInt(p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僇乕僪僒僀僘榞偺懢偝_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僇乕僪僒僀僘榞偺懢偝_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        'val 0.02 - 0.06  Index 0 - 4
        Const PropName As String = "p僇乕僪僒僀僘榞偺懢偝" : Const idxMAX As Integer = 4 : Const idxDEF As Integer = 2 : Static 抣(idxMAX) As Single : Static idx尰嵼 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣(0) = 0.02 : 抣(1) = 0.03 : 抣(2) = 0.04 : 抣(3) = 0.05 : 抣(4) = 0.06 : idx尰嵼 = idxDEF
            Case gco僾儘僷婯掕抣 : Return CStr(idxDEF)
            Case gco僾儘僷Get : Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
            Case gco僾儘僷Let : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX 
            Case gco僾儘僷MenuClick : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX  
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(idx尰嵼))
            Case gco僾儘僷iniRD : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))) '0 - idxMAX 
            Case gco僾儘僷Get尰嵼偺幚岠抣傪 : Return CStr(抣(嘳悢抣斖埻Int(0, idxMAX, Val(s)))) '僀儞僨僢僋僗偐傜幚嵺偺抣  Integer 0.02 - 0.06 傪曉偡丅
        End Select
        Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
    End Function
    '***********************************************************************
    Friend Sub p僇乕僪僗僺乕僪ListBox偵愝掕(ByRef box As ListBox)
        If box IsNot Nothing Then box.SelectedIndex = 嘳悢抣斖埻Int(-1, box.Items.Count - 1, p僇乕僪僗僺乕僪)
    End Sub
    Friend Sub p僇乕僪僗僺乕僪ListBox偐傜撉弌偟(ByRef box As ListBox)
        If box IsNot Nothing Then p僇乕僪僗僺乕僪 = box.SelectedIndex
    End Sub
    Friend Function p僇乕僪僗僺乕僪幚岠抣(ByVal Idx As Integer) As Integer '僀儞僨僢僋僗 0 - 4 偐傜幚嵺偺抣  Integer 50 - 10 傪曉偡丅
        Return CInt(p僇乕僪僗僺乕僪_RW(gco僾儘僷Get尰嵼偺幚岠抣傪, CStr(Idx)))
    End Function
    Friend ReadOnly Property p僇乕僪僗僺乕僪DEF() As Integer
        Get
            Return CInt(p僇乕僪僗僺乕僪_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僇乕僪僗僺乕僪() As Integer
        Get
            Return CInt(p僇乕僪僗僺乕僪_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僇乕僪僗僺乕僪_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僇乕僪僗僺乕僪_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僇乕僪僗僺乕僪" : Const idxMAX As Integer = 4 : Const idxDEF As Integer = 2 : Static 抣(idxMAX) As Integer : Static idx尰嵼 As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣(0) = 50 : 抣(1) = 40 : 抣(2) = 30 : 抣(3) = 20 : 抣(4) = 10 : idx尰嵼 = idxDEF
            Case gco僾儘僷婯掕抣 : Return CStr(idxDEF)
            Case gco僾儘僷Get : Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
            Case gco僾儘僷Let : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX  
            Case gco僾儘僷MenuClick : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(s)) '0 - idxMAX 
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(idx尰嵼))
            Case gco僾儘僷iniRD : idx尰嵼 = 嘳悢抣斖埻Int(0, idxMAX, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))) '0 - idxMAX 
            Case gco僾儘僷Get尰嵼偺幚岠抣傪 : Return CStr(抣(嘳悢抣斖埻Int(0, idxMAX, Val(s)))) '僀儞僨僢僋僗偐傜幚嵺偺抣  Integer 50 - 10 傪曉偡丅
        End Select
        Return CStr(嘳悢抣斖埻Int(0, idxMAX, idx尰嵼))
    End Function
    '***********************************************************************
    Friend Sub p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞CheckBox偵愝掕(ByRef box As CheckBox)
        If box IsNot Nothing Then box.Checked = p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞
    End Sub
    Friend Sub p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞CheckBox偐傜撉弌偟(ByRef box As CheckBox)
        If box IsNot Nothing Then p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞 = box.Checked
    End Sub
    Friend Property p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞() As Boolean
        Get
            Return CBool(p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Boolean)
            Call p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僒僂儞僪僼傽僀儖傪弴師曄峏偡傞" : Const 抣DEF As Boolean = True : Static 抣 As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CBool(s)
            Case gco僾儘僷MenuClick : 抣 = Not 抣
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CBool(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Return CStr(抣)
    End Function
    Private Function p僒僂儞僪僼傽僀儖偺攝楍_NEXT() As String
        Dim Ary() As String = {""}, sss As String = ""
        Return p僒僂儞僪僼傽僀儖偺攝楍_RW(102030, Ary, sss)
    End Function
    Friend Function p僒僂儞僪僼傽僀儖偺攝楍_RW(ByVal 僾儘僷僐儅儞僪 As Integer, ByRef rwAry() As String, ByVal rAryDataStr As String) As String
        Const PropName As String = "p僒僂儞僪僼傽僀儖偺攝楍" : Const cut = "|**|"
        Static 抣() As String = {""}     'Use  抣( 1 to ubound )
        Static CurIDX As Integer = 0      '( 1 to ubound )
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷GetARY
                If Not 嘳暥攝楍偺僐僺乕(rwAry, 抣) Then Return ""
                Return CStr(UBound(抣))
            Case gco僾儘僷LetARY
                If Not 嘳暥攝楍偺僐僺乕(抣, rwAry) Then Return ""
                Return CStr(UBound(抣))
            Case gco僾儘僷convARYtoSTR
                Dim sss As String = 嘳暥傪攝楍偐傜嶌惉(抣, cut)
                Return sss
            Case gco僾儘僷convSTRtoARY
                Dim max As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(rAryDataStr, cut, rwAry)
                Return CStr(max)
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                ReDim 抣(1) : 抣(1) = p僒僂儞僪僼傽僀儖
            Case gco僾儘僷iniWR
                Dim w As String = p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷convARYtoSTR, 抣, "")
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, w)

                '*************************************************************************************
            Case gco僾儘僷iniRD
                Dim w As String = 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, rAryDataStr)
                If InStr(w, ":\") = 0 Then
                    w = p僒僂儞僪僼傽僀儖DEF
                End If
                Return p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷convSTRtoARY, 抣, w)

            Case 102030  'p僒僂儞僪僼傽僀儖偺攝楍_NEXT()
                If UBound(抣) < 1 Then
                    Call p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷弶婜壔, gggstrary, "")
                End If
                CurIDX = CurIDX + 1
                If CurIDX > UBound(抣) Then CurIDX = 1
                Return 抣(CurIDX)
                '*************************************************************************************

        End Select
        Return ""
    End Function
    Friend ReadOnly Property p僒僂儞僪僼傽僀儖DEF() As String
        Get
            Return p僒僂儞僪僼傽僀儖_RW(gco僾儘僷婯掕抣)
        End Get
    End Property
    Friend Property p僒僂儞僪僼傽僀儖() As String
        Get
            Return p僒僂儞僪僼傽僀儖_RW(gco僾儘僷Get)
        End Get
        Set(ByVal value As String)
            Call p僒僂儞僪僼傽僀儖_RW(gco僾儘僷Let, CStr(value))
        End Set
    End Property
    Friend Function p僒僂儞僪僼傽僀儖_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僒僂儞僪僼傽僀儖" : Static 抣 As String
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = gm僒僂儞僪偁偨傝
            Case gco僾儘僷婯掕抣
                Return gm僒僂儞僪偁偨傝
            Case gco僾儘僷Get
                If 抣 = "" Then 抣 = gm僒僂儞僪偁偨傝
                Return 抣
            Case gco僾儘僷Let
                抣 = s
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, 抣)
            Case gco僾儘僷iniRD
                抣 = 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)
        End Select
        If Not 嘳僼傽僀儖偼懚嵼(抣) Then
            抣 = gm僒僂儞僪偁偨傝
        End If
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Sub p僒僂儞僪傪柭傜偡CheckBox偵愝掕(ByRef box As CheckBox)
        If box IsNot Nothing Then box.Checked = p僒僂儞僪傪柭傜偡
    End Sub
    Friend Sub p僒僂儞僪傪柭傜偡CheckBox偐傜撉弌偟(ByRef box As CheckBox)
        If box IsNot Nothing Then p僒僂儞僪傪柭傜偡 = box.Checked
    End Sub
    Friend ReadOnly Property p僒僂儞僪傪柭傜偡DEF() As Boolean
        Get
            Return CBool(p僒僂儞僪傪柭傜偡_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僒僂儞僪傪柭傜偡() As Boolean
        Get
            Return CBool(p僒僂儞僪傪柭傜偡_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Boolean)
            Call p僒僂儞僪傪柭傜偡_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p僒僂儞僪傪柭傜偡_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僒僂儞僪傪柭傜偡" : Const 抣DEF As Boolean = True : Static 抣 As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CBool(s)
            Case gco僾儘僷MenuClick : 抣 = Not 抣
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CBool(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
#End Region

#Region "僾儘僷僥傿丂僺僞儁僞丂僆儕僕僫儖"
    '***********************************************************************
    Public Sub mn1game僇乕僪偺廳側傝傪尭傜偡_Click()
        Call p僇乕僪偺廳側傝傪尭傜偡_RW(gco僾儘僷MenuClick)
    End Sub
    Friend Property p僇乕僪偺廳側傝傪尭傜偡() As Boolean
        Get
            Return CBool(p僇乕僪偺廳側傝傪尭傜偡_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Boolean)
            Call p僇乕僪偺廳側傝傪尭傜偡_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function mn1game僇乕僪偺廳側傝傪尭傜偡_CapSet_晄柧() As Boolean
        Call p僇乕僪偺廳側傝傪尭傜偡_RW(612)
    End Function
    Friend Function mn1game僇乕僪偺廳側傝傪尭傜偡_CapSet(ByRef n As Integer) As Boolean
        Call p僇乕僪偺廳側傝傪尭傜偡_RW(614, CStr(n))
    End Function
    Private Function p僇乕僪偺廳側傝傪尭傜偡_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僇乕僪偺廳側傝傪尭傜偡" : Const 抣DEF As Boolean = True
        Static 抣 As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CBool(s)
            Case gco僾儘僷MenuClick
                抣 = Not 抣
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                抣 = CBool(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
            Case 612
                frmMain.mn1game僇乕僪偺廳側傝傪尭傜偡.Text = "僇乕僪偺廳側傝傪尭傜偡丂亅丂廳側傝悢 (      )"
            Case 614
                frmMain.mn1game僇乕僪偺廳側傝傪尭傜偡.Text = "僇乕僪偺廳側傝傪尭傜偡丂亅丂廳側傝悢 ( " & s & " )"
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷Let, gco僾儘僷MenuClick, gco僾儘僷iniRD
                Call mn1game僇乕僪偺廳側傝傪尭傜偡_CapSet_晄柧()
                frmMain.mn1game僇乕僪偺廳側傝傪尭傜偡.Checked = 抣
        End Select
        Return 抣
    End Function
    '***********************************************************************
    Friend Property p僎乕儉僇乕僪偺僒僀僘戝拞彫ListIDX() As Integer
        Get
            Return IIf(CBool(p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷Get)), 0, 1)
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷Let, CStr(IIf(Value = 0, True, False)))
        End Set
    End Property
    Friend ReadOnly Property p僎乕儉僇乕僪偺僒僀僘戝拞彫DEF() As Boolean
        Get
            Return CBool(p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p僎乕儉僇乕僪偺僒僀僘戝拞彫() As Boolean
        Get
            Return CBool(p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Boolean)
            Call p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Private Function p僎乕儉僇乕僪偺僒僀僘戝拞彫_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉僇乕僪偺僒僀僘戝拞彫" : Const 抣DEF As Boolean = True
        Static 抣 As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CBool(s)
            Case gco僾儘僷MenuClick : 抣 = Not 抣
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CBool(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷MenuClick, gco僾儘僷Let  '''''''''''', 393
                If pp僎乕儉幚峴拞 Then
                    Call aa僇乕僪偺攝抲偲嵞昤夋(3, 5)
                End If
        End Select
        Return 抣
    End Function
    '***********************************************************************
    Friend ReadOnly Property p僎乕儉僇乕僪宆偡傋偰偺DEF() As String
        Get
            Return p僎乕儉僇乕僪宆_RW(gco僾儘僷婯掕抣)
        End Get
    End Property
    Friend Function p僎乕儉僇乕僪宆_巊梡拞_僇乕僪宆ID_Ary(ByRef wAry僇乕僪宆ID() As Integer) As Integer
        '攝楍偼侾儀乕僗偱曉偝傟傞偺偱拲堄偡傞偙偲丂丂return wAry僇乕僪宆ID ( 1  to  max )
        Dim sss As String = p僎乕儉僇乕僪宆巊梡拞
        If Left(sss, 1) = 惎 Then sss = Mid(sss, 2)
        Dim ary() As String = {""}
        Dim m As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(sss, 惎, ary)
        ReDim wAry僇乕僪宆ID(m)
        For a As Integer = 1 To m
            wAry僇乕僪宆ID(a) = Val(ary(a))
        Next
        Return m
    End Function
    Friend Function p僎乕儉僇乕僪宆_巊梡拞偱偡(ByRef r僇乕僪宆IDX As Integer) As Boolean
        Return CBool(p僎乕儉僇乕僪宆_RW(30000, CStr(r僇乕僪宆IDX)))
    End Function
    Friend Property p僎乕儉僇乕僪宆巊梡拞() As String
        Get
            Return p僎乕儉僇乕僪宆_RW(gco僾儘僷Get)
        End Get
        Set(ByVal Value As String)
            Call p僎乕儉僇乕僪宆_RW(gco僾儘僷Let, Value)
        End Set
    End Property
    Friend Function p僎乕儉僇乕僪宆_巊梡曄峏(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean) As Boolean
        Return "" <> p僎乕儉僇乕僪宆_RW(31000, p僎乕儉僇乕僪宆_IndexStr_FromAry(rAry僇乕僪_巊梡偡傞側傜True))
    End Function
    Friend Function p僎乕儉僇乕僪宆_IndexStr_FromAry(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean) As String
        Dim a As Integer
        Dim sss As String = 惎
        For a = 0 To UBound(rAry僇乕僪_巊梡偡傞側傜True)
            sss = sss + IIf(rAry僇乕僪_巊梡偡傞側傜True(a), CStr(a) & 惎, "")
        Next
        Return sss
    End Function
    Friend Function p僎乕儉僇乕僪宆_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "", Optional ByRef 儐乕僓乕僇乕僪僞僀僩儖 As String = "") As String
        'Public Const c僇乕僪宆ALLmin As Integer = c挿曽宍  '0
        'Public Const c僇乕僪宆APPmax As Integer = cUFO_宍  '19
        'Private Const c僇乕僪宆USERmin As Integer = cUser0宍 '20
        'Private Const c僇乕僪宆Allmax As Integer = cUser9宍  '29    
        Const PropName As String = "p僎乕儉僇乕僪宆"
        Static 抣 As String '暥帤楍丂"仛0仛3.....仛5仛6仛11仛14仛...16仛"    'c僇乕僪宆ALLmin  to  c僇乕僪宆Allmax
        Dim a As Integer, t As String = ""
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔, gco僾儘僷婯掕抣, 102020, 102030  '僾儘僷弶婜壔  /  抣DEF偡傋偰  /  抣DEF傾僾儕  /  抣DEF儐乕僓乕  /  return  暥帤楍丂".....仛5仛6仛11仛14仛18仛19仛23...."
                Dim bol As Boolean = (僾儘僷僐儅儞僪 = gco僾儘僷弶婜壔) Or (僾儘僷僐儅儞僪 = gco僾儘僷婯掕抣)
                Dim stt As Integer = IIf(bol, c僇乕僪宆ALLmin, IIf(僾儘僷僐儅儞僪 = 102020, c僇乕僪宆ALLmin, c僇乕僪宆USERmin))
                Dim stp As Integer = IIf(bol, c僇乕僪宆Allmax, IIf(僾儘僷僐儅儞僪 = 102020, c僇乕僪宆APPmax, c僇乕僪宆Allmax))
                t = 惎
                For a = stt To stp : t = t & CStr(a) + 惎 : Next
                If 僾儘僷僐儅儞僪 = gco僾儘僷弶婜壔 Then
                    抣 = t
                Else
                    Return t
                End If
            Case gco僾儘僷Get
                Return 抣
            Case gco僾儘僷Let
                抣 = s
                If Len(抣) < 2 Or InStr(抣, 惎) = 0 Then 抣 = p僎乕儉僇乕僪宆偡傋偰偺DEF
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, 抣)
            Case gco僾儘僷iniRD
                gggstr = p僎乕儉僇乕僪宆_RW(gco僾儘僷Let, 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s), "")
            Case 102040  'p僎乕儉僇乕僪宆僞僀僩儖(ByVal 僇乕僪宆IDX As Integer) 僇乕僪宆偺暥帤楍傪曉偡
                a = 嘳悢抣斖埻Int(c僇乕僪宆ALLmin, c僇乕僪宆Allmax, Val(s))
                Return m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖
            Case 202040    'p僎乕儉僇乕僪宆僞僀僩儖儐乕僓             GET  p僎乕儉僇乕僪宆_RW(202040, CStr(僇乕僪宆IDX))
                a = 嘳悢抣斖埻Int(c僇乕僪宆USERmin, c僇乕僪宆Allmax, Val(s))
                Return m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖
            Case 202041    'p僎乕儉僇乕僪宆僞僀僩儖儐乕僓             SET  p僎乕儉僇乕僪宆_RW(202041, CStr(僇乕僪宆IDX), 儐乕僓乕僇乕僪僞僀僩儖)
                a = 嘳悢抣斖埻Int(c僇乕僪宆USERmin, c僇乕僪宆Allmax, Val(s))
                m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖 = Left(儐乕僓乕僇乕僪僞僀僩儖, 16)
            Case 30000     'p僎乕儉僇乕僪宆_巊梡拞偱偡(ByRef r僇乕僪宆IDX As Integer) 
                Return CStr(InStr(惎 + 抣, 惎 + s + 惎) > 0)
            Case 31000     'p僗僀僗僀僇乕僪宆_巊梡曄峏(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean)
                抣 = s
                If Len(抣) < 2 Or InStr(抣, 惎) = 0 Then 抣 = p僎乕儉僇乕僪宆_RW(gco僾儘僷婯掕抣)
        End Select
        Return 抣
    End Function
    '***********************************************************************
    Friend Function p僗僀僗僀僇乕僪宆儕乕僕儑儞傪嶌傞(ByVal op As Integer, ByRef 夋暆 As Integer, ByRef 夋崅 As Integer, ByRef 榞暆幚悺 As Integer, ByRef Rgn夋 As Integer, ByRef Rgn榞 As Integer) As Boolean
        Static curIDX As Integer = 0
        Dim m As Integer, rwAry偡傋偰() As String = {""}, rw巊梡拞(0) As Boolean, rw巊梡僇乕僪孮BKUP As String = ""
        If op < 0 Then  'Reset
            curIDX = -1
        End If
        gggbol = p僗僀僗僀僇乕僪宆_僞僀僩儖_巊梡忬懺(0, rwAry偡傋偰, rw巊梡拞, rw巊梡僇乕僪孮BKUP)
        m = UBound(rw巊梡拞)
        curIDX = curIDX + 1
        If curIDX > m Then curIDX = 0
        Do
            If rw巊梡拞(curIDX) = True Then Exit Do
            curIDX = curIDX + 1
            If curIDX > m Then curIDX = 0
        Loop
        'qqqqq(CStr(curIDX))
        Return aa僇乕僪宆儕乕僕儑儞傪嶌傞(curIDX, (夋暆 + 夋崅) \ 2, 榞暆幚悺, Rgn夋, Rgn榞, 夋暆, 夋崅)
    End Function
    Friend Function p僗僀僗僀僇乕僪宆_巊梡拞偱偡(ByRef r僇乕僪宆IDX As Integer) As Boolean
        Return CBool(p僗僀僗僀僇乕僪宆_RW(30000, CStr(r僇乕僪宆IDX)))
    End Function
    Friend Property p僗僀僗僀僇乕僪宆巊梡拞() As String
        Get
            Return p僗僀僗僀僇乕僪宆_RW(gco僾儘僷Get)
        End Get
        Set(ByVal Value As String)
            Call p僗僀僗僀僇乕僪宆_RW(gco僾儘僷Let, Value)
        End Set
    End Property
    Friend Function p僗僀僗僀僇乕僪宆_巊梡曄峏(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean) As Boolean
        Return "" <> p僗僀僗僀僇乕僪宆_RW(31000, p僗僀僗僀僇乕僪宆_IndexStr_FromAry(rAry僇乕僪_巊梡偡傞側傜True))
    End Function
    Friend Function p僗僀僗僀僇乕僪宆_IndexStr_FromAry(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean) As String
        Dim a As Integer
        Dim sss As String = 惎
        For a = 0 To UBound(rAry僇乕僪_巊梡偡傞側傜True)
            sss = sss + IIf(rAry僇乕僪_巊梡偡傞側傜True(a), CStr(a) & 惎, "")
        Next
        Return sss
    End Function
    Friend Function p僗僀僗僀僇乕僪宆_僞僀僩儖_巊梡忬懺(ByVal Get0Set1 As Integer, ByRef rwAry偡傋偰() As String, ByRef rw巊梡拞() As Boolean, ByRef rw巊梡僇乕僪孮BKUP As String) As Boolean
        Dim sss As String, a As Integer
        Select Case Get0Set1
            Case 0  '
                m巊梡僇乕僪孮BKUP = p僗僀僗僀僇乕僪宆巊梡拞
                sss = m巊梡僇乕僪孮BKUP
                ReDim rwAry偡傋偰(c僇乕僪宆Allmax)       '偡傋偰偺宆偺僞僀僩儖傪儕僗僩偵擖傟傞
                ReDim rw巊梡拞(c僇乕僪宆Allmax)          '巊梡偟偰偄傞宆偺儕僗僩側傜 true
                For a = c僇乕僪宆ALLmin To c僇乕僪宆Allmax
                    rwAry偡傋偰(a) = m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖
                    rw巊梡拞(a) = (InStr(sss, 惎 & CStr(a) & 惎) > 0)
                Next
                rw巊梡僇乕僪孮BKUP = m巊梡僇乕僪孮BKUP

            Case 1  'rw巊梡拞丂偐傜丂怴偟偄慖戰忬懺傪愝掕偡傞
                m巊梡僇乕僪孮 = 惎
                For a = 0 To UBound(rw巊梡拞)
                    If rw巊梡拞(a) Then m巊梡僇乕僪孮 = m巊梡僇乕僪孮 & CStr(a) & 惎
                Next
                p僗僀僗僀僇乕僪宆巊梡拞 = m巊梡僇乕僪孮
        End Select
        Return True
    End Function
    Friend Function p僗僀僗僀僇乕僪宆_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "", Optional ByRef 儐乕僓乕僇乕僪僞僀僩儖 As String = "") As String
        Const PropName As String = "p僗僀僗僀僇乕僪宆"
        Static 抣 As String
        Dim a As Integer, t As String = ""
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔, gco僾儘僷婯掕抣, 102020, 102030  '僾儘僷弶婜壔  /  抣DEF偡傋偰  /  抣DEF傾僾儕  /  抣DEF儐乕僓乕  /  return  暥帤楍丂".....仛5仛6仛11仛14仛18仛19仛23...."
                Dim bol As Boolean = (僾儘僷僐儅儞僪 = gco僾儘僷弶婜壔) Or (僾儘僷僐儅儞僪 = gco僾儘僷婯掕抣)
                Dim stt As Integer = IIf(bol, c僇乕僪宆ALLmin, IIf(僾儘僷僐儅儞僪 = 102020, c僇乕僪宆ALLmin, c僇乕僪宆USERmin))
                Dim stp As Integer = IIf(bol, cUser9宍, IIf(僾儘僷僐儅儞僪 = 102020, c僇乕僪宆APPmax, c僇乕僪宆Allmax))
                t = 惎
                For a = stt To stp : t = t & CStr(a) + 惎 : Next
                If 僾儘僷僐儅儞僪 = gco僾儘僷弶婜壔 Then
                    抣 = t
                Else
                    Return t
                End If
            Case gco僾儘僷Get
                Return 抣
            Case gco僾儘僷Let
                抣 = s
                If Len(抣) < 2 Or InStr(抣, 惎) = 0 Then 抣 = p僗僀僗僀僇乕僪宆_RW(gco僾儘僷婯掕抣)
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, 抣)
            Case gco僾儘僷iniRD
                gggstr = p僗僀僗僀僇乕僪宆_RW(gco僾儘僷Let, 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s), "")
            Case 30000     'p僗僀僗僀僇乕僪宆_巊梡拞偱偡(ByRef r僇乕僪宆IDX As Integer) 
                Return CStr(InStr(惎 + 抣, 惎 + s + 惎) > 0)
            Case 31000     'p僗僀僗僀僇乕僪宆_巊梡曄峏(ByRef rAry僇乕僪_巊梡偡傞側傜True() As Boolean)
                抣 = s
                If Len(抣) < 2 Or InStr(抣, 惎) = 0 Then 抣 = p僗僀僗僀僇乕僪宆_RW(gco僾儘僷婯掕抣)
        End Select
        Return 抣
    End Function
    '***********************************************************************
    Friend Sub p僎乕儉僇乕僪偺僒僀僘ListBox偵愝掕(ByRef box As ListBox)
        If box IsNot Nothing Then box.SelectedIndex = 嘳悢抣斖埻Int(-1, box.Items.Count - 1, p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4)
    End Sub
    Friend Sub p僎乕儉僇乕僪偺僒僀僘ListBox偐傜撉弌偟(ByRef box As ListBox)
        If box IsNot Nothing Then p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 = box.SelectedIndex
    End Sub
    Friend ReadOnly Property p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4_DEF() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪偺僒僀僘_RW(45200))
        End Get
    End Property
    Friend Property p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪偺僒僀僘_RW(45869))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉僇乕僪偺僒僀僘_RW(45860, CStr(value))
        End Set
    End Property
    Friend Property p僎乕儉僇乕僪偺僒僀僘() As Single
        Get
            Return CSng(p僎乕儉僇乕僪偺僒僀僘_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Single)
            Call p僎乕儉僇乕僪偺僒僀僘_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Private Function p僎乕儉僇乕僪偺僒僀僘_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉僇乕僪偺僒僀僘" : Const 抣DEF As Single = 0.8 : Const 抣min As Single = 0.7 : Const 抣max As Single = 0.9
        Static 抣 As Single : Dim 媽抣 As Single : Dim a As Integer
        媽抣 = 抣
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = 嘳悢抣斖埻Sng(抣min, 抣max, Val(s))
            Case gco僾儘僷MenuClick 'non op
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = 嘳悢抣斖埻Sng(抣min, 抣max, CSng(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))
            Case 45869 'Get p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4() :
                Select Case 抣 : Case Is <= 0.7 : a = 0 : Case Is <= 0.75 : a = 1 : Case Is <= 0.8 : a = 2 : Case Is <= 0.85 : a = 3 : Case Else : a = 4 : End Select
                Return CStr(a)
            Case 45860 'Let p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4()
                a = 嘳悢抣斖埻Int(0, 4, Val(s))
                Select Case a : Case Is <= 0 : 抣 = 0.7 : Case 1 : 抣 = 0.75 : Case 2 : 抣 = 0.8 : Case 3 : 抣 = 0.85 : Case Else : 抣 = 0.9 : End Select
                If 媽抣 <> 抣 Then
                    僾儘僷僐儅儞僪 = gco僾儘僷Let '45860 = gco僾儘僷Let 戙擖
                End If
            Case 45200 'p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4_DEF
                Return CStr(2) '(Listbox index)

        End Select
        '---------------------------------------------------------------
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD
                Try
                    If pp僎乕儉幚峴拞 Then
                        Call aa僇乕僪偺攝抲偲嵞昤夋(3, 2)
                    End If
                    'Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(2387541, CStr(抣))
                Catch ex As Exception
                    MsgBox(ex.TargetSite)
                End Try
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Sub p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListBox偵愝掕(ByRef box As ListBox)
        If box IsNot Nothing Then box.SelectedIndex = 嘳悢抣斖埻Int(-1, box.Items.Count - 1, p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4)
    End Sub
    Friend Sub p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListBox偐傜撉弌偟(ByRef box As ListBox)
        If box IsNot Nothing Then p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 = box.SelectedIndex
    End Sub
    Friend ReadOnly Property p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4_DEF() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(45200))
        End Get
    End Property
    Friend Property p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(45231))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(45426, CStr(value))
        End Set
    End Property
    Friend Property p僎乕儉僇乕僪偺僒僀僘曄峏斾棪() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Private Function p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉僇乕僪偺僒僀僘曄峏斾棪" : Const 抣DEF As Integer = 3 : Const 壓 As Integer = 1 : Const 忋 As Integer = 5
        Static 抣 As Integer : Dim 媽抣 As Integer
        媽抣 = 抣
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let, gco僾儘僷MenuClick : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(s))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = 嘳悢抣斖埻Int(壓, 忋, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))

            Case 45231 'Get p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4()   抣 = 1 - 5   ListIndex = 0 - 4
                Return CStr(嘳悢抣斖埻Int(壓, 忋, 抣 - 1))

            Case 45426 'Let p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4()   抣 = 1 - 5   ListIndex = 0 - 4
                抣 = 嘳悢抣斖埻Int(壓, 忋, Val(s) + 1)
                If 媽抣 <> 抣 Then
                    僾儘僷僐儅儞僪 = gco僾儘僷Let '45860 = gco僾儘僷Let 戙擖
                End If

            Case 45200 'p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4_DEF
                Return CStr(抣DEF - 1) '(Listbox index)
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷MenuClick
                Try

                Catch ex As Exception
                    MsgBox(ex.TargetSite)
                End Try
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Property p巆傝枃悢偱僇乕僪僒僀僘曄峏ListIDX() As Integer
        Get
            Return IIf(CBool(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷Get)), 0, 1)
        End Get
        Set(ByVal Value As Integer)
            Call p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷Let, CStr(IIf(Value = 0, True, False)))
        End Set
    End Property
    Friend ReadOnly Property p巆傝枃悢偱僇乕僪僒僀僘曄峏DEF() As Boolean
        Get
            Return CBool(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷婯掕抣))
        End Get
    End Property
    Friend Property p巆傝枃悢偱僇乕僪僒僀僘曄峏() As Boolean
        Get
            Return CBool(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Boolean)
            Call p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Friend Function p巆傝枃悢偱僇乕僪僒僀僘曄峏偺嵞昤夋偑梊掕() As Boolean
        Return CBool(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(1100))
    End Function
    Friend Function p巆傝枃悢偱僇乕僪僒僀僘曄峏偺専嵏偲嵞昤夋() As Boolean
        Return CBool(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(1000))
    End Function
    Friend Function p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢偺儕僙僢僩() As Boolean
        Call p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(4000)
    End Function
    Friend Function p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢() As Single
        Return CSng(p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(2000))
    End Function
    Private Function p巆傝枃悢偱僇乕僪僒僀僘曄峏_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p巆傝枃悢偱僇乕僪僒僀僘曄峏" : Const 抣DEF As Boolean = True : Static 抣 As Boolean
        Const c僇乕僪僒僀僘曄峏偡傞嵟彫枃悢 As Short = 20
        Static 攞悢 As Single
        Dim n As Integer : Dim bol As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF : 攞悢 = 1.0#
            Case gco僾儘僷婯掕抣 : Return CStr(抣DEF)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = CBool(s)
            Case gco僾儘僷MenuClick : 抣 = Not 抣
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = CBool(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))

            Case 1000 'p巆傝枃悢偱僇乕僪僒僀僘曄峏偺専嵏偲嵞昤夋
                If p巆傝枃悢偱僇乕僪僒僀僘曄峏偺嵞昤夋偑梊掕() Then
                    攞悢 = Math.Sqrt(Math.Sqrt(p尰嵼偺僇乕僪枃悢 / aa巆傝僇乕僪枃悢())) - 1.0#
                    攞悢 = 1.0# + 攞悢 * (p僎乕儉僇乕僪偺僒僀僘曄峏斾棪 * 0.4 * 0.5)
                    'qqqqq CStr(攞悢)
                    If pp僎乕儉幚峴拞 Then
                        'gggbol = aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(frmMain, CStr(CInt(Rnd() * 100000)), pp僎乕儉幚峴拞)
                        Call aa僇乕僪偺攝抲偲嵞昤夋(2)
                        'qqqqq("p巆傝枃悢偱僇乕僪僒僀僘曄峏偺専嵏偲嵞昤夋()  done")
                    End If
                    Return CStr(True)
                Else
                    Return CStr(False)
                End If
            Case 1100 'p巆傝枃悢偱僇乕僪僒僀僘曄峏偺嵞昤夋偑梊掕
                bol = False
                If 抣 = True Then
                    n = aa巆傝僇乕僪枃悢()
                    If n <> p尰嵼偺僇乕僪枃悢 Then
                        If n >= c僇乕僪僒僀僘曄峏偡傞嵟彫枃悢 Then
                            Select Case n
                                Case 180, 160, 140, 120, 100, 80, 70, 60, 50, 40, 30, 20
                                    bol = True
                            End Select
                        End If
                    End If
                End If
                Return CStr(bol)
            Case 2000 'p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢
                Return CStr(攞悢)
            Case 4000 'p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢偺儕僙僢僩
                攞悢 = 1.0#
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷MenuClick

                ''Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪_RW(2387541, CStr(抣))
        End Select
        Return CStr(抣)
    End Function

#End Region

#Region "僀儀儞僩 from DlgFile僎乕儉梡"

    Private Sub DlgFile僎乕儉梡_夋憸僼傽僀儖偺愗懼僞僀儅乕(ByVal rCur僼傽僀儖 As String, ByVal rNext僼傽僀儖 As String, ByRef wChangeDone As Boolean) Handles DlgFile僎乕儉梡.夋憸僼傽僀儖偺愗懼僞僀儅乕
        'qqqqq("DlgFile僎乕儉梡_夋憸僼傽僀儖偺愗懼僞僀儅乕()")
        'qqqqq("rCur僼傽僀儖   " & rCur僼傽僀儖)
        'qqqqq("rNext僼傽僀儖  " & rNext僼傽僀儖)
        gggstr = zz僎乕儉昤夋梡僼傽僀儖怴婯愝掕(frmMain, rNext僼傽僀儖)
        gggbol = aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, rNext僼傽僀儖, pp僎乕儉幚峴拞)
        If pp僎乕儉幚峴拞 Then
            gggbol = aa僇乕僪偺攝抲偲嵞昤夋(3)
        End If
        wChangeDone = True
    End Sub

    Private Sub DlgFile僎乕儉梡_夋憸僼傽僀儖偺愗懼僞僀儅乕堦昩偛偲偺捠抦(ByRef wIs枮婜 As Boolean) Handles DlgFile僎乕儉梡.夋憸僼傽僀儖偺愗懼僞僀儅乕堦昩偛偲偺捠抦
        wIs枮婜 = p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜
    End Sub

    Private Sub DlgFile僎乕儉梡_夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨(ByVal rNew僼傽僀儖 As String, ByRef wChangeDone As Boolean) Handles DlgFile僎乕儉梡.夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨
        '2022/10/18 ************************************************************ 
        '僎乕儉幚峴拞側傜丄僇乕僪偺忬懺偼曄峏偟側偄丅
        If pp僎乕儉幚峴拞 Then
            Call DlgFile僎乕儉梡_夋憸僼傽僀儖偺愗懼僞僀儅乕("", rNew僼傽僀儖, wChangeDone)
            Exit Sub
        End If
        '2022/10/18 ************************************************************ 
        gggstr = zz僎乕儉昤夋梡僼傽僀儖怴婯愝掕(frmMain, rNew僼傽僀儖)
        gggbol = aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, rNew僼傽僀儖, pp僎乕儉幚峴拞)
        Call frmMain.mn1game僇乕僪枃悢巜掕Do_ClickCOM(-1)  'p尰嵼偺僇乕僪枃悢MenuIndex)
        wChangeDone = True
    End Sub

#End Region

#Region "僀儀儞僩 from 昗弨僒僂儞僪愝掕Dlg (巐frmDlgSound.vb)"

    Friend Sub mn3opt僒僂儞僪愝掕Dlg_Load_1_Disposed_2(ByVal op As Integer, ByVal rOwner As Form)
        Select Case op
            Case 1 'New Load
                If gm傾僾儕廔椆偡傞 Then Return
                If 1 = GMCOM_僟僀傾儘僌儌乕僪儗僗昞帵僠僃僢僋(昗弨僒僂儞僪愝掕Dlg) Then
                    昗弨僒僂儞僪愝掕Dlg = New 巐frmDlgSound : 昗弨僒僂儞僪愝掕Dlg.Show(rOwner)
                End If
            Case 2 'after Disposed
                昗弨僒僂儞僪愝掕Dlg = Nothing
        End Select
    End Sub
    Private Sub 昗弨僒僂儞僪愝掕Dlg_昗弨僒僂儞僪愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer) Handles 昗弨僒僂儞僪愝掕Dlg.昗弨僒僂儞僪愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄
        wIsOK = True
        wMe_gmDlgID = gmDlg僒僂儞僪愝掕
    End Sub
    Private Sub 昗弨僒僂儞僪愝掕Dlg_懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨(ByVal rMe_gmDlgID As Integer, ByVal r昞帵曄峏僂僀儞僪僂ID As Integer, ByVal r昞帵True徚嫀False As Boolean, ByRef wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 As Boolean) Handles 昗弨僒僂儞僪愝掕Dlg.懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨
        wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 = GMCOM_Dlgs懠偺僂僀儞僪僂偺昞帵_旕昞帵僀儀儞僩偱_rMe_僂僀儞僪僂傪徚嫀偟側偝偄(rMe_gmDlgID, r昞帵曄峏僂僀儞僪僂ID, r昞帵True徚嫀False)
    End Sub

#End Region

#Region "僀儀儞僩 from 昗弨僆僾僔儑儞愝掕Dlg ( 巐frmDlgOptionSTD )"

    Friend Sub mn3opt僆僾僔儑儞愝掕Dlg_Load_1_Disposed_2(ByVal op As Integer, ByVal rOwner As Form)
        Select Case op
            Case 1 'New Load
                If gm傾僾儕廔椆偡傞 Then Return
                If 1 = GMCOM_僟僀傾儘僌儌乕僪儗僗昞帵僠僃僢僋(昗弨僆僾僔儑儞愝掕Dlg) Then
                    昗弨僆僾僔儑儞愝掕Dlg = New 巐frmDlgOptionSTD : 昗弨僆僾僔儑儞愝掕Dlg.Show(rOwner)
                End If
            Case 2 'after Disposed
                昗弨僆僾僔儑儞愝掕Dlg = Nothing
        End Select
    End Sub

    Private Sub 昗弨僆僾僔儑儞愝掕Dlg_僇儔乕僨乕僞乕傪偔偩偝偄(ByRef wmp攝怓榞昗弨 As Integer, ByRef wmp攝怓榞僪儔僢僌 As Integer, ByRef wmp攝怓攚宨 As Integer) Handles 昗弨僆僾僔儑儞愝掕Dlg.僇儔乕僨乕僞乕傪偔偩偝偄
        wmp攝怓榞昗弨 = p僎乕儉攝怓奜榞
        wmp攝怓榞僪儔僢僌 = p僎乕儉攝怓奜榞僪儔僢僌
        wmp攝怓攚宨 = p僎乕儉攝怓敳偗攚宨
    End Sub

    Private Sub 昗弨僆僾僔儑儞愝掕Dlg_昗弨僆僾僔儑儞愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer, ByRef wlst僇乕僪堦抳偱斀揮昞帵 As ListBox, ByRef wlst僇乕僪堏摦偺婳愓傪巆偡 As ListBox, ByRef wlst攚宨偺柧傞偝 As ListBox, ByRef wlst榞偺懢偝 As ListBox, ByRef wlst僇乕僪僗僺乕僪 As ListBox) Handles 昗弨僆僾僔儑儞愝掕Dlg.昗弨僆僾僔儑儞愝掕Dlg偺弶婜壔傪偟偰偔偩偝偄
        wIsOK = True
        wMe_gmDlgID = gmDlg僆僾僔儑儞愝掕
        wlst僇乕僪堦抳偱斀揮昞帵.SelectedIndex = p僇乕僪堦抳偱斀揮偡傞
        wlst僇乕僪堏摦偺婳愓傪巆偡.SelectedIndex = p僇乕僪堏摦偺婳愓傪巆偡
        Call p僎乕儉梡僼傽僀儖偺柧傞偝ListBox偵愝掕(wlst攚宨偺柧傞偝)
        Call p僇乕僪僒僀僘榞偺懢偝ListBox偵愝掕(wlst榞偺懢偝)
        Call p僇乕僪僗僺乕僪ListBox偵愝掕(wlst僇乕僪僗僺乕僪)
    End Sub

    Private Sub 昗弨僆僾僔儑儞愝掕Dlg_懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨(ByVal rMe_gmDlgID As Integer, ByVal r昞帵曄峏僂僀儞僪僂ID As Integer, ByVal r昞帵True徚嫀False As Boolean, ByRef wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 As Boolean) Handles 昗弨僆僾僔儑儞愝掕Dlg.懠偺僂僀儞僪僂偑昞帵偁傞偄偼旕昞帵偵側傝傑偟偨
        wRet_rMe_gmDlgID僂僀儞僪僂傪徚嫀偟側偝偄 = GMCOM_Dlgs懠偺僂僀儞僪僂偺昞帵_旕昞帵僀儀儞僩偱_rMe_僂僀儞僪僂傪徚嫀偟側偝偄(rMe_gmDlgID, r昞帵曄峏僂僀儞僪僂ID, r昞帵True徚嫀False)
    End Sub

#End Region

#Region "僀儀儞僩 from 僎乕儉僇乕僪僒僀僘Dlg ( frmDlgGameCardSize )"

    Friend Sub aa僎乕儉僇乕僪僒僀僘Dlg_Load_1_Disposed_2(ByVal op As Integer, ByVal rOwner As Form)
        Try
            Select Case op
                Case 1 'New Load
                    If gm傾僾儕廔椆偡傞 Then Return
                    If 1 = GMCOM_僟僀傾儘僌儌乕僪儗僗昞帵僠僃僢僋(僎乕儉僇乕僪僒僀僘Dlg) Then
                        僎乕儉僇乕僪僒僀僘Dlg = New frmDlgGameCardSize
                        僎乕儉僇乕僪僒僀僘Dlg.Owner = rOwner
                        僎乕儉僇乕僪僒僀僘Dlg.Show()
                    End If
                Case 2 'after Disposed
                    僎乕儉僇乕僪僒僀僘Dlg = Nothing
            End Select
        Catch
            MsgBox(ErrorToString)
        End Try
    End Sub
    Private Sub 僎乕儉僇乕僪僒僀僘Dlg_僎乕儉僇乕僪僒僀僘Dlg偺_ControlEvent_傪張棟偟偰偔偩偝偄(ByRef OpEvent_戝拞彫1_巆傝枃悢2_僇乕僪偺僒僀僘3_曄峏斾棪4 As Integer, ByRef rlst僇乕僪僒僀僘戝拞彫儌乕僪 As ListBox, ByRef rlst巆傝枃悢偱僇乕僪僒僀僘曄峏 As ListBox, ByRef rlst僎乕儉僇乕僪偺僒僀僘 As ListBox, ByRef rlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪 As ListBox) Handles 僎乕儉僇乕僪僒僀僘Dlg.僎乕儉僇乕僪僒僀僘Dlg偺_ControlEvent_傪張棟偟偰偔偩偝偄
        If gm傾僾儕廔椆偡傞 Then Return
        Select Case OpEvent_戝拞彫1_巆傝枃悢2_僇乕僪偺僒僀僘3_曄峏斾棪4
            Case 1 : p僎乕儉僇乕僪偺僒僀僘戝拞彫ListIDX = rlst僇乕僪僒僀僘戝拞彫儌乕僪.SelectedIndex
            Case 2 : p巆傝枃悢偱僇乕僪僒僀僘曄峏ListIDX = rlst巆傝枃悢偱僇乕僪僒僀僘曄峏.SelectedIndex
            Case 3 : Call p僎乕儉僇乕僪偺僒僀僘ListBox偐傜撉弌偟(rlst僎乕儉僇乕僪偺僒僀僘)
            Case 4 : Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListBox偐傜撉弌偟(rlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪)
        End Select
    End Sub
    Private Sub 僎乕儉僇乕僪僒僀僘Dlg_僎乕儉僇乕僪僒僀僘Dlg偺_MenuEvent_傪張棟偟偰偔偩偝偄(ByRef mnu偡傋偰尦偵栠偡10__mnu婯掕抣偵儕僙僢僩20__mnu僇乕僪枃悢巜掕Do_1_2_3_4_5__mnu偙偺傾僾儕傪廔椆99 As Integer, ByRef wlst僇乕僪僒僀僘戝拞彫儌乕僪 As ListBox, ByRef wlst巆傝枃悢偱僇乕僪僒僀僘曄峏 As ListBox, ByRef wlst僎乕儉僇乕僪偺僒僀僘 As ListBox, ByRef wlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪 As ListBox, ByVal rmlst僇乕僪僒僀僘戝拞彫儌乕僪 As Boolean, ByVal rmlst巆傝枃悢偱僇乕僪僒僀僘曄峏 As Boolean, ByVal rmlst僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 As Integer, ByVal rmlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 As Integer) Handles 僎乕儉僇乕僪僒僀僘Dlg.僎乕儉僇乕僪僒僀僘Dlg偺_MenuEvent_傪張棟偟偰偔偩偝偄
        If gm傾僾儕廔椆偡傞 Then Return
        Dim a As Integer = mnu偡傋偰尦偵栠偡10__mnu婯掕抣偵儕僙僢僩20__mnu僇乕僪枃悢巜掕Do_1_2_3_4_5__mnu偙偺傾僾儕傪廔椆99
        Select Case a
            Case 10, 20
                Dim bol As Boolean = (a = 10)
                p僎乕儉僇乕僪偺僒僀僘戝拞彫 = IIf(bol, rmlst僇乕僪僒僀僘戝拞彫儌乕僪, p僎乕儉僇乕僪偺僒僀僘戝拞彫DEF)
                p巆傝枃悢偱僇乕僪僒僀僘曄峏 = IIf(bol, rmlst巆傝枃悢偱僇乕僪僒僀僘曄峏, p巆傝枃悢偱僇乕僪僒僀僘曄峏DEF)
                p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 = IIf(bol, rmlst僎乕儉僇乕僪偺僒僀僘ListIndex_0_4, p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4_DEF)
                p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 = IIf(bol, rmlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4, p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4_DEF)
                wlst僇乕僪僒僀僘戝拞彫儌乕僪.SelectedIndex = p僎乕儉僇乕僪偺僒僀僘戝拞彫ListIDX
                wlst巆傝枃悢偱僇乕僪僒僀僘曄峏.SelectedIndex = p巆傝枃悢偱僇乕僪僒僀僘曄峏ListIDX
                Call p僎乕儉僇乕僪偺僒僀僘ListBox偵愝掕(wlst僎乕儉僇乕僪偺僒僀僘)
                Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListBox偵愝掕(wlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪)
            Case 1 To 5
                Call frmMain.mn1game僇乕僪枃悢巜掕Do_ClickCOM(a)
            Case 99
                Call frmMain.mn1game偙偺傾僾儕傪廔椆_Click(Nothing, Nothing)
        End Select
    End Sub
    Private Sub 僎乕儉僇乕僪僒僀僘Dlg_僎乕儉僇乕僪僒僀僘Dlg偺_MenusEnabled_傪愝掕偟偰偔偩偝偄(ByRef wmnu偡傋偰尦偵栠偡 As ToolStripMenuItem, ByRef wmnu婯掕抣偵儕僙僢僩 As ToolStripMenuItem, ByVal rmlst僇乕僪僒僀僘戝拞彫儌乕僪 As Boolean, ByVal rmlst巆傝枃悢偱僇乕僪僒僀僘曄峏 As Boolean, ByVal rmlst僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 As Integer, ByVal rmlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 As Integer) Handles 僎乕儉僇乕僪僒僀僘Dlg.僎乕儉僇乕僪僒僀僘Dlg偺_MenusEnabled_傪愝掕偟偰偔偩偝偄
        If gm傾僾儕廔椆偡傞 Then Return
        With gm傾僾儕屌桳僋儔僗
            wmnu偡傋偰尦偵栠偡.Enabled = (rmlst僇乕僪僒僀僘戝拞彫儌乕僪 <> .p僎乕儉僇乕僪偺僒僀僘戝拞彫) Or (rmlst巆傝枃悢偱僇乕僪僒僀僘曄峏 <> .p巆傝枃悢偱僇乕僪僒僀僘曄峏) Or (rmlst僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 <> .p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4) Or (rmlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 <> .p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4)
            wmnu婯掕抣偵儕僙僢僩.Enabled = (.p僎乕儉僇乕僪偺僒僀僘戝拞彫 <> .p僎乕儉僇乕僪偺僒僀僘戝拞彫DEF) Or (.p巆傝枃悢偱僇乕僪僒僀僘曄峏 <> .p巆傝枃悢偱僇乕僪僒僀僘曄峏DEF) Or (.p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4 <> .p僎乕儉僇乕僪偺僒僀僘ListIndex_0_4_DEF) Or (.p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4 <> .p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListIndex_0_4_DEF)
        End With
    End Sub
    Private Sub 僎乕儉僇乕僪僒僀僘Dlg_僎乕儉僇乕僪僒僀僘Dlg偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer, ByRef wlst僇乕僪僒僀僘戝拞彫儌乕僪 As ListBox, ByRef wlst巆傝枃悢偱僇乕僪僒僀僘曄峏 As ListBox, ByRef wlst僎乕儉僇乕僪偺僒僀僘 As ListBox, ByRef wlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪 As ListBox) Handles 僎乕儉僇乕僪僒僀僘Dlg.僎乕儉僇乕僪僒僀僘Dlg偺弶婜壔傪偟偰偔偩偝偄
        If gm傾僾儕廔椆偡傞 Then Return
        wIsOK = True
        wMe_gmDlgID = gmDlg僎乕儉僇乕僪僒僀僘愝掕
        wlst僇乕僪僒僀僘戝拞彫儌乕僪.SelectedIndex = p僎乕儉僇乕僪偺僒僀僘戝拞彫ListIDX
        wlst巆傝枃悢偱僇乕僪僒僀僘曄峏.SelectedIndex = p巆傝枃悢偱僇乕僪僒僀僘曄峏ListIDX
        Call p僎乕儉僇乕僪偺僒僀僘ListBox偵愝掕(wlst僎乕儉僇乕僪偺僒僀僘)
        Call p僎乕儉僇乕僪偺僒僀僘曄峏斾棪ListBox偵愝掕(wlst僎乕儉僇乕僪偺僒僀僘曄峏斾棪)
    End Sub

#End Region

#Region "僀儀儞僩 from gAppEventMaker"

    Private Sub 僀儀儞僩gAppEventMaker_儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨() Handles 僀儀儞僩gAppEventMaker.儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨
        If Not pp僎乕儉幚峴拞 Then Return
        gggbol = aa僇乕僪偺攝抲偲嵞昤夋(3, 1)
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僞僀儅乕偺僆儞僆僼on僗僀僗僀onff(ByRef rEventOwner As Integer, ByRef rTimer僆儞 As Boolean) Handles 僀儀儞僩gAppEventMaker.僞僀儅乕偺僆儞僆僼on僗僀僗僀onff
        If rEventOwner = gmDlgFile僎乕儉梡 Then
            If DlgFile僎乕儉梡 Is Nothing Then Return
            Dim eee As Boolean = (Not DlgFile僎乕儉梡.Visible)
            If rTimer僆儞 Then
                eee = eee And (Not p僎乕儉梡僼傽僀儖偺愗傝懼偊_僞僀儉僇僂儞僩僆乕僶乕())
            Else
                eee = False
            End If
            DlgFile僎乕儉梡.tim愗傝懼偊僞僀儅乕.Enabled = eee
        Else

        End If

    End Sub

#End Region

#Region "仭仭 屲cls僗僀僗僀  嫟梡僋儔僗傪巊梡偡傞偨傔偺僟儈乕娭悢"
    Friend Function aa僗僀僗僀_僔儑乕僇乕僪_僀儊乕僕憖嶌(ByVal op As Integer, ByVal 僗僀僗僀_僇乕僪僔儑乕_僇乕僪僀儊乕僕僞僀僾 As Integer, ByRef 惓曽宍偵偡傞 As Boolean, ByRef 榞暆幚悺梡偺攞悢 As Single, ByRef 摿暿側攞悢 As Single, _
            ByVal curindex As Integer, ByRef Brsh慄 As Integer, ByRef Brsh巐杮() As Integer, _
            ByRef 奜榞暆幚悺 As Integer, ByRef 榞暆幚悺 As Integer, ByRef 夋暆 As Integer, ByRef 夋崅 As Integer, ByRef Rgn夋 As Integer, ByRef Rgn榞 As Integer, ByVal bmp庴偗 As Integer) As Boolean
        '0 = 儈僢僋僗
        '1 = 暥帤
        '2 = 傕傛偆
        '3 = 夋憸
        Return True
    End Function
    Friend Property p僎乕儉攝怓傂傜偑側() As Integer
        Get
            Return 0
        End Get
        Set(ByVal value As Integer)
            'no op
        End Set
    End Property
    Friend Property p僎乕儉攝怓僇僞僇僫() As Integer
        Get
            Return 0
        End Get
        Set(ByVal value As Integer)
            'no op
        End Set
    End Property
#End Region

End Class


'    'old code back up 仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
'    Friend Function aa僇乕僪偺攝抲偲嵞昤夋(ByRef rNew1_WndReSize2_PropChange3 As Integer, Optional ByRef r僇乕僪偺曄峏偩偗幚峴 As Integer = 0, Optional ByRef r僌儗乕儗儀儖偺曄峏 As Boolean = False) As Boolean
'        On Error GoTo errop
'        Const c墢偺嵟戝廳側傝 As Double = 0.29 '僇乕僪摨巑偺廳側傞椞堟偺斾棪丂0.15丂偱偼柍尷儖乕僾偵側傞丅
'        '----------------------------------------------------------
'        Dim o僇乕僪孮椞堟撪懁_WD(c僇乕僪宆Allmax) As Integer
'        Dim o僇乕僪孮椞堟撪懁_HT(c僇乕僪宆Allmax) As Integer
'        Dim o僇乕僪暆(c僇乕僪宆Allmax) As Integer
'        Dim o僇乕僪崅(c僇乕僪宆Allmax) As Integer
'        Dim o僇乕僪墢偺廳側傝暆(c僇乕僪宆Allmax) As Integer
'        Dim o僇乕僪墢偺廳側傝崅(c僇乕僪宆Allmax) As Integer
'        Dim o僼儗乕儉暆(c僇乕僪宆Allmax) As Integer
'        '----------------------------------------------------------
'        Dim o嵞攝抲梡僙儞僞乕愝掕 As Boolean
'        Dim o尰嵼偺僇乕僪枃悢, omax枃悢, o嵞攝抲寁嶼夞悢巜掕抣 As Integer
'        Dim o僇乕僪孮椞堟 As RECT
'        Dim o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 As Single
'        Dim o僇乕僪暆敿, otmp僇乕僪暆敿暘, otmp僇乕僪崅敿暘, o僇乕僪崅敿 As Integer
'        Dim o巊梡僇乕僪孮chkstr As String
'        Dim o墢偺嵟戝廳側傝, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢, ocur戝拞彫 As Single
'        Dim RetChkAddDelXY As Boolean
'        '----------------------------------------------------------
'        Dim mMax僇乕僪崅 As Integer = 100, mMax僇乕僪暆 As Integer = 100
'        '----------------------------------------------------------
'        Dim chkcount, mm, a, n, w, h, dx, dy, x1, y1, ggg, oOvercount As Integer
'        Dim rc As RECT
'        Dim o僎乕儉僇乕僪偺僒僀僘戝拞彫 As Boolean
'        '----------------------------------------------------------
'        '*****************************************************************************************************
'        If gm傾僾儕廔椆偡傞 Then Return False
'        If rNew1_WndReSize2_PropChange3 > 3 Then Return False
'        If frmMain.mmLoading Then Return False
'        If gm僗僀僗僀儐儔儐儔幚峴拞 > 0 Then Return False
'        '*****************************************************************************************************
'        gm傾僾儕廔椆偡傞 = False
'        '*****************************************************************************************************
'        o尰嵼偺僇乕僪枃悢 = p尰嵼偺僇乕僪枃悢
'        '*****************************************************************************************************
'        '怴婯偵攝傞偐丄僼僅乕儉儕僒僀僘偺応崌偵偼丄丄丄
'        If rNew1_WndReSize2_PropChange3 <> 3 Or r僇乕僪偺曄峏偩偗幚峴 > 0 Then
'            'o僇乕僪孮椞堟傪揔惓側僒僀僘偵偡傞
'            With o僇乕僪孮椞堟
'                With frmMain.pct儊僀儞
'                    w = .Width : h = .Height : a = Math.Min(w, h) \ 100 'change 2022/07/29
'                End With
'                .lll = a : .ttt = a : .rrr = w - a : .bbb = h - a
'            End With
'            '*****************************************************************************************************
'            '僇乕僪偺僒僀僘偺幚悺傪愝掕偡傞
'            o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 = p僎乕儉僇乕僪偺僒僀僘 / Math.Sqrt(o尰嵼偺僇乕僪枃悢) * Math.Log(Math.Log(o尰嵼偺僇乕僪枃悢 * 10)) / 1.8 '偙傟埲忋斾棪傪戝偒偔偡傞偲柍尷儖乕僾偵側傞 2015/05/17
'            '*****************************************************************************************************
'            otmp僇乕僪暆敿暘 = 0.44 * (嘳Rect暆(o僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪) : otmp僇乕僪崅敿暘 = 0.44 * (嘳Rect崅(o僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪)
'            '*****************************************************************************************************
'            '2017-11-5 add  僂僀儞僪僂僒僀僘偑嵍塃俀夋柺偵側傞偲丄僇乕僪僒僀僘偑戝偒偔側傝偡偓傞偺偱偦偺懳嶔偺偨傔偺捛壛僐乕僪
'            otmp僇乕僪暆敿暘 = otmp僇乕僪暆敿暘 * Math.Min(1, CSng(2450) / CSng(嘳Rect暆(o僇乕僪孮椞堟))) : otmp僇乕僪崅敿暘 = otmp僇乕僪崅敿暘 * Math.Min(1, CSng(1300) / CSng(嘳Rect崅(o僇乕僪孮椞堟)))
'            '*****************************************************************************************************
'            '-------------------------------------------
'            o墢偺嵟戝廳側傝 = c墢偺嵟戝廳側傝 + (p僎乕儉僇乕僪偺僒僀僘 - 0.7) * 0.9 ''僇乕僪偺戝偒偝偱曄峏偡傞  p僎乕儉僇乕僪偺僒僀僘 = 0.7 - 0.9
'            'qqqqq CStr(p僎乕儉僇乕僪偺僒僀僘) + "  -----  " + CStr(o墢偺嵟戝廳側傝)
'            '-------------------------------------------
'            o僎乕儉僇乕僪偺僒僀僘戝拞彫 = p僎乕儉僇乕僪偺僒僀僘戝拞彫
'            For a = 0 To c僇乕僪宆Allmax
'                '-------------------------------------------
'                o僇乕僪暆敿 = otmp僇乕僪暆敿暘 : o僇乕僪崅敿 = otmp僇乕僪崅敿暘
'                w = (o僇乕僪暆敿 + o僇乕僪崅敿) \ 2
'                h = w
'                '-------------------------------------------
'                o僇乕僪暆敿 = w * m僇乕僪宆僨乕僞乕婎杮愝掕(a).婎弨偺攞悢抣墶 : o僇乕僪崅敿 = h * m僇乕僪宆僨乕僞乕婎杮愝掕(a).婎弨偺攞悢抣廲
'                o僇乕僪暆(a) = o僇乕僪暆敿 + o僇乕僪暆敿 : o僇乕僪崅(a) = o僇乕僪崅敿 + o僇乕僪崅敿
'                o僇乕僪墢偺廳側傝暆(a) = o僇乕僪暆(a) * o墢偺嵟戝廳側傝 : o僇乕僪墢偺廳側傝崅(a) = o僇乕僪崅(a) * o墢偺嵟戝廳側傝
'                '-------------------------------------------
'                o僼儗乕儉暆(a) = Math.Max(2, 2.5 * System.Math.Sqrt(((o僇乕僪暆(a) + o僇乕僪崅(a)) \ 2) * p僇乕僪僒僀僘榞偺懢偝幚岠抣_尰嵼()))
'                '-------------------------------------------
'                With o僇乕僪孮椞堟
'                    o僇乕僪孮椞堟撪懁_WD(a) = .rrr - .lll - (o僇乕僪暆敿 * 2) : o僇乕僪孮椞堟撪懁_HT(a) = .bbb - .ttt - (o僇乕僪崅敿 * 2)
'                End With
'                '-------------------------------------------
'            Next
'            '*****************************************************************************************************
'            '怴偟偔僇乕僪傪攝傞応崌偼丄偁傞偄偼傾僾儕僗僞乕僩帪偺儕僒僀僘偱偼丄嵞攝抲梡僙儞僞乕x, y 傪愝掕偡傞
'            o嵞攝抲梡僙儞僞乕愝掕 = (rNew1_WndReSize2_PropChange3 = 1 Or m僇乕僪攝楍(1).嵞攝抲梡僙儞僞乕x = 0)
'            If o嵞攝抲梡僙儞僞乕愝掕 Then
'                gm僆乕儖僋儕傾 = False
'                Call p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢偺儕僙僢僩()
'            End If
'            '*****************************************************************************************************
'            o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 = p巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢()
'            omax枃悢 = o尰嵼偺僇乕僪枃悢 * 2
'            ocur戝拞彫 = 1.0#
'            Randomize()
'            '*****************************************************************************************************
'            Dim oAry僇乕僪宆IDXmax As Integer, oAry僇乕僪宆IDXcur As Integer, oAry僇乕僪宆(0) As Integer
'            oAry僇乕僪宆IDXmax = p僎乕儉僇乕僪宆_巊梡拞_僇乕僪宆ID_Ary(oAry僇乕僪宆)
'            oAry僇乕僪宆IDXcur = 0
'            '*****************************************************************************************************
'            o巊梡僇乕僪孮chkstr = 惎 & m巊梡僇乕僪孮
'            o嵞攝抲寁嶼夞悢巜掕抣 = IIf(p僇乕僪偺廳側傝傪尭傜偡, 1000, 10)
'            '-------------------------------------------
'            'ggg = 1000 '嵟彫僒僀僘偺僠僃僢僋
'            ''-------------------------------------------
'            For a = 1 To omax枃悢
'                With m僇乕僪攝楍(a)
'                    '***************************************************************************
'                    If r僇乕僪偺曄峏偩偗幚峴 = 5 Then  '戝拞彫
'                        If o僎乕儉僇乕僪偺僒僀僘戝拞彫 Then
'                            If a <= o尰嵼偺僇乕僪枃悢 Then
'                                .戝拞彫 = ocur戝拞彫 * (0.9 + (Rnd() - 0.5) / 3)
'                                ocur戝拞彫 = 0.7 + (Rnd() * 0.7)
'                            Else
'                                n = a - o尰嵼偺僇乕僪枃悢
'                                .戝拞彫 = m僇乕僪攝楍(n).戝拞彫
'                            End If
'                        Else
'                            .戝拞彫 = 1.0#
'                        End If
'                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
'                        '-------------------------------------------
'                    ElseIf r僇乕僪偺曄峏偩偗幚峴 = 2 Then  '
'                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
'                        '-------------------------------------------
'                    ElseIf r僇乕僪偺曄峏偩偗幚峴 = 1 Then
'                        If .摉傝嶍彍偢傒 = False Then
'                            '-------------------------------------------
'                            oAry僇乕僪宆IDXcur = oAry僇乕僪宆IDXcur + 1
'                            If oAry僇乕僪宆IDXcur > oAry僇乕僪宆IDXmax Then oAry僇乕僪宆IDXcur = 1
'                            '-------------------------------------------
'                            If a <= o尰嵼偺僇乕僪枃悢 Then
'                                .僇乕僪宆 = oAry僇乕僪宆(oAry僇乕僪宆IDXcur)
'                                .夋慺僇乕僪ID = a + o尰嵼偺僇乕僪枃悢
'                            Else
'                                .僇乕僪宆 = m僇乕僪攝楍(a - o尰嵼偺僇乕僪枃悢).僇乕僪宆
'                                .夋慺僇乕僪ID = 0
'                            End If
'                            '-------------------------------------------
'                        End If
'                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
'                        '***************************************************************************
'                    Else
'                        '-------------------------------------------
'                        oAry僇乕僪宆IDXcur = oAry僇乕僪宆IDXcur + 1
'                        If oAry僇乕僪宆IDXcur > oAry僇乕僪宆IDXmax Then oAry僇乕僪宆IDXcur = 1
'                        '-------------------------------------------
'                        If a <= o尰嵼偺僇乕僪枃悢 Then
'                            .僇乕僪宆 = oAry僇乕僪宆(oAry僇乕僪宆IDXcur)
'                            .夋慺僇乕僪ID = a + o尰嵼偺僇乕僪枃悢
'                        Else
'                            .僇乕僪宆 = m僇乕僪攝楍(a - o尰嵼偺僇乕僪枃悢).僇乕僪宆
'                            .夋慺僇乕僪ID = 0
'                        End If
'                        '-------------------------------------------
'                        If o嵞攝抲梡僙儞僞乕愝掕 Then
'                            '-------------------------------------------
'                            If a <= o尰嵼偺僇乕僪枃悢 Then m昤夋専嵏攝楍(a) = a
'                            '-------------------------------------------
'                            .摉傝嶍彍偢傒 = False
'                            '-------------------------------------------
'                            If o僎乕儉僇乕僪偺僒僀僘戝拞彫 Then
'                                If a <= o尰嵼偺僇乕僪枃悢 Then
'                                    .戝拞彫 = ocur戝拞彫 * (0.9 + (Rnd() - 0.5) / 3)
'                                    ocur戝拞彫 = 0.7 + (Rnd() * 0.7)
'                                Else
'                                    n = a - o尰嵼偺僇乕僪枃悢
'                                    .戝拞彫 = m僇乕僪攝楍(n).戝拞彫
'                                End If
'                            Else
'                                .戝拞彫 = 1.0#
'                            End If
'                            '------------------------------
'                            chkcount = 0
'                            '------------------------------
'                            Do
'                                .嵞攝抲梡僙儞僞乕x = Rnd()
'                                .嵞攝抲梡僙儞僞乕y = Rnd()
'                                gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) '	GoSub SetNewPostSize
'                                mm = a - 1
'                                For n = 1 To mm
'                                    If 0 <> IntersectRect(rc, .幚悺椞堟, m僇乕僪攝楍(n).廳側傝挷嵏梡椞堟) Then Exit For
'                                Next
'                                If n > mm Then
'                                    Exit Do
'                                Else
'                                    .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
'                                    RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY	
'                                    If RetChkAddDelXY Then
'                                        Exit Do
'                                    Else
'                                        .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.96
'                                        RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                        If RetChkAddDelXY Then
'                                            Exit Do
'                                        Else
'                                            .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 0.98
'                                            RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                            If RetChkAddDelXY Then
'                                                Exit Do
'                                            Else
'                                                '------------------------------
'                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
'                                                RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                                If RetChkAddDelXY Then
'                                                    Exit Do
'                                                Else
'                                                    .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
'                                                    RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                                    If RetChkAddDelXY Then
'                                                        Exit Do
'                                                    Else
'                                                        .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 1.04
'                                                        RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                                        If RetChkAddDelXY Then
'                                                            Exit Do
'                                                        Else
'                                                            .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
'                                                            RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                                            If RetChkAddDelXY Then
'                                                                Exit Do
'                                                            Else
'                                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
'                                                                RetChkAddDelXY = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(a, m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub ChkAddDelXY
'                                                                If RetChkAddDelXY Then
'                                                                    Exit Do
'                                                                End If
'                                                            End If
'                                                        End If
'                                                    End If
'                                                End If
'                                                '------------------------------
'                                            End If
'                                        End If
'                                    End If
'                                End If
'                                '------------------------------
'                                chkcount = chkcount + 1
'                                If chkcount > o嵞攝抲寁嶼夞悢巜掕抣 Then
'                                    oOvercount = oOvercount + 1
'                                    'qqqqq(Format(oOvercount, "00") + "丂嵞攝抲寁嶼 " + CStr(o嵞攝抲寁嶼夞悢巜掕抣) + " 夞挻")
'                                    Exit Do
'                                End If
'                                '------------------------------
'                            Loop
'                            'End If
'                        Else
'                            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(m僇乕僪攝楍(a), o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) 'GoSub SetNewPostSize
'                        End If
'                    End If
'                    .幚悺WD = 嘳Rect暆(.幚悺椞堟) '幚悺椞堟.Width
'                    .幚悺HT = 嘳Rect崅(.幚悺椞堟) '幚悺椞堟.Height
'                    .僇乕僪榞暆 = Math.Max(2, o僼儗乕儉暆(.僇乕僪宆) * .戝拞彫 * o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢)
'                    '-------------------------------------------
'                    If rNew1_WndReSize2_PropChange3 = 1 Then
'                        .摉傝嶍彍偢傒 = False
'                        .DoDraw = True
'                    End If
'                    '傑偩偁偨偭偰偄側偄僇乕僪偩偗儕乕僕儑儞傪嶌傞
'                    If .摉傝嶍彍偢傒 = False Then
'                        Call zz儕乕僕儑儞僨乕僞乕嶍彍(m僇乕僪攝楍(a))
'                        If Not oo僺僞儁僞僇乕僪.aa僇乕僪宆儕乕僕儑儞嶌惉(m僇乕僪宆僨乕僞乕婎杮愝掕(.僇乕僪宆).億儕僑儞, .儕乕僕儑儞, .儕乕僕儑儞榞, .僇乕僪宆, .幚悺椞堟, .僇乕僪榞暆, c挿曽宍, c惓曽宍, c懭墌宍, c墌宍, c榋妏宍, c傂偟宍, c嶰妏宍, c廫帤宍, c偩傞傑宍, c僟僀儎宍, c惎宍, c傾儗僀宍, c僴乕僩宍, c巐偮梩宍, c偍傢傫宍, c傾僩儉宍, c偝偐側宍, c挶宍, c僔儍僩儖宍, cUFO_宍, cUserCard僗働乕儖婎悢WD, cUserCard僗働乕儖婎悢HT) Then
'                            Call zzErrorAppEnd() '傕偟僄儔乕偵側傟偽丄傾僾儕傪嫮惂廔椆偡傞丅
'                        End If
'                        'n = GetRgnBox(.儕乕僕儑儞, rc)
'                        'qqqqq(CStr(a) & ", " & CStr(.僇乕僪宆) & ", " & CStr(.幚悺椞堟.lll) & "/" & CStr(.幚悺椞堟.ttt) & ", " & CStr(rc.lll) & "/" & CStr(rc.ttt) & ", " & CStr(rc.rrr) & "/" & CStr(rc.bbb) & ", " & CStr(.儕乕僕儑儞) & ", " & CStr(.儕乕僕儑儞榞))
'                    Else
'                        'qqqqq CStr(a)
'                    End If
'                    'qqqqq(Format(a, "000") + "  " + CStr(.幚悺椞堟.lll))  '2022/07/23  OK
'                    ''-------------------------------------------
'                    ' If ggg > .幚悺WD Then ggg = .幚悺WD '嵟彫僒僀僘偺僠僃僢僋
'                    ''-------------------------------------------
'                    If mMax僇乕僪崅 < .幚悺WD Then mMax僇乕僪崅 = .幚悺WD
'                    If mMax僇乕僪暆 < .幚悺HT Then mMax僇乕僪暆 = .幚悺HT
'                End With
'            Next
'            '**************************************************************
'            'frmMain.pctCardHit.Image  僪儔僢僌僇乕僪偺昤夋梡偺僂僀儞僪僂偲僀儊乕僕偺嵞嶌惉丅丂
'            w = mMax僇乕僪崅 * 1.1
'            h = mMax僇乕僪暆 * 1.1
'            With frmMain.pctCardHit
'                .SetBounds(0, 0, w, h, BoundsSpecified.Width Or BoundsSpecified.Height)
'                gggbol = 嘳Image_怴婯嶌惉_嵞嶌惉(.Image, w, h)
'                'qqqqq("*****frmMain.pctCardHit.Image 嵞嶌惉*****")
'            End With
'            '**************************************************************
'            If o嵞攝抲梡僙儞僞乕愝掕 Then Call mn1game僇乕僪偺廳側傝傪尭傜偡_CapSet(oOvercount)
'            ''-------------------------------------------
'            'qqqqq "嵟彫僒僀僘 = " + CStr(ggg) '嵟彫僒僀僘偺僠僃僢僋
'            ''-------------------------------------------
'            'qqqqq "Cards Post Set End *****************"
'        End If
'        pp僎乕儉幚峴拞 = Not zz巆傝僇乕僪偑側偄()
'        '**************************************************************
'        If r僌儗乕儗儀儖偺曄峏 And (rNew1_WndReSize2_PropChange3 = 3) Then
'            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, CStr(CInt(Rnd() * 100000)), pp僎乕儉幚峴拞)
'        Else
'            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(frmMain, CStr(CInt(Rnd() * 100000)), pp僎乕儉幚峴拞)
'        End If
'        'qqqqq("aa僇乕僪偺攝抲偲嵞昤夋()  僙僢僩Image")
'        '**************************************************************
'        pp僎乕儉幚峴拞 = Not zz巆傝僇乕僪偑側偄()
'        frmMain.pct儊僀儞.Visible = True
'        frmMain.Invalidate()
'        frmMain.Refresh()
'        '-------------------------------------------
'        If rNew1_WndReSize2_PropChange3 = 1 Then
'            p僎乕儉梡僼傽僀儖偺愗傝懼偊_僇儗儞僩僇僂儞僩 = 0
'            gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僞僀儅乕偺僆儞僆僼on僗僀僗僀onff(gmDlgFile僎乕儉梡, True)
'            gggstr = 僀儀儞僩gAppEventMaker.MakeEvent僎乕儉奐巒偲掆巭(pp僎乕儉幚峴拞, "")
'            '***********************************************************************
'            Dim ttt As String = 嘳僞僀儉宱夁僠僃僢僋暥帤楍_帪娫_暘_昩(0, "ms")
'            '***********************************************************************
'        End If
'        '-------------------------------------------
'        'qqqqq "偡傋偰昤夋 *****************"
'        'For a = 0 To 29: qqqqq m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖: Next
'        '-------------------------------------------
'        Return True
'errop:
'        MsgBox(ErrorToString()) : Return False
'    End Function
'    Private Function aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(ByVal idx As Integer, ByRef ddd As type僇乕僪乕僨乕僞乕, ByRef o僇乕僪孮椞堟 As RECT, ByRef o僇乕僪孮椞堟撪懁_WD() As Integer, ByRef o僇乕僪孮椞堟撪懁_HT() As Integer, _
'                        ByRef o僇乕僪暆() As Integer, ByRef o僇乕僪崅() As Integer, ByRef o僇乕僪墢偺廳側傝暆() As Integer, ByRef o僇乕僪墢偺廳側傝崅() As Integer, ByRef o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 As Single) As Boolean
'        Dim mm As Integer, n As Integer, rc As RECT
'        With ddd
'            .嵞攝抲梡僙儞僞乕x = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕x)
'            .嵞攝抲梡僙儞僞乕y = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕y)
'            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(ddd, o僇乕僪孮椞堟, o僇乕僪孮椞堟撪懁_WD, o僇乕僪孮椞堟撪懁_HT, o僇乕僪暆, o僇乕僪崅, o僇乕僪墢偺廳側傝暆, o僇乕僪墢偺廳側傝崅, o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢) '	GoSub SetNewPostSize
'            mm = idx - 1
'            For n = 1 To mm
'                If 0 <> IntersectRect(rc, .幚悺椞堟, m僇乕僪攝楍(n).廳側傝挷嵏梡椞堟) Then Exit For
'            Next
'            If n > mm Then Return True
'        End With
'        Return False
'    End Function
'    Private Function aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(ByRef ddd As type僇乕僪乕僨乕僞乕, ByRef o僇乕僪孮椞堟 As RECT, ByRef o僇乕僪孮椞堟撪懁_WD() As Integer, ByRef o僇乕僪孮椞堟撪懁_HT() As Integer, _
'                        ByRef o僇乕僪暆() As Integer, ByRef o僇乕僪崅() As Integer, ByRef o僇乕僪墢偺廳側傝暆() As Integer, ByRef o僇乕僪墢偺廳側傝崅() As Integer, ByRef o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 As Single) As Boolean
'        With ddd
'            If .戝拞彫 < 0.3 Then .戝拞彫 = 1.0#
'            '------------------------------------------------
'            Dim w As Integer = o僇乕僪暆(.僇乕僪宆) * .戝拞彫
'            Dim h As Integer = o僇乕僪崅(.僇乕僪宆) * .戝拞彫
'            Do While w < 16 Or h < 16
'                w = (w * 2.5) \ 2
'                h = (h * 2.5) \ 2
'            Loop
'            w = (w \ 2) * 2 : h = (h \ 2) * 2
'            '------------------------------------------------
'            Dim ww As Integer = (o僇乕僪暆(.僇乕僪宆) - w) \ 2
'            Dim hh As Integer = (o僇乕僪崅(.僇乕僪宆) - h) \ 2
'            Dim x1 As Integer = o僇乕僪孮椞堟.lll + (o僇乕僪孮椞堟撪懁_WD(.僇乕僪宆) * .嵞攝抲梡僙儞僞乕x) + ww
'            Dim y1 As Integer = o僇乕僪孮椞堟.ttt + (o僇乕僪孮椞堟撪懁_HT(.僇乕僪宆) * .嵞攝抲梡僙儞僞乕y) + hh
'            '------------------------------------------------
'            gggint = SetRect(.幚悺椞堟, x1, y1, x1 + w, y1 + h)
'            gggint = InflateRect(.幚悺椞堟, 嘳Rect暆(.幚悺椞堟) * (o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 - 1.0#), 嘳Rect崅(.幚悺椞堟) * (o巆傝枃悢偱僇乕僪僒僀僘曄峏偺攞悢 - 1.0#))
'            Call 嘳RectIntoBigRect(.幚悺椞堟, o僇乕僪孮椞堟) '幚悺椞堟丂傪丂o僇乕僪孮椞堟丂偺撪懁偵堏摦偡傞
'            '------------------------------------------------
'            Dim dx As Integer = o僇乕僪墢偺廳側傝暆(.僇乕僪宆) * .戝拞彫
'            Dim dy As Integer = o僇乕僪墢偺廳側傝崅(.僇乕僪宆) * .戝拞彫
'            With .幚悺椞堟
'                gggint = SetRect(ddd.廳側傝挷嵏梡椞堟, .lll + dx, .ttt + dy, .rrr - dx, .bbb - dy)
'            End With
'        End With
'        Return True
'    End Function
'仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
