Option Strict Off
Option Explicit On
'------------------------------------ 2023/11/09 ------------------------------------
Public Class ClsKanaKana

#Region "愰尵"
    '********************************************************************************
    Public WithEvents DlgFile僇乕僪梡 As frmDlgPctFilesListKana
    Public WithEvents DlgFile僎乕儉梡 As 巐frmDlgPctFilesList
    Public WithEvents 僆僾僔儑儞愝掕Dlg As frmDlgOptionKana
    Public WithEvents 僒僂儞僪愝掕Dlg As frmDlgSoundKana
    Public WithEvents 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg As 巐frmDlgUseCardSelect
    Public WithEvents 偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg As frmDlg僇乕僪宆僇儗儞僩慖戰
    '********************************************************************************
    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 String = "偁傾偄僀偆僂偊僄偍僆偐僇偒僉偔僋偗働偙僐偝僒偟僔偡僗偣僙偦僜偨僞偪僠偮僣偰僥偲僩側僫偵僯偸僰偹僱偺僲偼僴傂僸傆僼傊僿傎儂傑儅傒儈傓儉傔儊傕儌傜儔傝儕傞儖傟儗傠儘傗儎備儐傛儓傢儚傪儝傫儞偑僈偓僊偖僌偘僎偛僑偞僓偠僕偢僘偤僛偧僝偩僟偫僡偯僤偱僨偳僪偽僶傃價傇僽傋儀傏儃傁僷傄僺傉僾傌儁傐億偀傽偂傿偅僁偉僃偋僅傖儍傘儏傚儑偭僢傡儙乣乕儠儠儢儢"
    Private Const c奜榞暆幚悺攞悢 As Single = 0.008
    Private Const c僼儗乕儉儔僀儞暆攞悢 As Single = 0.035
    '********************************************************************************
    Private m僼僅乕儉慡椞堟, m僇乕僪孮椞堟 As RECT
    '僇乕僪堏摦帪偵僼僅乕儉偐傜旘傃弌偟偰偟傑偭偨偐傪僠僃僢僋偡傞 m僼僅乕儉慡椞堟 傪嶌傞丅
    '僇乕僪孮椞堟傪揔惓側僒僀僘偵偡傞
    '********************************************************************************
    Private m僇乕僪偺僒僀僘崅, m僇乕僪偺僒僀僘暆, m僼儗乕儉儔僀儞暆 As Integer
    '********************************************************************************
    Private mRGN奜榞, mRGN昤夋 As Integer    '嶍彍偟偨曄悢丂丂 'mbmp昤夋   2017/09/28 Add  -----  OR Copy + AND Copy丂傪偡傞偨傔偺夋憸 _
    Private mBMP僇乕僪 As Image = Nothing    '2022/09/04 捛壛    OR Copy + AND Copy丂傪偡傞偨傔偺夋憸偺 Object
    '********************************************************************************
    Private Structure type僇乕僪乕僨乕僞乕
        Dim DoDraw As Boolean 'True = 師夞偵昤夋偡傞僼儔僢僌  ---> AutoReDraw 傪巊梡偟側偄僶乕僕儑儞偱偼昁梫偱偁偭偨偑尰嵼偼晄梫丅2019/05/26
        Dim 摉傝嶍彍偢傒 As Boolean '摉傝嶍彍偢傒偵側偭偰偄傟偽   True
        Dim 幚悺椞堟 As RECT '僇乕僪偺僂傿儞僪僂撪偺幚嵺偺幚悺椞堟
        Dim 廳側傝挷嵏梡椞堟 As RECT '廳側傝挷嵏梡偺撪懁偵弅傫偩椞堟
        Dim 嵞攝抲梡僙儞僞乕x As Single '僂僀儞僪僂偺儕僒僀僘側偳偱嵞攝抲偡傞応崌偵丄寁嶼偡傞偨傔偺奺僇乕僪偺僙儞僞乕X
        Dim 嵞攝抲梡僙儞僞乕y As Single '僂僀儞僪僂偺儕僒僀僘側偳偱嵞攝抲偡傞応崌偵丄寁嶼偡傞偨傔偺奺僇乕僪偺僙儞僞乕Y
        Dim 暥帤 As String '奺僇乕僪偺暥帤
        Dim 暥帤怓 As Integer '奺僇乕僪偺暥帤偺怓
        Dim 攚宨怓 As Integer '奺僇乕僪偺攚宨偺怓             2021/06/18 new add ******************
        Dim 榞僽儔僔 As Integer '奺僇乕僪偺榞梡偺僽儔僔 hBrush
        Dim 僸儞僩暥帤 As Boolean '暥帤傪僸儞僩昞帵偡傞
        Dim RGN杮懱 As Integer '2017/12/06 Add  -----  儅僂僗擖椡偺僸僢僩傪僠僃僢僋偡傞偨傔偺儕乕僕儑儞
    End Structure
    Private m僇乕僪攝楍(app嵟戝僇乕僪枃悢) As type僇乕僪乕僨乕僞乕 '慡偰偺僇乕僪乕僨乕僞乕  1丂偐傜巒傑傝丄gc嵟戝僇乕僪枃悢 偵側傞丅
    Private m昤夋専嵏攝楍(app嵟戝僇乕僪枃悢) As Integer '昤夋偲儅僂僗擖椡偺専嵏梡偺慡偰偺僇乕僪乕僨乕僞乕攝楍丂丂儅僂僗偺僋儕僢僋偵傛傝弴彉偑擖傟懼傢傞丅
    Private m僸僢僩僇乕僪0, m僸僢僩僇乕僪1 As Integer
    '********************************************************************************
    Private Const c儐乕僓乕 As String = "儐乕僓乕"
    Private Const cUserCard僗働乕儖婎悢WD As Short = 1000
    Private Const cUserCard僗働乕儖婎悢HT As Short = 1000
    '********************************************************************************
    Private Structure type僇乕僪宆
        Dim 儊僯儏乕僞僀僩儖DEF As String '   ' Dim capDEF As String 
        Dim 儊僯儏乕僞僀僩儖 As String '   '    Dim capUSER As String
        Dim 婎弨斾棪 As Single
        Dim potsDEF() As POINTAPI
        Dim potsUSER() As POINTAPI
        'Dim 儊僯儏乕偵昞帵 As Boolean '
        'Dim 廲墶斾棪 As Single '
        'Dim 婎弨偺攞悢抣墶 As Single '
        'Dim 婎弨偺攞悢抣廲 As Single '
        'Dim 億儕僑儞梫慺悢 As Integer '
        'Dim 億儕僑儞() As POINTAPI '
    End Structure
    Private m僇乕僪宆僨乕僞乕婎杮愝掕(c僇乕僪宆Allmax) As type僇乕僪宆 '慡偰偺僇乕僪宆僨乕僞乕  0丂偐傜巒傑傝丄c僇乕僪宆Allmax 偵側傞丅
    '--------------------------------------------------------------------------------
    Private Const 惎 As String = "仛"
    Private m巊梡僇乕僪孮 As String, m巊梡僇乕僪孮BKUP As String
    '--------------------------------------------------------------------------------
    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 cUser0宍 As Integer = 9 : Private Const cUser1宍 As Integer = 10 : Private Const cUser2宍 As Integer = 11 : Private Const cUser3宍 As Integer = 12
    Private Const cUser4宍 As Integer = 13 : Private Const cUser5宍 As Integer = 14 : Private Const cUser6宍 As Integer = 15 : Private Const cUser7宍 As Integer = 16
    '--------------------------------------------------------------------------------
    Public Const c僇乕僪宆ALLmin As Integer = c巐妏宍  '0
    Public Const c僇乕僪宆APPmax As Integer = c僴乕僩宍  '8
    Public Const c僇乕僪宆USERmin As Integer = cUser0宍 '9
    Public Const c僇乕僪宆Allmax As Integer = cUser7宍  '16
    '********************************************************************************
    Private DoeventCall As Boolean = False
    '********************************************************************************
    Private mImgCardSui柾條 As Image = Nothing
    Private mImgCardSui暥帤 As Image = Nothing
    Private mImgCardSui夋憸 As Image = Nothing
    Private mHBMPCardSui柾條 As Integer = 0
    Private mHBMPCardSui暥帤 As Integer = 0
    Private mHBMPCardSui夋憸 As Integer = 0

    Public Function ppc僇乕僪宆USERmin() As Integer
        Return c僇乕僪宆USERmin 'cUser0宍 '9
    End Function
    Public Function ppc僇乕僪宆Allmax() As Integer
        Return c僇乕僪宆Allmax 'cUser7宍  '16
    End Function

#End Region

#Region "New ....Finalize"
    Public Sub New()
        MyBase.New()
        '********************************************************************************
        '2022/09/02  偙偺僋儔僗偺 .New() 偼丂frmMain.New() 偐傜屇傃弌偝傟傞偺偱丄弞娐嶲徠偺柍尷儖乕僾偵拲堄偡傞偙偲丅
        '********************************************************************************
    End Sub
    Protected Overrides Sub Finalize()
        Call aa僎乕儉廔椆帪偺_BMP偲RGN偺嶍彍()
        gggint = zz僼僅儞僩憖嶌GDIfont(0, 0, 0)
        gggint = p僎乕儉攝怓偺僽儔僔嶍彍()
        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()
        If mImgCardSui柾條 IsNot Nothing Then mImgCardSui柾條.Dispose()
        If mImgCardSui暥帤 IsNot Nothing Then mImgCardSui暥帤.Dispose()
        If mImgCardSui夋憸 IsNot Nothing Then mImgCardSui夋憸.Dispose()
        If mHBMPCardSui柾條 <> 0 Then DeleteObject(mHBMPCardSui柾條)
        If mHBMPCardSui暥帤 <> 0 Then DeleteObject(mHBMPCardSui暥帤)
        If mHBMPCardSui夋憸 <> 0 Then DeleteObject(mHBMPCardSui夋憸)
        MyBase.Finalize()
    End Sub
#End Region

#Region "僇乕僪梡乛僎乕儉梡乛僟僀傾儘僌愝掕"

    Friend Function aa弶婜愝掕僆僽僕僃愝掕() As Boolean
        Dim a As Integer
        For a = 1 To app嵟戝僇乕僪枃悢
            m僇乕僪攝楍(a).暥帤 = Mid(c暥帤楍, a, 1)
        Next
        For a = 1 To app嵟戝僇乕僪枃悢 Step 2
            m僇乕僪攝楍(a).攚宨怓 = 嘳怓RndColor() : m僇乕僪攝楍(a + 1).攚宨怓 = m僇乕僪攝楍(a).攚宨怓
        Next
        '----------------------------------------
        Call aa僇乕僪宆僨乕僞乕撉傒彂偒(1001, "")
        '----------------------------------------
        '2022/09/02  偙偺僋儔僗偺 Sub New() 偼丂frmMain.New() 偐傜屇傃弌偝傟傞偺偱丄Sub New()撪偵埲壓偺僐乕僪傪擖傟傞偲弞娐嶲徠偺柍尷儖乕僾偵側傞丅
        '2023/08/05 new
        mImg尰嵼偺僎乕儉梡 = New Bitmap(2000, 1200)
        mImg尰嵼偺僎乕儉梡Gray = New Bitmap(2000, 1200)
        mImg尰嵼僒僀僘Gray = New Bitmap(2000, 1200)
        With frmMain
            .pctBack.Image = New Bitmap(2000, 1200)
            .pct儊僀儞.Image = New Bitmap(2000, 1200)
            .pct嶌嬈梡.Image = New Bitmap(2000, 1200)
            '----------------------------------------
            .pctCard.Image = New Bitmap(1000, 500)
            .pctCardBmp.Image = New Bitmap(1000, 500)
            '----------------------------------------
            .mDef僇乕僪僀儊乕僕 = .pctCard.Image.Clone
            .pctCard00.Image = .pctCard.Image.Clone
            .pctCard01.Image = .pctCard.Image.Clone
        End With
        '----------------------------------------
        僀儀儞僩gAppEventMaker = gAppEventMaker
        '----------------------------------------
        DlgFile僇乕僪梡 = New frmDlgPctFilesListKana
        gggbol = DlgFile僇乕僪梡.aa弶婜愝掕僆僽僕僃愝掕("僇乕僪梡僼傽僀儖傪愝掕", appDlgFile僇乕僪梡, &HC0C0C0&, False)
        '----------------------------------------
        DlgFile僎乕儉梡 = New 巐frmDlgPctFilesList
        gggbol = DlgFile僎乕儉梡.aa弶婜愝掕僆僽僕僃愝掕("僎乕儉攚宨夋憸僼傽僀儖傪愝掕", gmDlgFile僎乕儉梡, &HAAFFFF&, False)
        '----------------------------------------
        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夋憸僼傽僀儖尰嵼巊梡()
        app偡偖偵僎乕儉傪奐巒 = False
        Dim wChangeDone As Boolean
        Call DlgFile僇乕僪梡_夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨(僼傽僀儖, wChangeDone)     '僇乕僪夋憸傪愝掕偡傞()
        If wChangeDone Then Return 僼傽僀儖 Else Return ""
    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

#End Region

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

    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

        m僸僢僩僇乕僪0 = 0 : m僸僢僩僇乕僪1 = 0
        For a = 1 To app嵟戝僇乕僪枃悢
            m僇乕僪攝楍(a).摉傝嶍彍偢傒 = True
        Next
        With frmMain
            .pctCard00.Visible = False : .pctCard01.Visible = False
        End With
        Call aa僎乕儉廔椆帪偺_BMP偲RGN偺嶍彍()
        For a = 1 To app嵟戝僇乕僪枃悢
            m僇乕僪攝楍(a).摉傝嶍彍偢傒 = True
        Next
        pp僎乕儉僋儕傾忬懺 = True
        frmMain.Tim僇乕僪宆曄峏.Enabled = False
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僞僀儅乕偺僆儞僆僼on僗僀僗僀onff(gmDlgFile僎乕儉梡, False)
        gggstr = 僀儀儞僩gAppEventMaker.MakeEvent僎乕儉奐巒偲掆巭(False, "")
        If Not On僎乕儉奐巒 Then
            gggbol = aa昤夋梡_pctBoxs_僙僢僩Image_僒僀僘偑曄傢偭偰偄側偗傟偽_pct儊僀儞偩偗(frmMain, CStr(CInt(Rnd() * 100000)), On僎乕儉奐巒)
            frmMain.pct儊僀儞.Visible = pp僎乕儉僋儕傾忬懺 Or pp僎乕儉幚峴拞
        End If

        'qqqqq("oo僺僞儁僞.aa僎乕儉僋儕傾()")
        Return True
    End Function

    Friend Function aafrmMain_Paint() As Boolean
        If mBMP僇乕僪 Is Nothing Then Return False
        If pp僎乕儉僋儕傾忬懺 Then Return False 'If gm僆乕儖僋儕傾 Then Return False
        If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then
            Return True 'True 傪曉偡
        ElseIf gm傾僾儕廔椆偡傞 Then
            Return True
        ElseIf frmMain.WindowState = FormWindowState.Minimized Then
            Return True 'True 傪曉偡
        Else
            Try
                If frmMain.pct儊僀儞.Visible = False Then frmMain.pct儊僀儞.Visible = True
                'mmmm = mmmm + 1: qqqqq "aaForm_Paint() 僇乕僪昤夋 " + Format(mmmm, "000")
                Return zz僇乕僪孮昤夋(frmMain.pct儊僀儞.Image)
            Catch ex As Exception
                Return False
            End Try
        End If
    End Function

    Private Function zz僇乕僪孮昤夋(ByVal img As Image) As Boolean
        Try
            Dim g1 As Graphics = Nothing : Dim 嶌嬈梡HDC, GDIbmp, oldBmp As Integer
            If 嘳Image偐傜_GDI梡BMP傪_嶌傝慖戰_屻偱徚偡(1, mBMP僇乕僪, g1, 嶌嬈梡HDC, GDIbmp, oldBmp) Then
                Dim g2 As Graphics = Graphics.FromImage(img)
                If g2 IsNot Nothing Then
                    Dim pct儊僀儞HDC As Integer = g2.GetHdc
                    If pct儊僀儞HDC <> 0 Then
                        Dim a, n As Integer : Dim 奜榞暆 As Integer = zz奜榞暆幚悺()
                        For a = 1 To p尰嵼偺僇乕僪枃悢
                            n = m昤夋専嵏攝楍(a)
                            With m僇乕僪攝楍(n)
                                If (Not .摉傝嶍彍偢傒) And .DoDraw Then
                                    With .幚悺椞堟
                                        gggint = BitBlt(pct儊僀儞HDC, .lll, .ttt, m僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅, 嶌嬈梡HDC, 0, 0, SRCPAINT)
                                        gggint = BitBlt(pct儊僀儞HDC, .lll, .ttt, m僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅, 嶌嬈梡HDC, m僇乕僪偺僒僀僘暆, 0, SRCAND)
                                        With m僇乕僪攝楍(n)
                                            gggint = SelectObject(pct儊僀儞HDC, .RGN杮懱)
                                            Call FrameRgn(pct儊僀儞HDC, .RGN杮懱, .榞僽儔僔, 奜榞暆, 奜榞暆)
                                            gggint = SelectClipRgn(pct儊僀儞HDC, 0)
                                        End With
                                    End With
                                    If .僸儞僩暥帤 = True Then Call zz僇乕僪暥帤昤夋(pct儊僀儞HDC, .幚悺椞堟, n, -1)
                                End If
                                .DoDraw = False
                            End With
                        Next
                        g2.ReleaseHdc(pct儊僀儞HDC)
                    End If
                    g2.Dispose()
                End If
                gggbol = 嘳Image偐傜_GDI梡BMP傪_嶌傝慖戰_屻偱徚偡(2, mBMP僇乕僪, g1, 嶌嬈梡HDC, GDIbmp, oldBmp)
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
            Return False
        End Try
    End Function

    Friend Function zz僇乕僪暥帤昤夋(ByRef hDC As Integer, ByRef rc As RECT, ByRef Index As Integer, ByRef BKcolor As Integer) As Boolean
        '僇乕僪僔儑乕偐傜偺暥帤昤夋偵懳墳偡傞丅
        If BKcolor <> -1 Then gggint = 嘳RectDraw(hDC, rc, BKcolor, 0, 0, 0, 0, False)
        Dim n As Integer
        If Index > app嵟戝僇乕僪枃悢 Then n = 1 Else n = Index
        Dim cap As String = m僇乕僪攝楍(n).暥帤
        Dim rec As RECT
        gggint = CopyRect(rec, rc)
        If 嘳Rect暆(rec) Mod 2 = 1 Then rec.rrr = rec.rrr - 1 '2015/01/23   嬼悢偺崅偝偵偟側偄偲侾僺僋僙儖埵抲偑偢傟傞応崌偑偁傞
        If 嘳Rect崅(rec) Mod 2 = 1 Then rec.bbb = rec.bbb - 1
        '-------------------------------------------------------
        Dim fot As Integer = zz僼僅儞僩憖嶌GDIfont(2, 0, 0)
        gggbol = 嘳僼僅儞僩昤夋_FromGDI(hDC, fot, rec, cap, m僇乕僪攝楍(n).暥帤怓)
        Return True
    End Function

    Private Function zz僸僢僩僇乕僪昤夋幚峴(ByRef m僇乕僪攝楍IDX As Integer, ByRef Curpct As PictureBox) As Boolean
        Dim nnn As Integer
        Dim cdd As type僇乕僪乕僨乕僞乕
        Dim rc As RECT
        nnn = m僇乕僪攝楍IDX
        cdd = m僇乕僪攝楍(nnn)
        With Curpct
            Dim ShiftTop As Integer = frmMain.pct儊僀儞.Top
            .SetBounds(cdd.幚悺椞堟.lll, cdd.幚悺椞堟.ttt + ShiftTop, m僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅)
            Dim hWnd As Integer = .Handle.ToInt32
            If 嘳SetWindowRgnDo(hWnd, mRGN昤夋, 0, 0) Then
                Dim g As Graphics = Graphics.FromImage(Curpct.Image)
                If g IsNot Nothing Then
                    Dim hdc As Integer = g.GetHdc
                    If hdc <> 0 Then
                        gggint = 嘳椞堟撪傪僌儔僨乕僔儑儞僇儔乕偱昤夋(hdc, mRGN昤夋, 4, 12, m僇乕僪攝楍(nnn).攚宨怓, 0.8, True)
                        Call FrameRgn(hdc, mRGN昤夋, cdd.榞僽儔僔, zz奜榞暆幚悺(), zz奜榞暆幚悺())
                        gggint = SetRect(rc, 0, 0, .Width, .Height)
                        gggbol = zz僇乕僪暥帤昤夋(hdc, rc, nnn, -1)
                        g.ReleaseHdc(hdc)
                    End If
                    .Visible = True
                    '僇乕僪偑廳側傞応崌傕偁傞偺偱丄屻偐傜昞帵偝傟傞僇乕僪傪慜柺偵堏摦偡傞丅2014/06/03 add
                    If (m僸僢僩僇乕僪0 <> 0 And m僸僢僩僇乕僪1 <> 0) Then Call SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
                    .Refresh()
                    g.Dispose()
                End If
            End If
        End With
        'qqqqq "zz僸僢僩僇乕僪昤夋幚峴()"
    End Function

    Friend Function aa僇乕僪偺攝抲偲嵞昤夋(ByRef rNew1_WndReSize2_PropChange3 As Integer, Optional ByRef r僇乕僪偺曄峏偩偗幚峴 As Integer = 0, Optional ByRef r僌儗乕儗儀儖偺曄峏 As Boolean = False) As Boolean

        Const c墢偺嵟戝廳側傝 As Single = 0.22 '僇乕僪摨巑偺廳側傞椞堟偺斾棪丅丂0.15丂偱偼柍尷儖乕僾偵側傞
        Const c僇乕僪僒僀僘斾棪 As Single = 0.86 '僇乕僪偑嶵偐傟傞椞堟偲僇乕僪偺戝偒偝偵偐偐傢傞掕悢丅偙傟埲忋斾棪傪戝偒偔偡傞偲柍尷儖乕僾偵側傞 2013/12/11
        '----------------------------------------------------------
        '2020/12/06 add
        Static oold_僇乕僪枃悢 As Integer : Static oold_僼僅儞僩柤 As String : Static oold尰嵼偺僼僅儞僩儃乕儖僪 As Boolean : Static oold尰嵼偺僼僅儞僩僒僀僘攞悢 As Single : Static oold_pct儊僀儞Width As Integer : Static oold_pct儊僀儞Height As Integer
        Static oold僼僅儞僩嶌惉偼幚峴嵪傒 As Boolean = False
        '----------------------------------------------------------
        Dim n, a, mm As Integer
        Dim rc As RECT
        Dim ftsz, w僇乕僪宆攞悢 As Single
        Dim o僇乕僪偺僒僀僘敿暘ww, o僇乕僪偺僒僀僘敿暘hh As Integer
        Dim o嵞攝抲梡僙儞僞乕愝掕 As Boolean
        Dim o僇乕僪孮椞堟撪懁 As RECT
        Dim o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁ll, o僇乕僪孮椞堟撪懁tt, o僇乕僪孮椞堟撪懁hh As Integer
        Dim o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh As Integer
        Dim o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 As Single
        Dim chkcount As Integer
        Dim RetChkAddDelXY As Boolean
        Dim o尰嵼偺僇乕僪枃悢 As Integer
        '----------------------------------------------------------
        'qqqqq "aa僇乕僪偺攝抲偲嵞昤夋 IN " + CStr(rNew1_WndReSize2_PropChange3)
        '----------------------------------------------------------
        If gm傾僾儕廔椆偡傞 Then Return False
        'If frmMain.oLoading Then Return False
        If pp僇乕僪僔儑乕_or_僇乕僪僔儑乕僥僗僩_傪幚峴拞 Then Return False
        If pp僗僀僗僀僼儔僼儔_偄偢傟偐偁傞偄偼椉曽_傪幚峴拞 Then Return False
        If rNew1_WndReSize2_PropChange3 = 1 Then
            pp僎乕儉幚峴拞 = True
        End If
        If pp僎乕儉幚峴拞 = False Then
            'qqqqq "pp僎乕儉幚峴拞 = False"
            Return False
        End If
        '----------------------------------------------------------
        o尰嵼偺僇乕僪枃悢 = p尰嵼偺僇乕僪枃悢
        '----------------------------------------------------------
        '怴婯偵攝傞偐丄僼僅乕儉儕僒僀僘偺応崌偵偼丄丄丄
        If (rNew1_WndReSize2_PropChange3 <> 3) Or r僇乕僪偺曄峏偩偗幚峴 > 0 Then
            '僇乕僪堏摦帪偵僼僅乕儉偐傜旘傃弌偟偰偟傑偭偨偐傪僠僃僢僋偡傞 w僼僅乕儉慡椞堟 傪嶌傞丅
            With m僼僅乕儉慡椞堟
                .lll = 0 : .ttt = 0 : .rrr = frmMain.pct儊僀儞.Width : .bbb = frmMain.pct儊僀儞.Height
            End With
            '僇乕僪孮椞堟傪揔惓側僒僀僘偵偡傞
            With m僇乕僪孮椞堟
                Dim xxyy As Single
                xxyy = Math.Min(frmMain.pct儊僀儞.Width, frmMain.pct儊僀儞.Height) \ 60
                'qqqqq(CStr(frmMain.ClientSize.Height) & "  " & CStr(frmMain.pct儊僀儞.Height))
                .lll = xxyy : .ttt = xxyy : .rrr = (frmMain.pct儊僀儞.Width) - xxyy : .bbb = (frmMain.pct儊僀儞.Height) - xxyy
                .lll = 嘳悢抣斖埻Int(0, ((Screen.PrimaryScreen.Bounds.Width)) - app僇乕僪孮椞堟嵟彫僒僀僘, .lll)
                .ttt = 嘳悢抣斖埻Int(0, ((Screen.PrimaryScreen.Bounds.Height)) - app僇乕僪孮椞堟嵟彫僒僀僘, .ttt)
            End With
            '*****************************************************************************************************
            '怴偟偔僇乕僪傪攝傞応崌偼丄偁傞偄偼傾僾儕僗僞乕僩帪偺儕僒僀僘偱偼丄嵞攝抲梡僙儞僞乕x, y 傪愝掕偡傞
            o嵞攝抲梡僙儞僞乕愝掕 = (rNew1_WndReSize2_PropChange3 = 1 Or m僇乕僪攝楍(1).嵞攝抲梡僙儞僞乕x = 0)
            If o嵞攝抲梡僙儞僞乕愝掕 Then Call aa僎乕儉僋儕傾(True)
            '*****************************************************************************************************
            '*****************************************************************************************************
            '僇乕僪偺僒僀僘偺幚悺傪愝掕偡傞
            o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪 = c僇乕僪僒僀僘斾棪 / System.Math.Sqrt(o尰嵼偺僇乕僪枃悢 ^ 0.9 / 0.7) '偙傟埲忋斾棪傪戝偒偔偡傞偲柍尷儖乕僾偵側傞 2013/12/11
            '*****************************************************************************************************
            o僇乕僪偺僒僀僘敿暘ww = 0.5 * (嘳Rect暆(m僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪)
            o僇乕僪偺僒僀僘敿暘hh = 0.5 * (嘳Rect崅(m僇乕僪孮椞堟) * o僇乕僪偺戝偒偝偲嶵偔椞堟偺斾棪)
            '-------------------------------------------
            w僇乕僪宆攞悢 = 1.0#
            gggbol = aa僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(False, (p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX), o僇乕僪偺僒僀僘敿暘ww * 2, o僇乕僪偺僒僀僘敿暘hh * 2, mRGN昤夋, mRGN奜榞, w僇乕僪宆攞悢, m僼儗乕儉儔僀儞暆, m僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅)
            '-------------------------------------------
            o僇乕僪偺僒僀僘敿暘ww = 0.5 * m僇乕僪偺僒僀僘暆 : o僇乕僪偺僒僀僘敿暘hh = 0.5 * m僇乕僪偺僒僀僘崅
            With m僇乕僪孮椞堟
                gggint = SetRect(o僇乕僪孮椞堟撪懁, .lll + o僇乕僪偺僒僀僘敿暘ww, .ttt + o僇乕僪偺僒僀僘敿暘hh, .rrr - o僇乕僪偺僒僀僘敿暘ww, .bbb - o僇乕僪偺僒僀僘敿暘hh)
            End With
            '-------------------------------------------
            o僇乕僪孮椞堟撪懁ll = o僇乕僪孮椞堟撪懁.lll : o僇乕僪孮椞堟撪懁tt = o僇乕僪孮椞堟撪懁.ttt
            o僇乕僪孮椞堟撪懁ww = 嘳Rect暆(o僇乕僪孮椞堟撪懁) : o僇乕僪孮椞堟撪懁hh = 嘳Rect崅(o僇乕僪孮椞堟撪懁)
            o僆僼僙僢僩X = o僇乕僪孮椞堟撪懁ll - o僇乕僪偺僒僀僘敿暘ww : o僆僼僙僢僩Y = o僇乕僪孮椞堟撪懁tt - o僇乕僪偺僒僀僘敿暘hh
            o僇乕僪偺僒僀僘廳側傝墢ww = m僇乕僪偺僒僀僘暆 * c墢偺嵟戝廳側傝 : o僇乕僪偺僒僀僘廳側傝墢hh = m僇乕僪偺僒僀僘崅 * c墢偺嵟戝廳側傝
            '*****************************************************************************************************
            Randomize()
            For a = 1 To o尰嵼偺僇乕僪枃悢
                With m僇乕僪攝楍(a)
                    '***************************************************************************
                    If r僇乕僪偺曄峏偩偗幚峴 = 1 Then
                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                        '***************************************************************************
                    Else
                        If o嵞攝抲梡僙儞僞乕愝掕 Then
                            '------------------------------
                            chkcount = 0
                            '------------------------------
                            .摉傝嶍彍偢傒 = False

                            Do
                                .嵞攝抲梡僙儞僞乕x = Rnd()
                                .嵞攝抲梡僙儞僞乕y = Rnd()
                                gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                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
                                    gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                    If RetChkAddDelXY Then
                                        '                                qqqqq "OK ChkAddDelXY 1"
                                        Exit Do
                                    Else
                                        .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.96
                                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                        If RetChkAddDelXY Then
                                            '                                    qqqqq "OK ChkAddDelXY 2"
                                            Exit Do
                                        Else
                                            .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 0.98
                                            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                            If RetChkAddDelXY Then
                                                '                                        qqqqq "OK ChkAddDelXY 3"
                                                Exit Do
                                            Else
                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
                                                gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                                If RetChkAddDelXY Then
                                                    '                                            qqqqq "OK ChkAddDelXY 4"
                                                    Exit Do
                                                Else
                                                    .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 1.02
                                                    gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                                    If RetChkAddDelXY Then
                                                        '                                                qqqqq "OK ChkAddDelXY 5"
                                                        Exit Do
                                                    Else
                                                        .嵞攝抲梡僙儞僞乕y = .嵞攝抲梡僙儞僞乕y * 1.04
                                                        gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                                        If RetChkAddDelXY Then
                                                            '                                                    qqqqq "OK ChkAddDelXY 6"
                                                            Exit Do
                                                        Else
                                                            .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
                                                            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                                            If RetChkAddDelXY Then
                                                                '                                                        qqqqq "OK ChkAddDelXY 7"
                                                                Exit Do
                                                            Else
                                                                .嵞攝抲梡僙儞僞乕x = .嵞攝抲梡僙儞僞乕x * 0.98
                                                                gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(RetChkAddDelXY, rc, a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                                                                If RetChkAddDelXY Then
                                                                    '                                                            qqqqq "OK ChkAddDelXY 8"
                                                                    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 > 1000 Then
                                    'qqqqq "@@ 嵞攝抲 Loop Over 1000"
                                    Exit Do
                                End If
                                '------------------------------
                            Loop
                            m昤夋専嵏攝楍(a) = a
                            'If chkcount > 100 Then qqqqq CStr(chkcount)
                        Else
                            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
                        End If
                    End If
                End With
            Next
            'qqqqq "嵞攝抲 Loop End *****************" + vbCrLf
        End If
        '-------------------------------------------
        If mRGN昤夋 = 0 Then
            qqqqq("Error in aa僇乕僪偺攝抲偲嵞昤夋()  mRGN昤夋 = 0 ")
        Else
            '-------------------------------------------
            If oold_僇乕僪枃悢 <> p尰嵼偺僇乕僪枃悢 Or oold_僼僅儞僩柤 <> p僼僅儞僩柤 Or oold尰嵼偺僼僅儞僩儃乕儖僪 <> p尰嵼偺僼僅儞僩儃乕儖僪 Or _
                    oold尰嵼偺僼僅儞僩僒僀僘攞悢 <> p尰嵼偺僼僅儞僩僒僀僘攞悢 Or oold_pct儊僀儞Width <> frmMain.pct儊僀儞.Width Or oold_pct儊僀儞Height <> frmMain.pct儊僀儞.Height Then
                ftsz = CSng(Math.Min(m僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅) * 0.55 * p尰嵼偺僼僅儞僩僒僀僘攞悢)
                p尰嵼偺僼僅儞僩僒僀僘 = ftsz
                gggint = zz僼僅儞僩憖嶌GDIfont(1, 0, 0)
                oold僼僅儞僩嶌惉偼幚峴嵪傒 = True
                'qqqqq("aa僇乕僪偺攝抲偲嵞昤夋()  僼僅儞僩嶌惉")
            End If
            oold_僇乕僪枃悢 = p尰嵼偺僇乕僪枃悢 : oold_僼僅儞僩柤 = p僼僅儞僩柤 : oold尰嵼偺僼僅儞僩儃乕儖僪 = p尰嵼偺僼僅儞僩儃乕儖僪 : oold尰嵼偺僼僅儞僩僒僀僘攞悢 = p尰嵼偺僼僅儞僩僒僀僘攞悢 : oold_pct儊僀儞Width = frmMain.pct儊僀儞.Width : oold_pct儊僀儞Height = frmMain.pct儊僀儞.Height
            'qqqqq "oold  僇乕僪枃悢 / 僼僅儞僩柤 / FormWD / HT = " + CStr(oold_僇乕僪枃悢) + " / " + CStr(oold_僼僅儞僩柤) + " / " + CStr(oold_frmMain_ScaleWidth) + " / " + CStr(oold_frmMain_ScaleHeight)
            '-------------------------------------------
            Call zz尰嵼偺柾條偁傞偄偼夋憸偺僐僺乕尦偲儅僗僋傪嶌惉(m僼儗乕儉儔僀儞暆)
            '-------------------------------------------
            'm僇乕僪偺僒僀僘暆, m僇乕僪偺僒僀僘崅 偑曄峏偝傟傞応崌偑偁傝偆傞
            For a = 1 To o尰嵼偺僇乕僪枃悢
                With m僇乕僪攝楍(a).幚悺椞堟
                    gggint = SetRect(m僇乕僪攝楍(a).幚悺椞堟, .lll, .ttt, .lll + m僇乕僪偺僒僀僘暆, .ttt + m僇乕僪偺僒僀僘崅)
                End With
            Next
            '-------------------------------------------
            If m僸僢僩僇乕僪0 <> 0 Then Call zz僸僢僩僇乕僪昤夋幚峴(m僸僢僩僇乕僪0, frmMain.pctCard00)
            If m僸僢僩僇乕僪1 <> 0 Then Call zz僸僢僩僇乕僪昤夋幚峴(m僸僢僩僇乕僪1, frmMain.pctCard01)
            '-------------------------------------------
            For a = 1 To o尰嵼偺僇乕僪枃悢 : m僇乕僪攝楍(m昤夋専嵏攝楍(a)).DoDraw = True : Next
            '-------------------------------------------
            gggint = p僸儞僩昞帵偺嵞愝掕傪幚峴()
            '**************************************************************
            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巆傝僇乕僪偑側偄())   'gm僎乕儉幚峴拞 = 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 "aa僇乕僪偺攝抲偲嵞昤夋  " + CStr(rNew1_WndReSize2_PropChange3)
        End If
        Return True
    End Function
    '******************************************************************************************************************************************************************************************
    Private Function aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(ByVal a As Integer, ByVal o僇乕僪孮椞堟撪懁ww As Integer, ByVal o僇乕僪孮椞堟撪懁hh As Integer, _
                                   ByVal o僆僼僙僢僩X As Integer, ByVal o僆僼僙僢僩Y As Integer, ByVal o僇乕僪偺僒僀僘廳側傝墢ww As Integer, ByVal o僇乕僪偺僒僀僘廳側傝墢hh As Integer) As Boolean
        Dim x1, y1 As Integer
        With m僇乕僪攝楍(a)
            x1 = o僆僼僙僢僩X + (o僇乕僪孮椞堟撪懁ww * .嵞攝抲梡僙儞僞乕x)
            y1 = o僆僼僙僢僩Y + (o僇乕僪孮椞堟撪懁hh * .嵞攝抲梡僙儞僞乕y)
            gggint = SetRect(.幚悺椞堟, x1, y1, x1 + m僇乕僪偺僒僀僘暆, y1 + m僇乕僪偺僒僀僘崅)
            With .幚悺椞堟
                gggint = SetRect(m僇乕僪攝楍(a).廳側傝挷嵏梡椞堟, .lll + o僇乕僪偺僒僀僘廳側傝墢ww, .ttt + o僇乕僪偺僒僀僘廳側傝墢hh, .rrr - o僇乕僪偺僒僀僘廳側傝墢ww, .bbb - o僇乕僪偺僒僀僘廳側傝墢hh)
            End With
            '-------------------------------------------
            If .RGN杮懱 <> 0 Then gggint = DeleteObject(.RGN杮懱)
            .RGN杮懱 = 0
            .RGN杮懱 = CreateRectRgn(0, 0, 1, 1) : gggint = CombineRgn(.RGN杮懱, mRGN昤夋, mRGN昤夋, RGN_COPY) : gggint = OffsetRgn(.RGN杮懱, x1, y1)
            '-------------------------------------------
        End With
        Return True
    End Function
    Private Function aa僇乕僪偺攝抲偲嵞昤夋_SUB_ChkAddDelXY(ByRef RetChkAddDelXY As Boolean, ByRef rc As RECT, ByVal a As Integer, ByVal o僇乕僪孮椞堟撪懁ww As Integer, ByVal o僇乕僪孮椞堟撪懁hh As Integer, _
                                   ByVal o僆僼僙僢僩X As Integer, ByVal o僆僼僙僢僩Y As Integer, ByVal o僇乕僪偺僒僀僘廳側傝墢ww As Integer, ByVal o僇乕僪偺僒僀僘廳側傝墢hh As Integer) As Boolean
        Dim mm, n As Integer
        RetChkAddDelXY = False
        With m僇乕僪攝楍(a)
            .嵞攝抲梡僙儞僞乕x = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕x)
            .嵞攝抲梡僙儞僞乕y = 嘳悢抣斖埻Sng(0.0#, 1.0#, .嵞攝抲梡僙儞僞乕y)
            gggbol = aa僇乕僪偺攝抲偲嵞昤夋_SUB_SetNewPostSize(a, o僇乕僪孮椞堟撪懁ww, o僇乕僪孮椞堟撪懁hh, o僆僼僙僢僩X, o僆僼僙僢僩Y, o僇乕僪偺僒僀僘廳側傝墢ww, o僇乕僪偺僒僀僘廳側傝墢hh)
            mm = a - 1
            For n = 1 To mm
                If 0 <> IntersectRect(rc, .幚悺椞堟, m僇乕僪攝楍(n).廳側傝挷嵏梡椞堟) Then Exit For
            Next
            If n > mm Then RetChkAddDelXY = True
        End With
        Return True
    End Function
    '******************************************************************************************************************************************************************************************
    Private Function zz僼僅儞僩憖嶌GDIfont(ByVal op As Integer, ByVal rHDC As Integer, ByRef rwoldFont As Integer) As Integer
        Static mGDIfont As Integer = 0
        Select Case op
            Case 1 'Make
                If mGDIfont <> 0 Then DeleteObject(mGDIfont)
                mGDIfont = 0
                Dim fn As String = p僼僅儞僩柤
                Dim fs As Single = p尰嵼偺僼僅儞僩僒僀僘
                Dim fb As FontStyle = IIf(p尰嵼偺僼僅儞僩儃乕儖僪, FontStyle.Bold, FontStyle.Regular)
                Dim newFont As New Font(fn, fs, fb)
                mGDIfont = newFont.ToHfont()
            Case 2 'Get Handle
                Return mGDIfont
            Case 0 ' App End Delete
                If mGDIfont <> 0 Then DeleteObject(mGDIfont)
                mGDIfont = 0
        End Select
    End Function

    Private Function zz尰嵼偺柾條偁傞偄偼夋憸偺僐僺乕尦偲儅僗僋傪嶌惉(ByRef r僼儗乕儉儔僀儞暆 As Integer) As Boolean
        '-------------------------------------------------------------------
        Dim xx, yy As Integer : Dim rc As RECT
        Call GetRgnBox(mRGN昤夋, rc) : xx = 嘳Rect暆(rc) : yy = 嘳Rect崅(rc)
        '-------------------------------------------------------------------
        If mBMP僇乕僪 Is Nothing Then mBMP僇乕僪 = frmMain.pct嶌嬈梡.Image.Clone
        mBMP僇乕僪.Dispose()
        'qqqqq("mBMP僇乕僪.Dispose()")
        mBMP僇乕僪 = New Bitmap(xx * 2, yy)
        '-------------------------------------------------------------------
        Dim pctBmpImg As Image
        pctBmpImg = frmMain.pctCardBmp.Image.Clone()
        gggbol = 嘳BmpPctBox柧傞偔埫偔偡傞_BitsByteAry(pctBmpImg, p僇乕僪偺柧傞偝 * 2)
        '-------------------------------------------------------------------
        Dim gg As Graphics = Graphics.FromImage(mBMP僇乕僪)
        If gg IsNot Nothing Then
            Dim 嶌嬈梡HDC As Integer = gg.GetHdc
            If 嶌嬈梡HDC <> 0 Then
                If 0 <> SetRect(rc, 0, 0, xx, yy) Then
                    If 嘳RectDraw_White_Or_Black(嶌嬈梡HDC, rc, 0) Then
                        If 0 <> OffsetRect(rc, xx, 0) Then
                            If 嘳RectDraw_White_Or_Black(嶌嬈梡HDC, rc, 1) Then
                                gggint = FillRgn(嶌嬈梡HDC, mRGN昤夋, GetStockObject(WHITE_BRUSH))
                            End If
                        End If
                    End If
                End If
                '----------------------------------------------------------------------
                Dim g As Graphics = Nothing : Dim BmpHDC As Integer, GDIbmp As Integer, oldbmp As Integer
                '----------------------------------------------------------------------
                If 嘳Image偐傜_GDI梡BMP傪_嶌傝慖戰_屻偱徚偡(1, pctBmpImg, g, BmpHDC, GDIbmp, oldbmp) Then
                    '----------------------------------------------------------------------
                    gggint = OffsetRgn(mRGN昤夋, xx, 0) : If mRGN奜榞 <> 0 Then gggint = OffsetRgn(mRGN奜榞, xx, 0)
                    '----------------------------------------------------------------------
                    If 0 <> SelectClipRgn(嶌嬈梡HDC, mRGN昤夋) Then
                        If 0 <> SetStretchBltMode(嶌嬈梡HDC, COLORONCOLOR) Then
                            'pctBmpImg丂廲偲墶偺丂僒僀僘偵傛傝挷惍偑昁梫
                            Dim wLeft, wTop, wWidth, wHeight As Integer
                            gggbol = 嘳僒僀僘寁嶼_庴偗偵崌傢偣偰_憲傝傪僩儕儈儞僌(xx, yy, pctBmpImg.Width, pctBmpImg.Height, wLeft, wTop, wWidth, wHeight)
                            gggint = StretchBlt(嶌嬈梡HDC, xx, 0, xx, yy, BmpHDC, wLeft, wTop, wWidth, wHeight, SRCCOPY)
                            If gggint <> 0 Then
                                Dim Brsh榞 As Integer = GetStockObject(WHITE_BRUSH)
                                If Brsh榞 <> 0 Then
                                    If mRGN奜榞 <> 0 Then
                                        If 0 <> SelectClipRgn(嶌嬈梡HDC, mRGN奜榞) Then
                                            gggint = FillRgn(嶌嬈梡HDC, mRGN奜榞, Brsh榞)
                                            gggint = SelectClipRgn(嶌嬈梡HDC, mRGN昤夋)
                                        End If
                                    Else
                                        If r僼儗乕儉儔僀儞暆 > 0 Then gggint = FrameRgn(嶌嬈梡HDC, mRGN昤夋, Brsh榞, r僼儗乕儉儔僀儞暆, r僼儗乕儉儔僀儞暆)
                                    End If
                                    gggint = DeleteObject(Brsh榞)
                                End If
                                Dim 奜榞暆幚悺 As Integer = zz奜榞暆幚悺()
                                If 奜榞暆幚悺 > 0 Then
                                    Dim Brsh慄 As Integer = CreateSolidBrush(255)
                                    If Brsh慄 <> 0 Then
                                        gggint = FrameRgn(嶌嬈梡HDC, mRGN昤夋, Brsh慄, 奜榞暆幚悺, 奜榞暆幚悺)
                                        gggint = DeleteObject(Brsh慄)
                                    End If
                                End If
                            End If
                            gggint = SelectClipRgn(嶌嬈梡HDC, 0)
                        End If
                    End If
                    '----------------------------------------------------------------------
                    gggint = OffsetRgn(mRGN昤夋, -xx, 0) : If mRGN奜榞 <> 0 Then gggint = OffsetRgn(mRGN奜榞, -xx, 0)
                    '----------------------------------------------------------------------
                    gggbol = 嘳Image偐傜_GDI梡BMP傪_嶌傝慖戰_屻偱徚偡(2, pctBmpImg, g, BmpHDC, GDIbmp, oldbmp)
                    '----------------------------------------------------------------------
                End If
                gg.ReleaseHdc(嶌嬈梡HDC)
                嶌嬈梡HDC = 0
            End If
            gg.Dispose()
        End If
        Return True
    End Function

    Friend Function aa僗僀僗僀僇乕僪昤夋(ByVal op As Integer, ByVal hdc As Integer, ByVal bmpWH As Integer, ByVal Index As Integer) As Boolean
        Static mfont As Integer
        Select Case op
            Case 1 'Make font
                If mfont <> 0 Then DeleteObject(mfont)
                mfont = 0
                Dim fn As String = p僼僅儞僩柤
                Dim fs As Single = CSng(bmpWH * 0.55 * p尰嵼偺僼僅儞僩僒僀僘攞悢) ''''''''''''p尰嵼偺僼僅儞僩僒僀僘
                Dim fb As FontStyle = IIf(p尰嵼偺僼僅儞僩儃乕儖僪, FontStyle.Bold, FontStyle.Regular)
                Dim newFont As New Font(fn, fs, fb)
                mfont = newFont.ToHfont()
            Case 2 'draw card
                If hdc <> 0 And mfont <> 0 Then
                    Dim x As Integer = bmpWH * (Index - 1)
                    Dim rgn As Integer, rc As RECT
                    rgn = CreateRectRgn(x, 0, x + bmpWH, bmpWH)
                    gggint = SetRect(rc, x, 0, x + bmpWH, bmpWH)
                    With m僇乕僪攝楍(Index)
                        Dim ccc As Integer = 嘳HalfColor柧傞偔偡傞(.攚宨怓, 0.5) ''''僇乕僪偺柧傞偝偺愝掕偼偙偙偱幚峴
                        gggint = 嘳椞堟撪傪僌儔僨乕僔儑儞僇儔乕偱昤夋(hdc, rgn, 2, 12, ccc, 0.95, True)
                        Dim 奜榞暆 As Integer = Math.Max(1, CInt((bmpWH + bmpWH) * c奜榞暆幚悺攞悢))
                        Call FrameRgn(hdc, rgn, .榞僽儔僔, 奜榞暆, 奜榞暆)
                        '-------------------------------------------------------
                        gggbol = 嘳僼僅儞僩昤夋_FromGDI(hdc, mfont, rc, .暥帤, .暥帤怓)
                    End With
                End If
            Case 3 ' Delete font
                If mfont <> 0 Then DeleteObject(mfont)
                mfont = 0
        End Select
        Return True
    End Function

    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 = 夋憸
        Static mCoun僩乕僞儖, mCount柾條, mCount暥帤, mCount夋憸, 僀儊乕僕僞僀僾, 尰嵼偺僇乕僪夋憸搊榐枃悢 As Integer
        Static mCoun僩乕僞儖Mode123 As Integer
        Const bmpWH As Integer = 200 : Const 夋憸WD As Integer = 300
        Select Case op
            Case 100 'Make bitmap image   柾條丂乛丂僇僫暥帤丂乛丂夋憸
                '-----------------------------------------------------
                If mHBMPCardSui柾條 = 0 Then
                    frmMain.Cursor = Cursors.WaitCursor
                End If
                '-----------------------------------------------------
                gggbol = DlgFile僇乕僪梡.aa僗僀僗僀憖嶌_MakeBmp(bmpWH, 夋憸WD, mImgCardSui柾條, mImgCardSui暥帤, mImgCardSui夋憸, 尰嵼偺僇乕僪夋憸搊榐枃悢)
                Dim bm As Bitmap
                If mHBMPCardSui柾條 = 0 Then
                    bm = mImgCardSui柾條 : mHBMPCardSui柾條 = bm.GetHbitmap
                End If
                If mHBMPCardSui暥帤 = 0 Then
                    bm = mImgCardSui暥帤 : mHBMPCardSui暥帤 = bm.GetHbitmap
                End If
                If mHBMPCardSui夋憸 <> 0 Then
                    gggint = DeleteObject(mHBMPCardSui夋憸)
                End If
                bm = mImgCardSui夋憸 : mHBMPCardSui夋憸 = bm.GetHbitmap
                '-----------------------------------------------------
                If frmMain.Cursor <> Cursors.Default Then
                    frmMain.Cursor = Cursors.Default
                End If
                '-----------------------------------------------------
            Case 200   '尰嵼偺柾條偲夋憸僀儞僨僢僋僗傪儕僙僢僩
                mCoun僩乕僞儖 = 0
                mCount暥帤 = 0
                mCount柾條 = 0
                mCount夋憸 = 0
                僀儊乕僕僞僀僾 = 0
                mCoun僩乕僞儖Mode123 = 0
                '-----------------------------------------------------
            Case 300
                '0 = 儈僢僋僗     '1 = 暥帤     '2 = 傕傛偆     '3 = 夋憸
                僀儊乕僕僞僀僾 = 僗僀僗僀_僇乕僪僔儑乕_僇乕僪僀儊乕僕僞僀僾
                If 僀儊乕僕僞僀僾 = 0 Then '僇乕僪僀儊乕僕 儈僢僋僗
                    僀儊乕僕僞僀僾 = (mCoun僩乕僞儖 Mod 3) + 1
                    mCoun僩乕僞儖Mode123 = 1
                Else
                    mCoun僩乕僞儖Mode123 = 僀儊乕僕僞僀僾
                End If
                mCoun僩乕僞儖 = mCoun僩乕僞儖 + 1
                '-----------------------------------------------------
                Dim nnn As Integer
                If 僀儊乕僕僞僀僾 = 1 Then '
                    nnn = mCount暥帤 + 1
                    If nnn > app嵟戝僇乕僪枃悢 Then nnn = 1
                Else
                    nnn = curindex
                End If
                Brsh慄 = IIf(nnn Mod 2 = 1, Brsh巐杮(3), Brsh巐杮(4))
                榞暆幚悺梡偺攞悢 = 0.023
                惓曽宍偵偡傞 = (僀儊乕僕僞僀僾 <> 3)
                摿暿側攞悢 = 0.9
                '-----------------------------------------------------
            Case 350
                奜榞暆幚悺 = 嘳悢抣斖埻Int(1, 20, Math.Max(1, 榞暆幚悺 \ 3)) '偙偺抣偩偗偼丂榞暆幚悺 偺抣偵婎偯偄偰嵞愝掕偡傞
                Dim ww, hh As Integer
                ww = (夋暆 + 夋崅) \ 2
                If mCoun僩乕僞儖Mode123 = 3 Then
                    hh = (ww * 4) \ 5 : ww = (ww * 5) \ 4
                Else
                    hh = ww
                End If
                Rgn夋 = CreateRectRgn(0, 0, ww, hh)
                Rgn榞 = 0
                '-----------------------------------------------------
            Case 500 '夋憸昤夋
                If 僗僀僗僀_僇乕僪僔儑乕_僇乕僪僀儊乕僕僞僀僾 = 0 Then  'mix
                    僀儊乕僕僞僀僾 = mCoun僩乕僞儖Mode123
                End If
                Dim ww, hh, mCount As Integer
                '-----------------------------------------------------
                hh = bmpWH
                If 僀儊乕僕僞僀僾 = 3 Then ww = 夋憸WD Else ww = bmpWH
                '-----------------------------------------------------
                Dim curbmp As Integer
                Select Case 僀儊乕僕僞僀僾
                    Case 1 : curbmp = mHBMPCardSui暥帤 : mCount = mCount暥帤
                    Case 2 : curbmp = mHBMPCardSui柾條 : mCount = mCount柾條
                    Case 3 : curbmp = mHBMPCardSui夋憸 : mCount = mCount夋憸
                End Select
                Dim rc As RECT
                gggint = GetRgnBox(Rgn夋, rc)
                Dim xx As Integer = 嘳Rect暆(rc)
                Dim yy As Integer = 嘳Rect崅(rc)
                Dim tmp00 As Integer = SelectObject(ghDC1, bmp庴偗)
                If tmp00 <> 0 Then
                    Dim tmp11 As Integer = SelectObject(ghDC2, curbmp)
                    If tmp11 <> 0 Then
                        gggbol = 嘳BitMapCopyDoDo(ghDC1, ghDC2, rc.lll, 0, xx, yy, ww * mCount, 0, ww, hh)
                        gggint = SelectObject(ghDC2, tmp11)
                    End If
                    If 奜榞暆幚悺 > 0 Then     ' 僘乕儉儌乕僪偱側偗傟偽丂丂丂奜榞傪昤夋丂
                        Dim brs As Integer
                        If 僀儊乕僕僞僀僾 = 1 Then
                            brs = Brsh巐杮(IIf(mCount暥帤 Mod 2 = 0, 3, 4))
                        Else
                            brs = GetStockObject(BLACK_BRUSH)
                        End If
                        Call FrameRgn(ghDC1, Rgn夋, brs, 奜榞暆幚悺, 奜榞暆幚悺)
                    End If
                    gggint = SelectObject(ghDC1, tmp00)
                End If
                '-----------------------------------------------------
                '師偵弨旛偟偰僇僂儞僩傾僢僾
                If 僀儊乕僕僞僀僾 = 1 Then '暥帤   
                    mCount暥帤 = mCount暥帤 + 1
                    If mCount暥帤 > (app嵟戝僇乕僪枃悢 - 1) Then mCount暥帤 = 0
                ElseIf 僀儊乕僕僞僀僾 = 2 Then  '柾條    
                    mCount柾條 = mCount柾條 + 1
                    If mCount柾條 > 3 Then mCount柾條 = 0
                ElseIf 僀儊乕僕僞僀僾 = 3 Then  '夋憸
                    mCount夋憸 = mCount夋憸 + 1
                    If mCount夋憸 > (尰嵼偺僇乕僪夋憸搊榐枃悢 - 1) - 4 Then mCount夋憸 = 0
                End If
                '-----------------------------------------------------
                If 僗僀僗僀_僇乕僪僔儑乕_僇乕僪僀儊乕僕僞僀僾 = 0 Then  'mix
                    mCoun僩乕僞儖Mode123 = mCoun僩乕僞儖Mode123 + 1
                    If mCoun僩乕僞儖Mode123 > 3 Then mCoun僩乕僞儖Mode123 = 1
                End If
        End Select
        Return True
    End Function

    Friend Function aa僼僅乕儉儅僂僗僀儀儞僩張棟(ByRef X As Integer, ByRef Y As Integer, ByVal pctCard00 As PictureBox, ByVal pctCard01 As PictureBox, ByRef wGameEnd As Boolean) As Boolean
        '************************************************
        Static 僇僂儞僩傾僢僾尰嵼偺抣 As Integer
        wGameEnd = False
        '************************************************
        If DoeventCall Then Return False
        '************************************************
        If gm傾僾儕廔椆偡傞 Then Return False
        gm僎乕儉幚峴拞_in_MouseEvent = True
        gm僎乕儉幚峴拞_in_MouseUp_張棟拞 = True
        '************************************************
        Dim n, a, b, HitID As Integer
        Dim o尰嵼偺僇乕僪枃悢 As Integer = p尰嵼偺僇乕僪枃悢
        '************************************************
        If X = -123456789 Then
            '僼乕儉僒僀僘偑曄峏偝傟偨屻偱偺丄僎乕儉怴婯僗僞乕僩帪偺儕僙僢僩張棟
            gm僎乕儉幚峴拞_in_MouseEvent = False
            gm僎乕儉幚峴拞_in_MouseUp_張棟拞 = False
            m僸僢僩僇乕僪0 = 0 : m僸僢僩僇乕僪1 = 0 : pctCard00.Visible = False : pctCard01.Visible = False
            'qqqqq("FormReSize Call aa僼僅乕儉儅僂僗僀儀儞僩張棟()")
            '************************************************
            '俀枃偑昞帵偝傟偰偄傟偽
        ElseIf m僸僢僩僇乕僪0 <> 0 And m僸僢僩僇乕僪1 <> 0 Then
            '僇乕僪偺弴埵傪攝楍偺嵟忋埵偵堏摦偡傞
            HitID = m僸僢僩僇乕僪0
            gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_AryItemShiftDown(o尰嵼偺僇乕僪枃悢, HitID)
            HitID = m僸僢僩僇乕僪1
            gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_AryItemShiftDown(o尰嵼偺僇乕僪枃悢, HitID)
            '暥帤偑堦抳偟偰偄傟偽
            If zz僇乕僪堦抳僠僃僢僋() Then
                m僇乕僪攝楍(m僸僢僩僇乕僪0).摉傝嶍彍偢傒 = True : m僇乕僪攝楍(m僸僢僩僇乕僪0).DoDraw = False
                m僇乕僪攝楍(m僸僢僩僇乕僪1).摉傝嶍彍偢傒 = True : m僇乕僪攝楍(m僸僢僩僇乕僪1).DoDraw = False
                '**************************************************************************
                '**************************************************************************
                '摉傝僇乕僪偺徚嫀傪偡傞
                Dim rcchk As RECT : Dim b1, b2 As Boolean
                For a = p尰嵼偺僇乕僪枃悢 To 1 Step -1
                    n = m昤夋専嵏攝楍(a)
                    With m僇乕僪攝楍(n)
                        b1 = False : b2 = False
                        If .摉傝嶍彍偢傒 = False Then
                            b1 = (0 <> IntersectRect(rcchk, .幚悺椞堟, m僇乕僪攝楍(m僸僢僩僇乕僪0).幚悺椞堟))
                            b2 = (0 <> IntersectRect(rcchk, .幚悺椞堟, m僇乕僪攝楍(m僸僢僩僇乕僪1).幚悺椞堟))
                        End If
                        .DoDraw = (b1 Or b2)
                    End With
                Next
                '**************************************************************************
                Dim img As Image = mImg尰嵼僒僀僘Gray.Clone
                If Not p僎乕儉攚宨夋憸傪昞帵BOOL Then
                    Dim ccccc As Integer = p僎乕儉攝怓僂僀儞僪
                    gggbol = 嘳ImageFillRect(img, ccccc, 0, 0, img.Width, img.Height, False)
                End If
                '**************************************************************************
                b1 = zz僇乕僪孮昤夋(img)
                '**************************************************************************
                'gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(0, img)
                With m僇乕僪攝楍(m僸僢僩僇乕僪0).幚悺椞堟
                    gggbol = 嘳Image_Image_Copy(frmMain.pct儊僀儞.Image, img, .lll, .ttt, .rrr - .lll, .bbb - .ttt, -1, -1, -1, -1)
                End With
                With m僇乕僪攝楍(m僸僢僩僇乕僪1).幚悺椞堟
                    gggbol = 嘳Image_Image_Copy(frmMain.pct儊僀儞.Image, img, .lll, .ttt, .rrr - .lll, .bbb - .ttt, -1, -1, -1, -1)
                End With
                img.Dispose()
                '**************************************************************************
                '**************************************************************************
                If Not p僇乕僪堏摦偺婳愓傪巆偡BOOL Then
                    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    '傕偟僇乕僪婳愓側偟側傜偙偪傜偵偡傞
                    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    pctCard00.Visible = False
                    pctCard01.Visible = False
                    '************************************************
                    '廳梫'廳梫'廳梫'廳梫
                    DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
                    '廳梫'廳梫'廳梫'廳梫
                    '************************************************
                    '偙偙偱僶僢僋傾僢僾偺僀儊乕僕傪嶌傞()
                    Dim CurBmpMM As Integer = 嘳BmpMakeFromImage(frmMain.pct儊僀儞.Image)
                    Dim CurBmpSS As Integer = 嘳BmpMakeFromImage(frmMain.pct儊僀儞.Image)
                    'gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(CurBmpMM, Nothing)
                    '************************************************
                    Dim 墌屖堏摦(1) As 墌屖堏摦僂儘僂儘Kana
                    a = zz摉傝僇乕僪偺堏摦憖嶌(-1, 墌屖堏摦, 墌屖堏摦(0), 0, 0, 0, 0, 0, 0, 0, pctCard00, m僇乕僪攝楍(m僸僢僩僇乕僪0), 0, 0)
                    a = zz摉傝僇乕僪偺堏摦憖嶌(-1, 墌屖堏摦, 墌屖堏摦(1), 0, 0, 0, 0, 0, 0, 0, pctCard01, m僇乕僪攝楍(m僸僢僩僇乕僪1), 0, 0)
                    Dim wwwww As Integer = 嘳Rect暆(m僼僅乕儉慡椞堟)
                    Dim hhhhh As Integer = 嘳Rect崅(m僼僅乕儉慡椞堟)
                    Dim 廤崌応強X, 廤崌応強Y As Integer
                    '-------------------------------------------------------
                    Select Case 嘳僇僂儞僩傾僢僾(僇僂儞僩傾僢僾尰嵼偺抣, 1, 0, 3)
                        Case 0
                            廤崌応強X = Rnd() * wwwww : 廤崌応強Y = -m僇乕僪偺僒僀僘崅
                        Case 1
                            廤崌応強X = m僼僅乕儉慡椞堟.rrr : 廤崌応強Y = Rnd() * hhhhh
                        Case 2
                            廤崌応強X = Rnd() * wwwww : 廤崌応強Y = m僼僅乕儉慡椞堟.bbb
                        Case Else
                            廤崌応強X = -m僇乕僪偺僒僀僘暆 : 廤崌応強Y = Rnd() * hhhhh
                    End Select
                    '-------------------------------------------------------
                    a = zz摉傝僇乕僪偺堏摦憖嶌(0, 墌屖堏摦, 墌屖堏摦(0), 0, 廤崌応強X, 廤崌応強Y, pctCard00.Left, pctCard00.Top, wwwww, hhhhh, pctCard00, m僇乕僪攝楍(m僸僢僩僇乕僪0), 0, 0)
                    a = zz摉傝僇乕僪偺堏摦憖嶌(0, 墌屖堏摦, 墌屖堏摦(1), 0, 廤崌応強X, 廤崌応強Y, pctCard01.Left, pctCard01.Top, wwwww, hhhhh, pctCard01, m僇乕僪攝楍(m僸僢僩僇乕僪1), 0, 0)
                    '-------------------------------------------------------
                    Dim 帪娫壱偓 As Integer = (5000 \ (1 + p僇乕僪僗僺乕僪)) ^ 1.3  '1 to 5   p僇乕僪僗僺乕僪 = 0 to 4
                    '-------------------------------------------------------
                    Dim hwnd As Integer = frmMain.pct儊僀儞.Handle
                    Dim 僼儗乕儉HDC As Integer = GetDC(hwnd)  '僼儗乕儉HDC = pct儊僀儞.hDC
                    If 僼儗乕儉HDC <> 0 Then
                        For a = 0 To UBound(墌屖堏摦(0).堏摦ARY)
                            n = zz摉傝僇乕僪偺堏摦憖嶌(1, 墌屖堏摦, 墌屖堏摦(0), 僼儗乕儉HDC, 0, 0, 0, 0, 0, 0, pctCard00, m僇乕僪攝楍(m僸僢僩僇乕僪0), CurBmpMM, CurBmpSS)
                            If n = 99999 Then Exit For
                            '-------------------------------------------------------
                            gggint = 嘳悢抣寁嶼帪娫壱偓(帪娫壱偓)
                            Call Sleep(0)
                            '-------------------------------------------------------
                        Next
                        gggint = ReleaseDC(hwnd, 僼儗乕儉HDC)
                    End If
                    frmMain.pct儊僀儞.Refresh()
                    a = zz摉傝僇乕僪偺堏摦憖嶌(-2, 墌屖堏摦, 墌屖堏摦(0), 0, 0, 0, 0, 0, 0, 0, pctCard00, m僇乕僪攝楍(m僸僢僩僇乕僪0), 0, 0)
                    a = zz摉傝僇乕僪偺堏摦憖嶌(-2, 墌屖堏摦, 墌屖堏摦(1), 0, 0, 0, 0, 0, 0, 0, pctCard01, m僇乕僪攝楍(m僸僢僩僇乕僪1), 0, 0)
                    If CurBmpMM <> 0 Then DeleteObject(CurBmpMM)
                    If CurBmpSS <> 0 Then DeleteObject(CurBmpSS)
                    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                Else
                    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    '傕偟僇乕僪婳愓傪巆偡側傜偙偪傜偵偡傞()
                    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                    '僇乕僪傪堏摦偡傞嵗昗攝楍傪嶌偭偰丄偁偲偱昤夋偡傞
                    Dim www As Integer = 嘳Rect暆(m僼僅乕儉慡椞堟)
                    Dim hhh As Integer = 嘳Rect崅(m僼僅乕儉慡椞堟)
                    Dim MVDTmax = ((www + hhh) \ 2) \ 10
                    Dim oMVDTxx(1, MVDTmax) As Integer
                    Dim oMVDTyy(1, MVDTmax) As Integer
                    Dim xx1, yy1 As Integer
                    '-------------------------------------------------------
                    Select Case 嘳僇僂儞僩傾僢僾(僇僂儞僩傾僢僾尰嵼偺抣, 1, 0, 3)
                        Case 0
                            xx1 = Rnd() * www : yy1 = -m僇乕僪偺僒僀僘崅
                        Case 1
                            xx1 = m僼僅乕儉慡椞堟.rrr : yy1 = Rnd() * hhh
                        Case 2
                            xx1 = Rnd() * www : yy1 = m僼僅乕儉慡椞堟.bbb
                        Case Else
                            xx1 = -m僇乕僪偺僒僀僘暆 : yy1 = Rnd() * hhh
                    End Select
                    yy1 = yy1 + frmMain.mMenuHight 'pctCard00 / 01 偺埵抲偼丂frmMaln丂偺嵗昗宯偵側傞偺偱丄MainMenu1.Height丂偺崅偝暘偩偗僔僼僩偑昁梫
                    '************************************************
                    Dim CDID As Integer
                    HitID = m僸僢僩僇乕僪0 : CDID = 0 : gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_Hit2CardMoveDataAryMake(HitID, oMVDTxx, oMVDTyy, MVDTmax, CDID, xx1, yy1)
                    HitID = m僸僢僩僇乕僪1 : CDID = 1 : gggbol = aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_Hit2CardMoveDataAryMake(HitID, oMVDTxx, oMVDTyy, MVDTmax, CDID, xx1, yy1)
                    '************************************************
                    '暥帤偑堦抳偟偰偄傟偽丄偙傟偵懕偗偰丄摉傝僇乕僪偺堏摦儖乕僾傪幚峴偡傞
                    '************************************************
                    pctCard00.BringToFront() : pctCard01.BringToFront() : frmMain.MainMenu1.BringToFront() '僇乕僪偱儊僯儏乕僶乕傪忋彂偒偝偣側偄傛偆偵偡傞丅
                    '-------------------------------------------------------
                    Dim 帪娫壱偓 As Integer = (200 \ (1 + p僇乕僪僗僺乕僪)) ^ 2.2  '1 to 5   p僇乕僪僗僺乕僪 = 0 to 4
                    '-------------------------------------------------------
                    For a = 1 To MVDTmax '摉傝僇乕僪偺堏摦
                        If gm傾僾儕廔椆偡傞 Then
                            Exit Function
                            'qqqqq "gm傾僾儕廔椆偡傞 = True in aa儅僂僗僀儀儞僩() ":
                        End If
                        pctCard00.SetBounds(oMVDTxx(0, a), oMVDTyy(0, a), 0, 0, BoundsSpecified.Location) ' Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y) '偼偢傟偨僇乕僪偑尦偺埵抲偵栠傞
                        pctCard01.SetBounds(oMVDTxx(1, a), oMVDTyy(1, a), 0, 0, BoundsSpecified.Location) ' Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y) '偼偢傟偨僇乕僪偑尦偺埵抲偵栠傞
                        pctCard00.Refresh() : pctCard01.Refresh()
                        '-------------------------------------------------------
                        gggint = 嘳悢抣寁嶼帪娫壱偓(帪娫壱偓)
                        Call Sleep(0)
                    Next
                    '-------------------------------------------------------
                    pctCard00.Visible = False : pctCard01.Visible = False
                    '-------------------------------------------------------
                    'If True Then 'DEBUG output code block
                    '    n = frmMain.mMenuHight
                    '    With pctCard00
                    '        If .Left < 0 And .Right > 0 Or .Top < n And .Bottom > n Or .Right > www And .Left < www Or .Bottom > hhh And .Top < hhh Then
                    '            qqqqq("error data pctCard00")
                    '        End If
                    '    End With
                    '    With pctCard01
                    '        If .Left < 0 And .Right > 0 Or .Top < n And .Bottom > n Or .Right > www And .Left < www Or .Bottom > hhh And .Top < hhh Then
                    '            qqqqq("error data pctCard01")
                    '        End If
                    '    End With
                    '    qqqqq("--------------------")
                    '    With pctCard00 : qqqqq(CStr(.Left) + ", " + CStr(.Top) + ", " + CStr(.Right) + ", " + CStr(.Bottom) + ", ") : End With
                    '    With pctCard01 : qqqqq(CStr(.Left) + ", " + CStr(.Top) + ", " + CStr(.Right) + ", " + CStr(.Bottom) + ", ") : End With
                    'End If
                    '-------------------------------------------------------
                End If
                '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                wGameEnd = zz巆傝僇乕僪偑側偄()
                If wGameEnd Then
                    pctCard00.Visible = False
                    pctCard01.Visible = False
                    frmMain.Refresh()
                    '************************************************
                    '廳梫'廳梫'廳梫'廳梫
                    DoeventCall = True : System.Windows.Forms.Application.DoEvents() : DoeventCall = False
                    '廳梫'廳梫'廳梫'廳梫
                    '************************************************
                    If p僒僂儞僪傪柭傜偡 Then
                        Dim sfile As String = p僒僂儞僪偁偨傝
                        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僒僂儞僪僼傽僀儖偺幚峴傪奐巒偟傑偡(sfile)
                        gggbol = 嘳僒僂儞僪傪柭傜偡(sfile, 2, True, True)
                    End If
                    frmMain.TimEventOnStr = "僼僅乕儉儅僂僗僀儀儞僩張棟_GameEnd"
                    frmMain.TimEventOn.Enabled = True
                    gggbol = frmMain.aaTim僇乕僪宆曄峏_EnabledSet(False)
                    '************************************************
                    gggbol = frmMain.僎乕儉僨乕僞乕昞帵(2, (p尰嵼偺僇乕僪枃悢), p僇乕僪枃悢_尰嵼偺巆傝枃悢)
                    '************************************************
                End If
                '************************************************************************************************************************************************
                '************************************************************************************************************************************************
                '晄堦抳偱偁傟偽
            Else
                '昁梫側僇乕僪偺傒嵞昤夋偡傞
                m僇乕僪攝楍(m僸僢僩僇乕僪0).DoDraw = True
                m僇乕僪攝楍(m僸僢僩僇乕僪1).DoDraw = True
                gggint = InvalidateRgn(frmMain.Handle.ToInt32, m僇乕僪攝楍(m僸僢僩僇乕僪0).RGN杮懱, False)
                gggint = InvalidateRgn(frmMain.Handle.ToInt32, m僇乕僪攝楍(m僸僢僩僇乕僪1).RGN杮懱, False)
                pctCard00.Visible = False
                pctCard01.Visible = False
            End If
            '************************************************
            m僸僢僩僇乕僪0 = 0 : m僸僢僩僇乕僪1 = 0
            '************************************************
            '************************************************************************************************************************************************
            '************************************************************************************************************************************************
            '侽枃偐1枃偺昞帵忬懺偺応崌偼丄丄丄
        ElseIf (X > 0 And Y > 0) Then  '僇乕僪偺僀儀儞僩偐傜屇傃弌偝傟偨丂X=0, Y=0丂応崌偼柍帇偡傞丅
            Dim Curpct As PictureBox
            For a = o尰嵼偺僇乕僪枃悢 To 1 Step -1
                n = m昤夋専嵏攝楍(a)
                With m僇乕僪攝楍(n)
                    If .摉傝嶍彍偢傒 = False And m僸僢僩僇乕僪0 <> n And m僸僢僩僇乕僪1 <> n Then
                        If 0 <> PtInRegion(.RGN杮懱, X, Y) Then
                            If m僸僢僩僇乕僪0 = 0 Then
                                b = 0 : m僸僢僩僇乕僪0 = n : Curpct = pctCard00
                            Else
                                b = 1 : m僸僢僩僇乕僪1 = n : Curpct = pctCard01
                            End If
                            Call zz僸僢僩僇乕僪昤夋幚峴(n, Curpct)
                            Exit For
                        End If
                    End If
                End With
            Next
            If m僸僢僩僇乕僪0 <> 0 And m僸僢僩僇乕僪1 <> 0 Then
                If p僒僂儞僪傪柭傜偡 Then
                    Dim 堦抳 As Boolean = zz僇乕僪堦抳僠僃僢僋()
                    If 堦抳 And aa巆傝僇乕僪枃悢() = 2 Then
                        'do not   p僒僂儞僪傪柭傜偡
                        '偙偺屻偱丄僎乕儉廔椆偺  p僒僂儞僪傪柭傜偡丂偑丂敪惗偡傞
                    Else
                        Dim sfile As String = IIf(堦抳, p僒僂儞僪偁偨傝, p僒僂儞僪僴僘儗)
                        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僒僂儞僪僼傽僀儖偺幚峴傪奐巒偟傑偡(sfile)
                        gggbol = 嘳僒僂儞僪傪柭傜偡(sfile, 1, False, True)
                    End If
                End If
            End If
        End If
        gm僎乕儉幚峴拞_in_MouseEvent = False
        gm僎乕儉幚峴拞_in_MouseUp_張棟拞 = False
        Return True
    End Function
    Private Function aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_Hit2CardMoveDataAryMake(ByVal HitID As Integer, ByVal oMVDTxx(,) As Integer, ByVal oMVDTyy(,) As Integer, ByVal MVDTmax As Integer, ByVal CDID As Integer, ByVal xx1 As Integer, ByVal yy1 As Integer) As Boolean
        Dim addHT As Single = frmMain.mMenuHight
        Dim stx As Single = m僇乕僪攝楍(HitID).幚悺椞堟.lll
        Dim sty As Single = m僇乕僪攝楍(HitID).幚悺椞堟.ttt
        Dim n As Single = MVDTmax
        Dim dx As Single = (xx1 - stx) / n
        Dim dy As Single = (yy1 - sty) / n
        Dim a As Integer
        For a = 1 To MVDTmax
            oMVDTxx(CDID, a) = stx + (dx * a)
            oMVDTyy(CDID, a) = sty + (dy * a) + addHT
        Next
        Return True
    End Function
    Private Function aa僼僅乕儉儅僂僗僀儀儞僩張棟_SUB_AryItemShiftDown(ByVal o尰嵼偺僇乕僪枃悢 As Integer, ByVal HitID As Integer) As Boolean
        Dim a, b As Integer
        For a = 1 To o尰嵼偺僇乕僪枃悢
            If m昤夋専嵏攝楍(a) = HitID Then
                For b = a + 1 To o尰嵼偺僇乕僪枃悢
                    m昤夋専嵏攝楍(b - 1) = m昤夋専嵏攝楍(b)
                Next
                m昤夋専嵏攝楍(o尰嵼偺僇乕僪枃悢) = HitID
                Exit For
            End If
        Next
        Return True
    End Function

    Private Function zz僇乕僪堦抳僠僃僢僋() As Boolean
        If m僸僢僩僇乕僪0 = 0 And m僸僢僩僇乕僪1 = 0 Then Return False
        Return ((m僸僢僩僇乕僪0 Mod 2 = 1) And (m僸僢僩僇乕僪1 = m僸僢僩僇乕僪0 + 1)) Or ((m僸僢僩僇乕僪1 Mod 2 = 1) And (m僸僢僩僇乕僪0 = m僸僢僩僇乕僪1 + 1))
    End Function

    Private Function zz奜榞暆幚悺() As Integer
        Dim w As Integer = Math.Max(1, CInt((m僇乕僪偺僒僀僘暆 + m僇乕僪偺僒僀僘崅) * c奜榞暆幚悺攞悢))
        Return w
    End Function

    Private Function zz巆傝僇乕僪偑側偄() As Boolean
        Return (aa巆傝僇乕僪枃悢() = 0)
    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
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Structure 墌屖堏摦僂儘僂儘Kana
        Dim bmp As Integer '2017/09/28 Add  -----  OR Copy + AND Copy丂傪偡傞偨傔偺夋憸
        Dim bmpWD As Integer
        Dim bmpHT As Integer
        Dim 堏摦IDX As Long
        Dim 堏摦ARY() As POINTAPI
        Dim 堏摦僘乕儉() As Single
        Dim 昤夋rect() As RECT
    End Structure
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Function zz摉傝僇乕僪偺堏摦憖嶌(ByVal op As Integer, ByRef SDARY() As 墌屖堏摦僂儘僂儘Kana, ByRef SD As 墌屖堏摦僂儘僂儘Kana, ByVal 僼儗乕儉HDC As Integer, _
                ByVal 廤崌応強X As Integer, ByVal 廤崌応強Y As Integer, ByVal LeftX As Integer, ByVal TopY As Integer, _
                ByVal 慡夋暆 As Integer, ByVal 慡夋崅 As Integer, ByVal pct僇乕僪 As PictureBox, ByVal 僇乕僪乕僨乕僞乕 As type僇乕僪乕僨乕僞乕, _
                ByVal BmpMM As Integer, ByVal BmpSS As Integer) As Integer
        Dim a As Integer, n As Integer, oldBmp As Integer, oldBmp22 As Integer
        Dim 堏摦ARYmax As Integer
        Select Case op
            Case -1 ' Set SD As 墌屖堏摦僂儘僂儘Kana
                With SD
                    If pct僇乕僪 Is Nothing Then Return 0
                    Dim RET As Boolean = False
                    pct僇乕僪.Refresh()
                    .bmp = 0
                    .bmpWD = pct僇乕僪.ClientRectangle.Width
                    .bmpHT = pct僇乕僪.ClientRectangle.Height
                    Dim rgn As Integer = 嘳儕乕僕儑儞copy(僇乕僪乕僨乕僞乕.RGN杮懱, True)
                    If rgn <> 0 Then
                        n = 嘳BmpMakeMaskBackColorSet(ghDC1, .bmpWD, .bmpHT)
                        If n <> 0 Then
                            .bmp = n
                            gggint = 嘳BmpDrawMakeMask(ghDC1, .bmp, rgn, 0, 0, True)
                            Dim himgbmp As Integer = 嘳BmpMakeFromImage(pct僇乕僪.Image)
                            If himgbmp <> 0 Then
                                oldBmp = SelectObject(ghDC2, himgbmp)
                                If oldBmp <> 0 Then
                                    gggint = OffsetRgn(rgn, .bmpWD, 0)
                                    RET = 嘳BmpDrawStretchBlt(ghDC1, .bmp, rgn, 0, .bmpWD, 0, .bmpWD, .bmpHT, ghDC2, 0, 0, .bmpWD, .bmpHT, 0, 0, 0, 0)
                                    If RET Then
                                        'gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(himgbmp, Nothing)
                                        'gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(.bmp, Nothing)
                                    End If
                                    gggint = SelectObject(ghDC2, oldBmp)
                                End If
                                DeleteObject(himgbmp)
                            End If
                        End If
                    End If
                    If RET = False Then
                        MsgBox("zz怴偟偄堏摦昤夋偺僨乕僞乕傪嶌傞() 偱僄儔乕偑敪惗丅" & gggCR2 & "偙偺傾僾儕働乕僔儑儞傪廔椆偟偰偔偩偝偄丅")
                    End If
                    Return IIf(RET, 1, 0)
                End With
                '***********************************************************************************
            Case -2 ' Delete  SD.bmp  墌屖堏摦僂儘僂儘Kana
                With SD
                    If pct僇乕僪 Is Nothing Then Return 0
                    If .bmp <> 0 Then DeleteObject(.bmp)
                    .bmp = 0
                    ReDim .堏摦ARY(0)
                    ReDim .堏摦僘乕儉(0)
                    ReDim .昤夋rect(0)
                    Return 1
                End With
                '***********************************************************************************
            Case 0 'Make Data
                Dim xx As Single, yy As Single
                With SD
                    '---------------------------------------------
                    堏摦ARYmax = 500  'p僇乕僪僗僺乕僪偼丂儖乕僾撪偺屇傃弌偟丂gggint = 嘳悢抣寁嶼帪娫壱偓(nnnnn)丂偱挷惍偡傞
                    '---------------------------------------------
                    '2023/06/17 new chg
                    xx = 廤崌応強X - LeftX
                    yy = 廤崌応強Y - TopY
                    '僇乕僪僒僀僘偼僘乕儉偱戝偒偔側傞      '僘乕儉僒僀僘曄壔偼 1.0 攞丂乣 1.5 攞  
                    If 廤崌応強X < 0 Then
                        xx = xx - (.bmpWD \ 2)
                    ElseIf 廤崌応強Y < 0 Then
                        yy = yy - (.bmpHT \ 2)
                    End If
                    '---------------------------------------------
                    xx = xx / 堏摦ARYmax
                    yy = yy / 堏摦ARYmax
                    'qqqqq("廤崌応強X = " & CStr(廤崌応強X) & "廤崌応強Y = " & CStr(廤崌応強Y))
                    ReDim .堏摦ARY(堏摦ARYmax)
                    .堏摦ARY(1).X = LeftX : .堏摦ARY(1).Y = TopY
                    For a = 2 To 堏摦ARYmax
                        .堏摦ARY(a).X = LeftX + (xx * a) : .堏摦ARY(a).Y = TopY + (yy * a)
                    Next
                    ReDim Preserve .堏摦ARY(堏摦ARYmax) : ReDim .堏摦僘乕儉(堏摦ARYmax) : ReDim .昤夋rect(堏摦ARYmax)
                    '-----------------------------------------------------------------
                    Dim rndn As Single = (Rnd() * 2.0#) + 1.0#   '僘乕儉廃婜偺曄壔偼丂 1.0 攞丂乣 3.0 攞丂
                    Dim nnn As Single = CSng(堏摦ARYmax) / rndn  '侾僒僀僋儖摉偨傝偺堏摦悢
                    nnn = 6.28 / nnn '侾僒僀僋儖摉偨傝偺儔僕傾儞
                    '-----------------------------------------------------------------
                    Dim 怳暆學悢 As Single = 0.5#
                    For a = 1 To 堏摦ARYmax
                        If a = 1 Then .堏摦僘乕儉(a) = 1.0# Else .堏摦僘乕儉(a) = 1.0# + (Math.Sin(a * nnn) * 怳暆學悢) '僘乕儉僒僀僘曄壔偼 1.0 攞丂乣 1.5 攞
                        .昤夋rect(a).lll = .堏摦ARY(a).X
                        .昤夋rect(a).ttt = .堏摦ARY(a).Y
                        .昤夋rect(a).rrr = .昤夋rect(a).lll + .bmpWD * .堏摦僘乕儉(a)
                        .昤夋rect(a).bbb = .昤夋rect(a).ttt + .bmpHT * .堏摦僘乕儉(a)
                    Next
                    Return 1
                End With
                '***********************************************************************************
            Case 1 'Draw Card (0) / (1) all
                If BmpMM = 0 Or BmpSS = 0 Then Return 0
                堏摦ARYmax = UBound(SDARY(0).堏摦ARY)
                If SDARY(0).堏摦IDX < 0 Or SDARY(0).堏摦IDX >= 堏摦ARYmax Then Return 0
                '-------------------------------------------------------------------
                SDARY(0).堏摦IDX = SDARY(0).堏摦IDX + 1
                Dim curIDX As Integer = SDARY(0).堏摦IDX
                '-------------------------------------------------------------------
                Dim rc(1) As RECT
                For a = 0 To 1
                    With SDARY(a)
                        If curIDX = 1 Then gggint = CopyRect(rc(a), .昤夋rect(curIDX)) Else gggint = UnionRect(rc(a), .昤夋rect(curIDX), .昤夋rect(curIDX - 1))
                    End With
                Next
                '-------------------------------------------------------------------
                Dim rc01MIX As RECT, MIXDRAW As Boolean, rctmp As RECT
                If IntersectRect(rc01MIX, rc(0), rc(1)) Then
                    gggint = UnionRect(rc01MIX, rc(0), rc(1))
                    MIXDRAW = True
                Else
                    MIXDRAW = False
                End If
                '-------------------------------------------------------------------
                Dim rcWND As RECT
                With rcWND
                    .lll = 0 : .ttt = 0 : .rrr = frmMain.pct儊僀儞.ClientSize.Width : .bbb = frmMain.pct儊僀儞.ClientSize.Height
                End With
                '-------------------------------------------------------------------
                If MIXDRAW And (False = IntersectRect(rctmp, rc01MIX, rcWND)) Then
                    'qqqqq("zz摉傝僇乕僪偺堏摦憖嶌(MIXDRAW...) Out window  " & CStr(curIDX) & "  max=" & CStr(堏摦ARYmax))
                    Return 99999
                End If
                If (Not MIXDRAW) And (False = IntersectRect(rctmp, rc(0), rcWND)) And (False = IntersectRect(rctmp, rc(1), rcWND)) Then
                    'qqqqq("zz摉傝僇乕僪偺堏摦憖嶌(0,1,draw...) Out window  " & CStr(curIDX) & "  max=" & CStr(堏摦ARYmax))
                    Return 99999
                End If
                '-------------------------------------------------------------------
                Dim x1, y1, wd, ht As Integer
                If MIXDRAW Then
                    gggint = 嘳BmpCopySelectRect(ghDC1, BmpSS, ghDC2, BmpMM, rc01MIX)
                    oldBmp22 = SelectObject(ghDC1, BmpSS)
                    If oldBmp22 <> 0 Then
                        For a = 0 To 1
                            With SDARY(a)
                                oldBmp = SelectObject(ghDC2, .bmp)
                                If oldBmp <> 0 Then
                                    With .昤夋rect(curIDX)
                                        x1 = .lll : y1 = .ttt : wd = .rrr - .lll : ht = .bbb - .ttt
                                    End With
                                    gggint = SetStretchBltMode(ghDC1, COLORONCOLOR)
                                    gggbol = StretchBlt(ghDC1, x1, y1, wd, ht, ghDC2, 0, 0, .bmpWD, .bmpHT, SRCPAINT)
                                    gggbol = StretchBlt(ghDC1, x1, y1, wd, ht, ghDC2, .bmpWD, 0, .bmpWD, .bmpHT, SRCAND)
                                    gggbol = SelectObject(ghDC2, oldBmp)
                                End If
                            End With
                        Next
                        With rc01MIX
                            gggbol = BitBlt(僼儗乕儉HDC, .lll, .ttt, .rrr - .lll, .bbb - .ttt, ghDC1, .lll, .ttt, SRCCOPY)   '僼儗乕儉HDC = pct儊僀儞.hDC
                        End With
                        gggbol = SelectObject(ghDC1, oldBmp22)
                        Call Sleep(0)
                    End If
                Else
                    '----------------------------------
                    Dim 捛壛僒僀僘 As Integer = 10  '2023/01/31 昤夋帪偵丄恑峴曽岦偺丄僇乕僪偺堦晹暘偑寚偗傞偺傪杊偖丅
                    '----------------------------------
                    For a = 0 To 1
                        With SDARY(a)
                            gggint = 嘳BmpCopySelectRect(ghDC1, BmpSS, ghDC2, BmpMM, rc(a))
                            With .昤夋rect(curIDX)
                                x1 = .lll : y1 = .ttt : wd = .rrr - .lll : ht = .bbb - .ttt
                            End With
                            oldBmp22 = SelectObject(ghDC1, BmpSS)
                            If oldBmp22 <> 0 Then
                                oldBmp = SelectObject(ghDC2, .bmp)
                                If oldBmp <> 0 Then
                                    gggint = SetStretchBltMode(ghDC1, COLORONCOLOR)
                                    gggbol = StretchBlt(ghDC1, x1, y1, wd, ht, ghDC2, 0, 0, .bmpWD, .bmpHT, SRCPAINT)
                                    gggbol = StretchBlt(ghDC1, x1, y1, wd, ht, ghDC2, .bmpWD, 0, .bmpWD, .bmpHT, SRCAND)
                                    'qqqqq(CStr(x1) & ", " & CStr(y1))
                                    'If curIDX = 1 Then gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(BmpSS, Nothing)
                                    With rc(a)
                                        x1 = .lll - 捛壛僒僀僘
                                        y1 = .ttt - 捛壛僒僀僘
                                        wd = .rrr - .lll + 捛壛僒僀僘 + 捛壛僒僀僘
                                        ht = .bbb - .ttt + 捛壛僒僀僘 + 捛壛僒僀僘
                                        gggbol = BitBlt(僼儗乕儉HDC, x1, y1, wd, ht, ghDC1, x1, y1, SRCCOPY)   '僼儗乕儉HDC = pct儊僀儞.hDC
                                    End With
                                    gggbol = SelectObject(ghDC2, oldBmp)
                                End If
                                gggbol = SelectObject(ghDC1, oldBmp22)
                                Call Sleep(0)
                            End If
                        End With
                    Next
                End If
                Return 1
        End Select
    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

    Private Function zz昤夋梡_pctBoxs_僙僢僩攚宨怓_pct儊僀儞() As Boolean
        If p僎乕儉攚宨夋憸傪昞帵BOOL Then Return False
        Dim g As Graphics = Graphics.FromImage(frmMain.pct儊僀儞.Image)
        If g Is Nothing Then Return False
        g.Clear(嘳Color峔憿懱_from_怓抣((p僎乕儉攝怓僂僀儞僪)))
        g.Dispose()
        frmMain.pct儊僀儞.Visible = True
        Return True
    End Function

    Friend Function aa昤夋梡_pctBoxs_僙僢僩Image(ByRef f As frmMain, ByVal rNew僼傽僀儖 As String, ByVal pct僌儗僀巊梡 As Boolean, Optional ByVal On_p僎乕儉攚宨夋憸傪昞帵_Changed_in_DlgfrmDlgOptionKana As Boolean = False) 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
            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 Or On_p僎乕儉攚宨夋憸傪昞帵_Changed_in_DlgfrmDlgOptionKana Then  '2022/11/16  On_p僎乕儉攚宨夋憸傪昞帵_Changed  p僎乕儉攚宨夋憸傪昞帵BOOL change from Dlg frmDlgOptionKana
                OldWD = WD : OldHT = HT
                If 僼傽僀儖 <> "" Then Old巊梡夋憸柤 = 僼傽僀儖
                '---------------------------------------
                .pct儊僀儞.SetBounds(0, YY, WD, HT)
                If Not 嘳Image_怴婯嶌惉_嵞嶌惉(.pct儊僀儞.Image, WD, HT) Then Return False
                If Not 嘳Image_怴婯嶌惉_嵞嶌惉(mImg尰嵼僒僀僘Gray, WD, HT) Then Return False
                '---------------------------------------
                If p僎乕儉攚宨夋憸傪昞帵BOOL Then
                    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(mImg尰嵼僒僀僘Gray, mImg尰嵼偺僎乕儉梡Gray, wLeft, wTop, wWidth, wHeight)
                    '---------------------------------------
                Else
                    gggbol = zz昤夋梡_pctBoxs_僙僢僩攚宨怓_pct儊僀儞()
                End If
                '---------------------------------------
                '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
            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
                If p僎乕儉攚宨夋憸傪昞帵BOOL Then
                    Dim img As Image
                    If pct僌儗僀巊梡 Then
                        img = mImg尰嵼偺僎乕儉梡Gray
                    Else
                        img = mImg尰嵼偺僎乕儉梡
                    End If
                    Dim 憲傝暆, 憲傝崅 As Integer : Dim wLeft, wTop, wWidth, wHeight As Integer
                    憲傝暆 = img.Width
                    憲傝崅 = img.Height
                    gggbol = 嘳僒僀僘寁嶼_庴偗偵崌傢偣偰_憲傝傪僩儕儈儞僌(WD, HT, 憲傝暆, 憲傝崅, wLeft, wTop, wWidth, wHeight)
                    gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(.pct儊僀儞.Image, img, wLeft, wTop, wWidth, wHeight)
                    If pct僌儗僀巊梡 Then
                        gggbol = 嘳庴偗Image慡堟偵_憲Image偺慖戰椞堟傪_Copy(mImg尰嵼僒僀僘Gray, mImg尰嵼偺僎乕儉梡Gray, wLeft, wTop, wWidth, wHeight)
                    End If
                    'qqqqq("aa昤夋梡_pctBoxs_僙僢僩Image_pct儊僀儞偩偗()  ")
                Else
                    gggbol = zz昤夋梡_pctBoxs_僙僢僩攚宨怓_pct儊僀儞()
                End If
            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僼傽僀儖夋憸僎乕儉梡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, hedend 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(僾儘僷僐儅儞僪, gggstrary, "")
                Call p僒僂儞僪偁偨傝僴僘儗_RW(僾儘僷僐儅儞僪)
                Call p僒僂儞僪傪柭傜偡_RW(僾儘僷僐儅儞僪)
                Call p僇乕僪偺柧傞偝_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪宆_RW(僾儘僷僐儅儞僪)
                Call p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_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 '2022/0525  廳梫丂Instr() 偱専嶕偡傞偺偱丄慜曽偐傜摨偠晹暘傪堦晹暘偲偟偰帩偮傕偺偱偼丄崿摨偡傞壜擻惈偑偁傞丅"=" 傪捛壛偡傞丅
                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僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW As String = p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_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(僾儘僷僐儅儞僪, 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僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW) = 1 Then
                        Call p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_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(僾儘僷僐儅儞僪, 1, 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) = hedend 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僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_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) = hedend Else Return True
        End Select
        gggbol = DlgFile僇乕僪梡.aa僾儘僷僥傿弶婜壔_INI撉弌偟彂崬傒sub(僾儘僷僐儅儞僪, ini攝楍, CurIDX)
        gggbol = DlgFile僎乕儉梡.aa僾儘僷僥傿弶婜壔_INI撉弌偟彂崬傒sub(僾儘僷僐儅儞僪, ini攝楍, CurIDX)
        Return True
    End Function

    Private Function zz昁偢僎乕儉傪幚峴偡傞_偁傞偄偼僎乕儉忬懺傪嵞昤夋(ByVal rNew1_WndReSize2_PropChange3 As Integer, ByRef r僇乕僪偺曄峏偩偗幚峴 As Integer, ByVal r僌儗乕儗儀儖偺曄峏 As Boolean) As Boolean
        'm偙偺Dlg偐傜僎乕儉傪奐巒偟偨 = True
        If Not pp僎乕儉幚峴拞 Then
            Call frmMain.mn1game僇乕僪枃悢巜掕Do_ClickCOM(-1)
        Else
            Call aa僇乕僪偺攝抲偲嵞昤夋(rNew1_WndReSize2_PropChange3, r僇乕僪偺曄峏偩偗幚峴, r僌儗乕儗儀儖偺曄峏)
        End If
        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 ' = c僇乕僪宆APPmax
                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
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Function zz僇乕僪宆偺柤慜(ByVal r僇乕僪宆 As Integer, ByVal capDEF0_capUSER1 As Integer) As String
        Dim a As Integer = 嘳悢抣斖埻Int(c僇乕僪宆ALLmin, c僇乕僪宆Allmax, r僇乕僪宆)
        If a <= c僇乕僪宆APPmax Then
            Select Case a
                Case c巐妏宍 : Return "巐妏宍"
                Case c墌宍 : Return "墌宍"
                Case c榋妏宍 : Return "榋妏宍"
                Case c傂偟宍 : Return "傂偟宍"
                Case c巐偮梩宍 : Return "巐偮梩宍"
                Case c僟儖儅宍 : Return "僟儖儅宍"
                Case c廫帤宍 : Return "廫帤宍"
                Case c僟僀儎宍 : Return "僟僀儎宍"
                Case c僴乕僩宍 : Return "僴乕僩宍"
            End Select
            Return "巐妏宍"
        Else
            a = 嘳悢抣斖埻Int(c僇乕僪宆USERmin, c僇乕僪宆Allmax, a) 'm僇乕僪宆僨乕僞乕婎杮愝掕( 0 - 16 ) As USERCARD   'using 9 to 16
            If capDEF0_capUSER1 = 0 Then Return m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖DEF Else Return m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖
        End If
    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僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(False, idx, r夋暆崅暯嬒, r夋暆崅暯嬒, wRgn夋, wRgn榞, 0, 0, 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婯掕宆巜掕 As Boolean, ByRef r僇乕僪宆 As Integer, ByRef rPRE夋暆 As Integer, ByRef rPRE夋崅 As Integer, ByRef wRGN杮懱 As Integer, ByRef wRGN奜榞 As Integer, Optional ByRef w僇乕僪宆攞悢 As Single = 0, Optional ByRef w僼儗乕儉儔僀儞暆 As Integer = 0, Optional ByRef w僇乕僪偺僒僀僘暆 As Integer = 0, Optional ByRef w僇乕僪偺僒僀僘崅 As Integer = 0) As Boolean
        '-----------------------------------------------------
        'r僇乕僪宆 = 0 to 8 (appdef)  +  9 to 16 (user)  崌寁丂 0 to 16 max
        '-----------------------------------------------------
        If wRGN杮懱 <> 0 Then gggint = DeleteObject(wRGN杮懱)
        wRGN杮懱 = 0
        If wRGN奜榞 <> 0 Then gggint = DeleteObject(wRGN奜榞)
        wRGN奜榞 = 0
        '-----------------------------------------------------
        If r僇乕僪宆 <= c僇乕僪宆APPmax Then
            Select Case r僇乕僪宆
                Case c巐妏宍 : w僇乕僪宆攞悢 = 0.9
                Case c墌宍 : w僇乕僪宆攞悢 = 1.0#
                Case c榋妏宍 : w僇乕僪宆攞悢 = 1.04
                Case c傂偟宍 : w僇乕僪宆攞悢 = 1.04
                Case c巐偮梩宍 : w僇乕僪宆攞悢 = 1.0#
                Case c僟儖儅宍 : w僇乕僪宆攞悢 = 1.0#
                Case c廫帤宍 : w僇乕僪宆攞悢 = 1.0#
                Case c僟僀儎宍 : w僇乕僪宆攞悢 = 1.05
                Case c僴乕僩宍 : w僇乕僪宆攞悢 = 1.0#
            End Select
        Else
            w僇乕僪宆攞悢 = 0.9
        End If
        'w僇乕僪宆攞悢 = 1   '2018/07/17  僥僗僩僐乕僪
        Dim pt(0) As POINTAPI
        Dim a, m, n As Integer
        Dim o夋暆 As Integer = rPRE夋暆 * w僇乕僪宆攞悢 : o夋暆 = (o夋暆 \ 2) * 2
        Dim o夋崅 As Integer = rPRE夋崅 * w僇乕僪宆攞悢 : o夋崅 = (o夋崅 \ 2) * 2
        w僼儗乕儉儔僀儞暆 = Math.Max(2, (o夋暆 + o夋崅) * c僼儗乕儉儔僀儞暆攞悢)
        Dim o榞暆 As Integer
        o榞暆 = Math.Max(2, w僼儗乕儉儔僀儞暆)
        '-----------------------------------------------------
        If r僇乕僪宆 >= c僇乕僪宆USERmin Then
            Dim userIDX As Integer = 嘳悢抣斖埻Int(c僇乕僪宆USERmin, c僇乕僪宆Allmax, r僇乕僪宆)
            Dim 儐乕僓乕僇乕僪potsUSER柍岠 As Boolean = (UBound(m僇乕僪宆僨乕僞乕婎杮愝掕(userIDX).potsUSER) < 3)
            If r婯掕宆巜掕 Or 儐乕僓乕僇乕僪potsUSER柍岠 Then m = UBound(m僇乕僪宆僨乕僞乕婎杮愝掕(userIDX).potsDEF) Else m = UBound(m僇乕僪宆僨乕僞乕婎杮愝掕(userIDX).potsUSER)
            If m > 0 Then
                With m僇乕僪宆僨乕僞乕婎杮愝掕(userIDX)
                    ReDim pt(m)
                    For a = 0 To m
                        If r婯掕宆巜掕 Or 儐乕僓乕僇乕僪potsUSER柍岠 Then
                            pt(a).X = CInt((o夋暆 * .potsDEF(a).X) / cUserCard僗働乕儖婎悢WD) : pt(a).Y = CInt((o夋崅 * .potsDEF(a).Y) / cUserCard僗働乕儖婎悢HT)
                        Else
                            pt(a).X = CInt((o夋暆 * .potsUSER(a).X) / cUserCard僗働乕儖婎悢WD) : pt(a).Y = CInt((o夋崅 * .potsUSER(a).Y) / cUserCard僗働乕儖婎悢HT)
                        End If
                    Next
                End With
                If m > 30 Then w僼儗乕儉儔僀儞暆 = w僼儗乕儉儔僀儞暆 * 0.8 '2018/05/26 嬋慄偺懡偄恾宍偱偼丄奜榞偺暆傪彫偝偔偡傞
                n = m
                If m > 50 Then n = GMCOM嘳夋憸偺奜榞偺_POINT_攝楍傪嶌惉_廲慄墶慄僨乕僞乕僟僽傝嶍彍(pt, False)
                '---------------------------------------------------------------------------
                'If m > 50 Then qqqqq CStr(m) + " ---> " + CStr(n)
                '---------------------------------------------------------------------------
                wRGN杮懱 = CreatePolygonRgn(pt, n + 1, WINDING)
                '---------------------------------------------------------------------------

            End If
        Else
            Dim x0, x1, x2, x3, y0, y1, y2, y3, xx, xxx, yy, yyy, addxy, sft As Integer
            Dim rc0, rc1, rc2, rc3, rc4, rcCur, RectTMP As RECT
            Dim rgnTMP, rgnTMP1 As Integer
            Select Case r僇乕僪宆
                Case c巐妏宍
                    xx = o夋暆 \ 8 : yy = o夋崅 \ 8
                    wRGN杮懱 = CreateRoundRectRgn(0, 0, o夋暆, o夋崅, xx, yy)

                Case c墌宍
                    wRGN杮懱 = CreateEllipticRgn(0, 0, o夋暆, o夋崅)
                    wRGN奜榞 = CreateEllipticRgn(o榞暆, o榞暆, o夋暆 - o榞暆, o夋崅 - o榞暆)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)

                Case c榋妏宍
                    ReDim pt(20)
                    x0 = 0 : x1 = CInt((o夋暆 * 0.5) * System.Math.Cos(30 * app妏搙偐傜儔僕傾儞傊偺曄姺悢)) : x2 = CInt(x1 * 2)
                    yyy = CInt(o夋崅 * 0.5) : y0 = 0 : yy = CInt(yyy * System.Math.Sin(30 * app妏搙偐傜儔僕傾儞傊偺曄姺悢)) : y1 = yyy - yy
                    y2 = yyy + yy
                    y3 = o夋崅
                    pt(0).X = x1 : pt(0).Y = 0 : pt(1).X = x2 : pt(1).Y = y1 : pt(2).X = x2 : pt(2).Y = y2
                    pt(3).X = x1 : pt(3).Y = y3 : pt(4).X = 0 : pt(4).Y = y2 : pt(5).X = 0 : pt(5).Y = y1
                    wRGN杮懱 = CreatePolygonRgn(pt, 6, WINDING)
                    'Call GetRgnBox(wRGN杮懱, rc0): qqqqq "wRGN杮懱 X,Y  " + CStr(rc0.left) + ", " + CStr(rc0.ttt)
                    yy = CInt(o榞暆 * System.Math.Tan(30 * app妏搙偐傜儔僕傾儞傊偺曄姺悢))
                    yyy = CInt(o榞暆 / System.Math.Cos(30 * app妏搙偐傜儔僕傾儞傊偺曄姺悢))
                    pt(0).X = x1 : pt(0).Y = 0 + yyy : pt(1).X = x2 - o榞暆 : pt(1).Y = y1 + yy : pt(2).X = x2 - o榞暆 : pt(2).Y = y2 - yy
                    pt(3).X = x1 : pt(3).Y = y3 - yyy : pt(4).X = 0 + o榞暆 : pt(4).Y = y2 - yy : pt(5).X = 0 + o榞暆 : pt(5).Y = y1 + yy
                    wRGN奜榞 = CreatePolygonRgn(pt, 6, WINDING)
                    'Call GetRgnBox(wRGN奜榞, rc0): qqqqq "wRGN奜榞 X,Y  " + CStr(rc0.left) + ", " + CStr(rc0.ttt)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)

                Case c傂偟宍
                    ReDim pt(20)
                    x0 = 0 : x1 = CInt(o夋暆 * 0.4) : x2 = CInt(o夋暆 * 0.6) : x3 = o夋暆 : y0 = 0 : y1 = CInt(o夋崅 * 0.4) : y2 = CInt(o夋崅 * 0.6) : y3 = o夋崅
                    pt(0).X = x1 : pt(0).Y = y0 : pt(1).X = x2 : pt(1).Y = y0 : pt(2).X = x3 : pt(2).Y = y1 : pt(3).X = x3 : pt(3).Y = y2
                    pt(4).X = x2 : pt(4).Y = y3 : pt(5).X = x1 : pt(5).Y = y3 : pt(6).X = x0 : pt(6).Y = y2 : pt(7).X = x0 : pt(7).Y = y1
                    wRGN杮懱 = CreatePolygonRgn(pt, 8, WINDING)
                    xx = CInt(o榞暆 * System.Math.Tan(22.5 * app妏搙偐傜儔僕傾儞傊偺曄姺悢))
                    pt(0).X = x1 + xx : pt(0).Y = y0 + o榞暆 : pt(1).X = x2 - xx : pt(1).Y = pt(0).Y : pt(2).X = x3 - o榞暆 : pt(2).Y = y1 + xx : pt(3).X = pt(2).X : pt(3).Y = y2 - xx
                    pt(4).X = x2 - xx : pt(4).Y = y3 - o榞暆 : pt(5).X = x1 + xx : pt(5).Y = pt(4).Y : pt(6).X = x0 + o榞暆 : pt(6).Y = y2 - xx : pt(7).X = pt(6).X : pt(7).Y = y1 + xx
                    wRGN奜榞 = CreatePolygonRgn(pt, 8, WINDING)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)

                Case c巐偮梩宍
                    gggint = SetRect(RectTMP, 0, 0, o夋暆, o夋崅)
                    xxx = 嘳Rect暆(RectTMP) : yyy = 嘳Rect崅(RectTMP) : x0 = RectTMP.lll : y0 = RectTMP.ttt : xx = (xxx \ 2) : yy = (yyy \ 2)
                    addxy = Math.Max(2, CInt(xxx * 0.05))
                    sft = 0
                    gggint = SetRect(rc0, x0, y0, x0 + xx + addxy - sft, y0 + yy + addxy - sft)
                    wRGN杮懱 = CreateEllipticRgnIndirect(rc0)
                    gggint = OffsetRect(rc0, xx - addxy + sft, 0)
                    rgnTMP = CreateEllipticRgnIndirect(rc0) : gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = OffsetRgn(rgnTMP, 0, yy - addxy + sft) : gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = OffsetRgn(rgnTMP, -xx + addxy - sft, 0) : gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = SetRect(rc0, x0 + CInt(xx * 0.2), y0 + CInt(yy * 0.2), x0 + CInt(xx * 1.8), y0 + CInt(yy * 1.8))
                    rgnTMP = CreateRectRgnIndirect(rc0)
                    gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    '---------------------------------------------------------------------------------------------------
                    Call InflateRect(RectTMP, -o榞暆, -o榞暆)
                    xxx = 嘳Rect暆(RectTMP) : yyy = 嘳Rect崅(RectTMP) : x0 = RectTMP.lll : y0 = RectTMP.ttt : xx = (xxx \ 2) : yy = (yyy \ 2)
                    addxy = Math.Max(2, CInt(xxx * 0.05))
                    sft = o榞暆
                    gggint = SetRect(rc0, x0, y0, x0 + xx + addxy - sft, y0 + yy + addxy - sft)
                    wRGN奜榞 = CreateEllipticRgnIndirect(rc0)
                    gggint = OffsetRect(rc0, xx - addxy + sft, 0)
                    rgnTMP = CreateEllipticRgnIndirect(rc0) : gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = OffsetRgn(rgnTMP, 0, yy - addxy + sft) : gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = OffsetRgn(rgnTMP, -xx + addxy - sft, 0) : gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = SetRect(rc0, x0 + CInt(xx * 0.2), y0 + CInt(yy * 0.2), x0 + CInt(xx * 1.8), CInt(y0 + yy * 1.8))
                    rgnTMP = CreateRectRgnIndirect(rc0)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    '---------------------------------------------------------------------------------------------------
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)
                    '---------------------------------------------------------------------------------------------------

                Case c僟儖儅宍
                    yy = CInt(o夋崅 * 0.3)
                    gggint = SetRect(rc0, 0, 0, o夋暆, o夋崅 - yy)
                    rgnTMP = CreateEllipticRgnIndirect(rc0) : gggint = OffsetRgn(rgnTMP, 0, yy)
                    wRGN杮懱 = CreateEllipticRgnIndirect(rc0) : gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = InflateRect(rc0, -o榞暆, -o榞暆)
                    rgnTMP = CreateEllipticRgnIndirect(rc0) : gggint = OffsetRgn(rgnTMP, 0, yy)
                    wRGN奜榞 = CreateEllipticRgnIndirect(rc0) : gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    '-----------------------------
                    xx = o夋暆 \ 8
                    yy = o夋崅 \ 6
                    gggint = SetRect(rc0, xx, yy, o夋暆 - xx, o夋崅 - yy)
                    rgnTMP = CreateEllipticRgnIndirect(rc0)
                    '-----------------------------
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)

                Case c廫帤宍
                    xx = o夋暆 \ 6
                    yy = o夋崅 \ 6
                    gggint = SetRect(rc0, xx, 0, o夋暆 - xx, o夋崅) : rgnTMP = CreateRectRgnIndirect(rc0)
                    gggint = SetRect(rcCur, 0, yy, o夋暆, o夋崅 - yy) : wRGN杮懱 = CreateRectRgnIndirect(rcCur)
                    gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = InflateRect(rc0, -o榞暆, -o榞暆) : rgnTMP = CreateRectRgnIndirect(rc0)
                    gggint = InflateRect(rcCur, -o榞暆, -o榞暆) : wRGN奜榞 = CreateRectRgnIndirect(rcCur)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, wRGN杮懱, RGN_XOR)

                Case c僟僀儎宍
                    ReDim pt(10)
                    xx = CInt(o夋暆 * 1.05) : yy = CInt(o夋崅 * 0.9)
                    pt(0).X = 0 : pt(0).Y = CInt(yy * 0.3)
                    pt(1).X = CInt(xx * 0.2) : pt(1).Y = 0
                    pt(2).X = CInt(xx * 0.8) : pt(2).Y = 0
                    pt(3).X = xx : pt(3).Y = pt(0).Y
                    pt(4).X = CInt(xx * 0.75) : pt(4).Y = yy
                    pt(5).X = CInt(xx * 0.25) : pt(5).Y = yy
                    wRGN杮懱 = CreatePolygonRgn(pt, 6, WINDING)
                    wRGN奜榞 = CreatePolygonRgn(pt, 6, WINDING)
                    pt(0).X = pt(0).X + CInt(o榞暆 * 1.4) : pt(0).Y = pt(0).Y + CInt(o榞暆 * 0.2)
                    pt(1).X = pt(1).X + CInt(o榞暆 * 0.5) : pt(1).Y = pt(1).Y + o榞暆
                    pt(2).X = pt(2).X - CInt(o榞暆 * 0.5) : pt(2).Y = pt(1).Y
                    pt(3).X = pt(3).X - CInt(o榞暆 * 1.4) : pt(3).Y = pt(3).Y + CInt(o榞暆 * 0.2)
                    pt(4).X = pt(4).X - CInt(o榞暆 * 0.8) : pt(4).Y = pt(4).Y - o榞暆
                    pt(5).X = pt(5).X + CInt(o榞暆 * 0.8) : pt(5).Y = pt(4).Y
                    rgnTMP = CreatePolygonRgn(pt, 6, WINDING)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_XOR)
                    gggint = DeleteObject(rgnTMP)

                Case c僴乕僩宍
                    xx = CInt(o夋暆 * 0.6) : xxx = CInt(o夋暆 * 0.4)
                    yy = CInt(o夋崅 * 0.6) : yyy = CInt(o夋崅 * 0.7)
                    gggint = SetRect(rc1, 0, 0, xx, yy) : wRGN杮懱 = CreateEllipticRgnIndirect(rc1)
                    gggint = SetRect(rc2, xxx, 0, xxx + xx, yy) : rgnTMP = CreateEllipticRgnIndirect(rc2)
                    gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = SetRect(rc3, 0, CInt(-o夋崅 * 0.4), o夋暆, o夋崅) : rgnTMP = CreateEllipticRgnIndirect(rc3)
                    gggint = SetRect(rc4, 0, CInt(o夋崅 * 0.3), o夋暆, o夋崅) : rgnTMP1 = CreateRectRgnIndirect(rc4)
                    gggint = CombineRgn(rgnTMP, rgnTMP, rgnTMP1, RGN_AND)
                    gggint = CombineRgn(wRGN杮懱, wRGN杮懱, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = DeleteObject(rgnTMP1)
                    gggint = InflateRect(rc1, -o榞暆, -o榞暆) : wRGN奜榞 = CreateEllipticRgnIndirect(rc1)
                    gggint = InflateRect(rc2, -o榞暆, -o榞暆) : rgnTMP = CreateEllipticRgnIndirect(rc2)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = SetRect(rc1, o榞暆 + 1, CInt(o夋崅 * 0.3), o夋暆 - o榞暆 - 2, CInt(o夋崅 * 0.39)) : rgnTMP = CreateRectRgnIndirect(rc1)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = InflateRect(rc3, -o榞暆, -o榞暆) : rgnTMP = CreateEllipticRgnIndirect(rc3)
                    yyy = rc4.ttt
                    gggint = InflateRect(rc4, -o榞暆, -o榞暆)
                    rc4.ttt = yyy
                    rgnTMP1 = CreateRectRgnIndirect(rc4)
                    gggint = CombineRgn(rgnTMP, rgnTMP, rgnTMP1, RGN_AND)
                    gggint = CombineRgn(wRGN奜榞, wRGN奜榞, rgnTMP, RGN_OR)
                    gggint = DeleteObject(rgnTMP)
                    gggint = DeleteObject(rgnTMP1)
                    gggint = CombineRgn(wRGN奜榞, wRGN杮懱, wRGN奜榞, RGN_XOR)

            End Select
        End If
        '-----------------------------------------------------
        If wRGN杮懱 <> 0 Then
            Dim rrr As RECT
            gggint = GetRgnBox(wRGN杮懱, rrr)
            w僇乕僪偺僒僀僘暆 = 嘳Rect暆(rrr)
            w僇乕僪偺僒僀僘崅 = 嘳Rect崅(rrr)
            With rrr
                If .lll <> 0 Or .ttt <> 0 Then
                    gggint = OffsetRgn(wRGN杮懱, -.lll, -.ttt)
                    If wRGN奜榞 <> 0 Then gggint = OffsetRgn(wRGN奜榞, -.lll, -.ttt)
                End If
                '            '---------------------------------------------------------------------------
                '            2018/05/27
                '            儅僂僗僋儕僢僋偱捈慄偺廤傑傝偱嶌偭偨儕乕僕儑儞偱偼@ pt(n).Y = 0 偵側偭偰偄偰傕
                '丂丂丂丂丂丂嶌傜傟偨儕乕僕儑儞偺偦偺埵抲  pt(n).Y 偼丄--> 1 偵側偭偰偟傑偆丅
                '丂丂丂丂丂丂CreatePolygonRgn()丂娭悢偱偺栤戣側偺偐丏丏丏尨場晄柧丅
                '            '---------------------------------------------------------------------------
            End With
        Else
            w僇乕僪偺僒僀僘暆 = 1
            w僇乕僪偺僒僀僘崅 = 1
        End If
        Return (wRGN杮懱 <> 0)
        'qqqqq CStr(rPRE夋暆) + ", " + CStr(rPRE夋崅) + " ---> " + CStr(w僇乕僪偺僒僀僘暆) + ", " + CStr(w僇乕僪偺僒僀僘崅) + ", "
    End Function

    Friend Function aa僎乕儉廔椆帪偺_BMP偲RGN偺嶍彍() As Boolean
        '偐側僇僫愱梡偺丂僇儗儞僩僇乕僪宆丂傪丂昤夋偡傞偨傔偺傕偺
        Dim a As Integer
        If mBMP僇乕僪 IsNot Nothing Then mBMP僇乕僪.Dispose() 'If mbmp昤夋 <> 0 Then gggint = DeleteObject(mbmp昤夋)
        If mRGN昤夋 <> 0 Then gggint = DeleteObject(mRGN昤夋)
        If mRGN奜榞 <> 0 Then gggint = DeleteObject(mRGN奜榞)
        mRGN昤夋 = 0 : mRGN奜榞 = 0                                       'mbmp昤夋 = 0 : 
        For a = 1 To UBound(m僇乕僪攝楍)
            With m僇乕僪攝楍(a)
                If .RGN杮懱 <> 0 Then gggint = DeleteObject(.RGN杮懱)
                .RGN杮懱 = 0
            End With
        Next
    End Function

    Friend Function aa儐乕僓乕僇乕僪僿僢僪暥帤楍() As String
        aa儐乕僓乕僇乕僪僿僢僪暥帤楍 = c儐乕僓乕
    End Function

    Friend Function aa儐乕僓乕僇乕僪傪昗弨偵栠偡僐儅儞僪(ByRef op As Integer, Optional ByRef Title 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 As Integer
        Dim s As String
        Select Case op
            Case 10020 'from  mnu儐乕僓乕僇乕僪傪昗弨偵栠偡 ---> zz儐乕僓乕僇乕僪傪昗弨偵栠偡EnabledSet()
                n = 0
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                    If UBound(m僇乕僪宆僨乕僞乕婎杮愝掕(a).potsUSER) > 0 Then n = n + 1
                Next
                Return n
            Case 10021 'from  mnu儐乕僓乕僇乕僪傪昗弨偵栠偡_Click()
                With DlgList
                    .Items.Clear()
                    For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                        If UBound(m僇乕僪宆僨乕僞乕婎杮愝掕(a).potsUSER) > 0 Then .Items.Add(CStr(a - c僇乕僪宆USERmin) & " : " & m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖) '2023/01/16 chg ***  Then .Items.Add(m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖)
                    Next
                End With
            Case 10022 'from  frmUserCardReset.lst_Click()
                Call aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(2022, Title, DlgList, 僇乕僪宆, 僇乕僪WDHT, 榞暆幚悺, Rgn夋, Rgn榞, w僇乕僪暆, w僇乕僪崅, wRgn夋DefUser, wRgn榞DefUser, w僇乕僪暆DefUser, w僇乕僪崅DefUser)
            Case 10023 'from  frmUserCardReset.btn_Click() '慖戰偟偨儐乕僓乕僇乕僪偺宍傪昗弨偵栠偡
                s = Title
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)

                        '2023/02/07 .儊僯儏乕僞僀僩儖 = "" 偵側偭偰偄傞
                        'If s = .儊僯儏乕僞僀僩儖 Then qqqqq("僇乕僪宆 *** " & CStr(僇乕僪宆))

                        If (s = "" And a = 僇乕僪宆) Then
                            .儊僯儏乕僞僀僩儖 = Mid(.儊僯儏乕僞僀僩儖DEF, 2)
                            .婎弨斾棪 = 1.0#
                            ReDim .potsUSER(0)
                            Exit Function
                        End If
                    End With
                Next
        End Select
    End Function

    Friend Function aa儐乕僓乕僇乕僪嶌惉屻偵僇乕僪傪忋彂偒曐懚(ByRef op As Integer, Optional ByRef Title 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 a, 僇乕僪宆IDX As Integer, ee1, ee2 As Boolean
        Dim s As String
        Select Case op 'aaIO_frmRgnCardSet
            Case 2000 'List Box Set --- from mnu儐乕僓乕僇乕僪偲偟偰曐懚_Click
                DlgList.Items.Clear()
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        DlgList.Items.Add(IIf(UBound(.potsUSER) > 0, .儊僯儏乕僞僀僩儖, .儊僯儏乕僞僀僩儖DEF))
                    End With
                Next
            Case 2002, 2022 'Rturn RGN                              2022 'from  frmUserCardReset.lst_Click()
                s = Title
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                    僇乕僪宆IDX = a            '僇乕僪宆IDX = a + c僇乕僪宆APPmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        '2023/01/16 chg ---------------------------------------------------------------------
                        ee1 = (s = "" And a = 僇乕僪宆) Or (s <> "" And (s = .儊僯儏乕僞僀僩儖DEF Or s = .儊僯儏乕僞僀僩儖))
                        ee2 = (s = "" And a = 僇乕僪宆) Or (s <> "" And s = .儊僯儏乕僞僀僩儖)
                        '2023/01/16 chg ---------------------------------------------------------------------
                        If (op = 2002 And ee1) Or (op = 2022 And ee2) Then
                            Call aa僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(False, 僇乕僪宆IDX, 僇乕僪WDHT, 僇乕僪WDHT, Rgn夋, Rgn榞, , , w僇乕僪暆, w僇乕僪崅)
                            If op = 2022 Then 'from  frmUserCardReset.lst_Click()
                                Call aa僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(True, 僇乕僪宆IDX, 僇乕僪WDHT, 僇乕僪WDHT, wRgn夋DefUser, wRgn榞DefUser, , , w僇乕僪暆DefUser, w僇乕僪崅DefUser)
                                Title = m僇乕僪宆僨乕僞乕婎杮愝掕(a).儊僯儏乕僞僀僩儖DEF ' 2022 'from  frmUserCardReset.lst_Click()  return 昗弨偺儐乕僓乕僇乕僪 儊僯儏乕僞僀僩儖
                            End If
                            Exit Function
                        End If
                    End With
                Next
        End Select
    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 y1, wd, x1, m, idx, a, n, x2, ht, y2 As Integer
        Dim xbai, ybai As Single
        '-----------------------------------------------------------
        'Private Const c僇乕僪宆USERmin As Integer = cUser0宍 '9
        'Private Const c僇乕僪宆Allmax As Integer = cUser7宍  '16
        idx = rOld僇乕僪宆 + c僇乕僪宆USERmin  '2022/10/10          rOld僇乕僪宆偼儕僗僩偺僀儞僨僢僋僗偱丄侽丂偐傜丂俈
        '-----------------------------------------------------------
        With m僇乕僪宆僨乕僞乕婎杮愝掕(idx)
            '2018/05/25 僞僀僩儖偺僟僽傝傪僠僃僢僋偟偰偼偄偗側偄丅丂摨偠僇乕僪傪暿偺宍偱忋彂偒偡傞応崌傕偁傞丅
            .儊僯儏乕僞僀僩儖 = Left(r儊僯儏乕僞僀僩儖, 16)
            '-----------------------------------------------------------
            m = r億儕僑儞梫慺悢 : ReDim .potsUSER(m)
            For a = 0 To m
                .potsUSER(a).X = r億儕僑儞(a).X : .potsUSER(a).Y = r億儕僑儞(a).Y
            Next
            x1 = rUserCardMakeBox僗働乕儖婎悢WD : x2 = 0 : y1 = rUserCardMakeBox僗働乕儖婎悢HT : y2 = 0
            For a = 0 To m
                With .potsUSER(a)
                    If x1 > .X Then x1 = .X
                    If x2 < .X Then x2 = .X
                    If y1 > .Y Then y1 = .Y
                    If y2 < .Y Then y2 = .Y
                End With
            Next
            wd = (x2 - x1) : ht = (y2 - y1)
            .婎弨斾棪 = (CSng(ht) * r婎弨偺攞悢抣廲) / (CSng(wd) * r婎弨偺攞悢抣墶)
            'qqqqq Format(r婎弨偺攞悢抣墶, "#.######") + ",   " + Format(r婎弨偺攞悢抣廲, "#.######")
            'qqqqq Format(.婎弨斾棪, "#.######")
            '-----------------------------------------------------------
            xbai = rUserCardMakeBox僗働乕儖婎悢WD / CSng(wd) * CSng(cUserCard僗働乕儖婎悢WD) / CSng(rUserCardMakeBox僗働乕儖婎悢WD)
            ybai = rUserCardMakeBox僗働乕儖婎悢HT / CSng(ht) * CSng(cUserCard僗働乕儖婎悢HT) / CSng(rUserCardMakeBox僗働乕儖婎悢HT)
            For a = 0 To m
                With .potsUSER(a)
                    .X = CInt(xbai * CSng(.X - x1))
                    .Y = CInt(ybai * CSng(.Y - y1))
                    'If .Y = 0 Then qqqqq CStr(a) + " ---> .Y=0"
                End With
            Next
            If m > 50 Then
                n = GMCOM嘳夋憸偺奜榞偺_POINT_攝楍傪嶌惉_廲慄墶慄僨乕僞乕僟僽傝嶍彍(.potsUSER, True)
            End If
            'qqqqq CStr(m) + " ---> " + CStr(n)
            '-----------------------------------------------------------
            '僇乕僪宆IDX = idx + 9
            'Call frmMain.p僇乕僪宆偺儐乕僓乕宆儊僯儏乕暥帤楍愗傝懼偊(僇乕僪宆IDX, .儊僯儏乕僞僀僩儖)
        End With
        Return True
    End Function

    Friend Function aa僇乕僪宆僨乕僞乕撉傒彂偒(ByRef op As Integer, ByRef rw僇乕僪僨乕僞乕 As String, Optional ByRef idx As Integer = 0) As Boolean
        Dim d, b, a, c, n As Integer
        Dim s As String = "", cap As String = ""
        Dim TTT() As String = {""}
        Dim ppp() As String = {""}
        Select Case op
            Case 1001 'Me.Class_Initialize()
                '-------------------------------------------------------------
                For a = c僇乕僪宆ALLmin To c僇乕僪宆APPmax
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        Select Case a
                            Case c巐妏宍 : .儊僯儏乕僞僀僩儖DEF = "巐妏宍"
                            Case c墌宍 : .儊僯儏乕僞僀僩儖DEF = "墌宍"
                            Case c榋妏宍 : .儊僯儏乕僞僀僩儖DEF = "榋妏宍"
                            Case c傂偟宍 : .儊僯儏乕僞僀僩儖DEF = "傂偟宍"
                            Case c巐偮梩宍 : .儊僯儏乕僞僀僩儖DEF = "巐偮梩宍"
                            Case c僟儖儅宍 : .儊僯儏乕僞僀僩儖DEF = "僟儖儅宍"
                            Case c廫帤宍 : .儊僯儏乕僞僀僩儖DEF = "廫帤宍"
                            Case c僟僀儎宍 : .儊僯儏乕僞僀僩儖DEF = "僟僀儎宍"
                            Case c僴乕僩宍 : .儊僯儏乕僞僀僩儖DEF = "僴乕僩宍"
                        End Select
                        .儊僯儏乕僞僀僩儖 = .儊僯儏乕僞僀僩儖DEF
                        .婎弨斾棪 = 1.0
                        ReDim .potsDEF(0)
                        ReDim .potsUSER(0)
                    End With
                Next
                '-------------------------------------------------------------
                For a = c僇乕僪宆USERmin To c僇乕僪宆Allmax
                    Select Case a
                        Case cUser0宍 : s = "仠儐乕僓乕侽宆<>儐乕僓乕侽宆<>1<>9<>185,0,815,0,1000,152,1000,808,818,1000,188,1000,0,811,0,161,185,0,<>"
                        Case cUser1宍 : s = "仠儐乕僓乕侾宆<>儐乕僓乕侾宆<>1<>12<>0,117,247,0,919,0,919,660,1000,660,997,1000,0,1000,3,660,103,660,103,355,0,359,0,117,<>"
                        Case cUser2宍 : s = "仠儐乕僓乕俀宆<>儐乕僓乕俀宆<>1<>13<>0,129,194,0,860,0,1000,102,1000,517,871,694,1000,699,997,1000,5,1000,8,578,140,420,8,417,0,129,<>"
                        Case cUser3宍 : s = "仠儐乕僓乕俁宆<>儐乕僓乕俁宆<>1<>16<>0,102,215,0,831,0,1000,102,1000,422,895,483,1000,552,1000,877,831,997,215,1000,3,877,3,634,118,634,118,355,3,355,0,102,<>"
                        Case cUser4宍 : s = "仠儐乕僓乕係宆<>儐乕僓乕係宆<>1<>12<>236,0,896,0,896,483,997,485,1000,882,896,882,896,1000,470,1000,472,882,0,882,0,449,236,0,<>"
                        Case cUser5宍 : s = "仠儐乕僓乕俆宆<>儐乕僓乕俆宆<>1<>14<>117,0,989,0,989,342,883,342,1000,568,997,825,806,1000,177,998,0,821,6,566,154,524,154,380,0,373,117,0,<>"
                        Case cUser6宍 : s = "仠儐乕僓乕俇宆<>儐乕僓乕俇宆<>1<>13<>191,0,814,0,997,105,997,352,884,352,884,484,1000,597,1000,856,881,1000,172,1000,0,856,0,105,191,0,<>"
                        Case cUser7宍 : s = "仠儐乕僓乕俈宆<>儐乕僓乕俈宆<>1<>8<>5,0,997,0,1000,334,818,1000,3,1000,130,463,0,461,5,0,<>"
                    End Select
                    Call aa僇乕僪宆僨乕僞乕撉傒彂偒(1004, s, a)
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(a)
                        n = UBound(.potsUSER) : ReDim .potsDEF(n) : For b = 0 To n : .potsDEF(b).X = .potsUSER(b).X : .potsDEF(b).Y = .potsUSER(b).Y : Next
                        ReDim .potsUSER(0)
                    End With
                Next
                '-------------------------------------------------------------
            Case 1004 'Open from INI
                Dim nnn As Integer
                If idx < c僇乕僪宆USERmin Then
                    nnn = c僇乕僪宆APPmax + idx  ' from p儐乕僓乕僇乕僪偺僨乕僞乕_RW
                Else
                    nnn = idx ' from this function Case 1001 'Me.Class_Initialize()
                End If
                If nnn < c僇乕僪宆USERmin Or nnn > c僇乕僪宆Allmax Then Return False

                If 5 = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(rw僇乕僪僨乕僞乕, "<>", TTT) Then
                    With m僇乕僪宆僨乕僞乕婎杮愝掕(nnn)
                        .儊僯儏乕僞僀僩儖DEF = TTT(1)
                        .儊僯儏乕僞僀僩儖 = TTT(2)
                        .婎弨斾棪 = Val(TTT(3))
                        'UBound(.potsUSER()) + 1 = Val(ttt(4))
                        ReDim .potsUSER(0)
                        c = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(TTT(5), ",", ppp)
                        If c > 1 Then
                            ReDim .potsUSER(c \ 2) : d = -1
                            For b = 1 To c Step 2
                                d = d + 1 : .potsUSER(d).X = Val(ppp(b)) : .potsUSER(d).Y = Val(ppp(b + 1))
                            Next
                            ReDim Preserve .potsUSER(d)
                        End If
                        cap = IIf(UBound(.potsUSER) > 1, .儊僯儏乕僞僀僩儖, .儊僯儏乕僞僀僩儖DEF)
                    End With
                End If
                '-------------------------------------------------------------
            Case 1005 'Save into INI   '2018/07/14  Me.Class_Initialize() 偱嶌惉偟偨 .potsUSER() 攝楍偑侽偵側偭偰偄傞偑丄儐乕僓乕偑撈帺偺僨僓僀儞傪嶌惉偟側偄忬懺偱偼丄偙傟偱惓偟偄丅
                rw僇乕僪僨乕僞乕 = ""
                Dim nnn As Integer = c僇乕僪宆APPmax + idx
                If nnn < c僇乕僪宆USERmin Or nnn > c僇乕僪宆Allmax Then Return False

                With m僇乕僪宆僨乕僞乕婎杮愝掕(nnn)
                    rw僇乕僪僨乕僞乕 = .儊僯儏乕僞僀僩儖DEF & "<>" & .儊僯儏乕僞僀僩儖 & "<>" & CStr(.婎弨斾棪) & "<>" & CStr(UBound(.potsUSER) + 1) & "<>"
                    For a = 0 To UBound(.potsUSER)
                        rw僇乕僪僨乕僞乕 = rw僇乕僪僨乕僞乕 & CStr(.potsUSER(a).X) & "," & CStr(.potsUSER(a).Y) & ","
                    Next
                    rw僇乕僪僨乕僞乕 = rw僇乕僪僨乕僞乕 & "<>"
                End With
        End Select
        Return True
    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
        '--------------------------------------------------------------------------------------------
        '幚嵺偺巊梡僨乕僞乕丂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僎乕儉攚宨夋憸偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                Return CStr(愗懼僇僂儞僩昩悢尰嵼)
            Case 123500 'SET   p僎乕儉攚宨夋憸偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                愗懼僇僂儞僩昩悢尰嵼 = CInt(s)
                '-----------------------------------------------------
            Case 20050 'GET  p僎乕儉攚宨夋憸偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                愗懼僇僂儞僩昩悢尰嵼 = 愗懼僇僂儞僩昩悢尰嵼 + 1
                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
    '***********************************************************************
    Friend Function p僞僀儅乕偱偺僇乕僪宆帺摦愗傝懼偊娫妘_is_柍偟娫妘() As Boolean
        Return CBool(p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘_RW(67021))
    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僎乕儉僇乕僪宆偺愗傝懼偊_師偺僇乕僪宆偵_嫮惂揑偵() As Boolean
        p僎乕儉僇乕僪宆偺愗傝懼偊_僇儗儞僩僇僂儞僩 = 10000000
        Call frmMain.Tim僇乕僪宆曄峏_Tick(Nothing, Nothing)
        Return True
    End Function
    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 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 Function aa_mn3opt僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘Do_Click(ByRef Index As Integer) As String
        Return p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷MenuClick, CStr(Index))    'menu Index = 1 to 7   /   data ary(0) to (6)
    End Function
    Friend Function p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘"
        '--------------------------------------------------------------------------------------------
        Static 愗懼僇僂儞僩昩悢尰嵼 As Integer = 0
        Const 抣IDXdef As Integer = 2
        Static 抣IDX As Integer : Dim 抣IDXold As Integer
        Static 抣int(6) As Integer : Static 抣str(6) As String   '0 to 6
        Dim a, n As Integer
        '--------------------------------------------------------------------------------------------
        抣IDXold = 抣IDX
        '--------------------------------------------------------------------------------------------
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣int(0) = 10 : 抣int(1) = 20 : 抣int(2) = 30 : 抣int(3) = 60 : 抣int(4) = 120 : 抣int(5) = 180 : 抣int(6) = 100000
                抣str(0) = "侾侽丂昩" : 抣str(1) = "俀侽丂昩" : 抣str(2) = "俁侽丂昩" : 抣str(3) = "侾丂丂暘" : 抣str(4) = "俀丂丂暘" : 抣str(5) = "俁丂丂暘" : 抣str(6) = "愗懼偟側偄"
                抣IDX = 抣IDXdef  '抣int()  index 2
            Case gco僾儘僷婯掕抣
                抣IDX = 抣IDXdef
                Return CStr(抣int(抣IDX))
            Case gco僾儘僷Get  'p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘() As Integer
                Return CStr(抣int(抣IDX))
            Case gco僾儘僷Let  'p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘() As Integer
                n = Val(s)
                For a = 0 To 6
                    If n <= 抣int(a) Then
                        抣IDX = a : Return CStr(n)
                    End If
                Next
                愗懼僇僂儞僩昩悢尰嵼 = 0
                '!!! ERROR no set op return 
            Case gco僾儘僷MenuClick  'aa_mn3opt僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘Do_Click(ByRef Index As Integer)     'Menu Index = 1 to 7   /   data ary(0) to (6)
                抣IDX = 嘳悢抣斖埻Int(0, UBound(抣int), CInt(s) - 1)
                愗懼僇僂儞僩昩悢尰嵼 = 0

            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣int(抣IDX)))
            Case gco僾儘僷iniRD
                gggstr = p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘_RW(gco僾儘僷Let, 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
                '-----------------------------------------------------
                'Case 333399 'p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘ListBox偵愝掕()       set listbox index = 抣IDX 
                '    Return CStr(抣IDX)
                'Case 333388 'p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘ListBox偐傜撉弌偟()   get 抣IDX from listbox index
                '    抣IDX = 嘳悢抣斖埻Int(0, UBound(抣int), CInt(s))
                'Case 678954 'p僎乕儉僇乕僪宆偺愗傝懼偊帪娫娫妘偺ListIndex
                '    Return CStr(抣IDX)
                '-----------------------------------------------------
            Case 67021  'p僎乕儉攚宨夋憸偺愗傝懼偊_僞僀儉僇僂儞僩僆乕僶乕() 
                Return CStr(抣IDX = 6)
                '-----------------------------------------------------
            Case 20050 'GET  p僎乕儉僇乕僪宆偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                愗懼僇僂儞僩昩悢尰嵼 = 愗懼僇僂儞僩昩悢尰嵼 + 1
                Dim bol As Boolean = (愗懼僇僂儞僩昩悢尰嵼 >= 抣int(抣IDX))
                If bol Then 愗懼僇僂儞僩昩悢尰嵼 = 0
                Return CStr(bol)
                '-----------------------------------------------------
            Case 200100 'SET  p僎乕儉僇乕僪宆偺愗傝懼偊_僇儗儞僩僇僂儞僩_枮婜() As Boolean
                愗懼僇僂儞僩昩悢尰嵼 = 抣int(抣IDX) + 10
                '-----------------------------------------------------
            Case 123400 'GET   p僎乕儉僇乕僪宆偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                Return CStr(愗懼僇僂儞僩昩悢尰嵼)
            Case 123500 'SET   p僎乕儉僇乕僪宆偺愗傝懼偊_僇儗儞僩僇僂儞僩 
                愗懼僇僂儞僩昩悢尰嵼 = CInt(s)
        End Select

        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷MenuClick
                Try
                    gggint = frmMain.mn3opt僎乕儉梡僇乕僪宆偺愗傝懼偊帪娫娫妘Do_MenuCheckSet(抣IDX)
                Catch
                End Try
        End Select
        ''--------------------------------------------------------------------------------------------
        'Select Case 僾儘僷僐儅儞僪
        '    Case gco僾儘僷Let, gco僾儘僷MenuClick 'p僞僀儅乕偱偺夋憸帺摦愗傝懼偊_ChkStart_On_AppStart
        '        'If 媽抣 <> 抣 Then
        '        '    Dim ret As Boolean = False
        '        '    gggbol = 僀儀儞僩gAppEventMaker.MakeEvent夋憸愗傝懼偊僞僀儅乕偺僆儞僆僼(gmDlgFile僎乕儉梡, (抣 < Val(柍偟娫妘)), ret)
        '        'End If
        'End Select
        ''--------------------------------------------------------------------------------------------
        Return CStr(抣int(抣IDX))
    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 = 50 : 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)

                '***********************************************************************
                '僎乕儉奐巒偺僗僞乕僩億僀儞僩
                gggbol = gm傾僾儕屌桳僋儔僗.aa僼僅乕儉儅僂僗僀儀儞僩張棟(-123456789, 0, frmMain.pctCard00, frmMain.pctCard01, False)
                e = aa僇乕僪偺攝抲偲嵞昤夋(1)
                frmMain.Tim僇乕僪宆曄峏.Enabled = True
                '僎乕儉奐巒偺僗僞乕僩億僀儞僩
                '***********************************************************************
                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 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
        If 媽抣 <> 抣 Or 僾儘僷僐儅儞僪 = gco僾儘僷iniRD Then


        End If
        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 = 1 : 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僎乕儉攝怓偺僽儔僔嶍彍() As Integer
        Return CInt(p僎乕儉攝怓_RW(323241, 0, 0))
    End Function
    Friend ReadOnly Property p僎乕儉攝怓僂僀儞僪DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷婯掕抣, "", 1))
        End Get
    End Property
    Friend Property p僎乕儉攝怓僂僀儞僪() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷Get, "", 1))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓_RW(gco僾儘僷Let, CStr(value), 1)
        End Set
    End Property
    Friend ReadOnly Property p僎乕儉攝怓傂傜偑側DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷婯掕抣, "", 3))
        End Get
    End Property
    Friend Property p僎乕儉攝怓傂傜偑側() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷Get, "", 3))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓_RW(gco僾儘僷Let, CStr(value), 3)
        End Set
    End Property
    Friend ReadOnly Property p僎乕儉攝怓僇僞僇僫DEF() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷婯掕抣, "", 4))
        End Get
    End Property
    Friend Property p僎乕儉攝怓僇僞僇僫() As Integer
        Get
            Return CInt(p僎乕儉攝怓_RW(gco僾儘僷Get, "", 4))
        End Get
        Set(ByVal value As Integer)
            Call p僎乕儉攝怓_RW(gco僾儘僷Let, CStr(value), 4)
        End Set
    End Property
    Friend Function p僎乕儉攝怓_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "", Optional ByRef TypeID As Integer = 1) As String
        Const PropName As String = "p僎乕儉攝怓" : Const cut As String = ","
        Const c怓僂僀儞僪 As Integer = 1, c怓僇乕僪榞 As Integer = 2, c怓傂傜偑側 As Integer = 3, c怓僇僞僇僫 As Integer = 4 'p攝怓僨乕僞乕(TypeID As Integer)
        Static 抣(c怓僇僞僇僫) As Integer : Static 抣DEF(c怓僇僞僇僫) As Integer : Static brs傂傜偑側 As Integer = 0 : Static brs僇僞僇僫 As Integer = 0
        Dim a As Integer
        Dim Set暥帤怓 As Boolean = False
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣DEF(c怓僂僀儞僪) = &HFFA0& : 抣DEF(c怓僇乕僪榞) = &HFFFFFF& : 抣DEF(c怓傂傜偑側) = &HFF& : 抣DEF(c怓僇僞僇僫) = &HFF0000&
                For a = c怓僂僀儞僪 To c怓僇僞僇僫 : 抣(a) = 抣DEF(a) : Next
                Set暥帤怓 = True
            Case gco僾儘僷婯掕抣
                a = 嘳悢抣斖埻Int(c怓僂僀儞僪, c怓僇僞僇僫, TypeID) : Return CStr(抣DEF(a))
            Case gco僾儘僷Get
                a = 嘳悢抣斖埻Int(c怓僂僀儞僪, c怓僇僞僇僫, TypeID) : Return CStr(抣(a))
            Case gco僾儘僷Let
                a = 嘳悢抣斖埻Int(c怓僂僀儞僪, c怓僇僞僇僫, TypeID)
                抣(a) = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(s)))
                Set暥帤怓 = (a = c怓傂傜偑側 Or a = c怓僇僞僇僫)
                '--------------------------------------------------------
            Case gco僾儘僷iniWR
                Dim sss As String = "tmp000" & cut
                For a = c怓僂僀儞僪 To c怓僇僞僇僫 : sss = sss & CStr(抣(a)) & cut : Next
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, sss)
            Case gco僾儘僷iniRD
                Dim ary() As String = {""}
                Dim m As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s), cut, ary, False)
                If m = 1 + c怓僇僞僇僫 Then
                    For a = c怓僂僀儞僪 To c怓僇僞僇僫 : 抣(a) = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(ary(a + 1)))) : Next
                End If
                Set暥帤怓 = True
                '--------------------------------------------------------
            Case 323241    'App END   p僎乕儉攝怓偺僽儔僔嶍彍() As Integer
                If brs傂傜偑側 <> 0 Then DeleteObject(brs傂傜偑側)
                If brs僇僞僇僫 <> 0 Then DeleteObject(brs僇僞僇僫)
                Return "1"
                '--------------------------------------------------------
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷弶婜壔
                If Set暥帤怓 Then
                    Dim n As Integer
                    Dim 怓偐側 As Integer = 抣(c怓傂傜偑側)
                    Dim 怓僇僫 As Integer = 抣(c怓僇僞僇僫)
                    If brs傂傜偑側 <> 0 Then DeleteObject(brs傂傜偑側)
                    brs傂傜偑側 = CreateSolidBrush(怓偐側)
                    If brs僇僞僇僫 <> 0 Then DeleteObject(brs僇僞僇僫)
                    brs僇僞僇僫 = CreateSolidBrush(怓僇僫)
                    Dim bol As Boolean
                    For n = 1 To app嵟戝僇乕僪枃悢
                        bol = (n Mod 2 = 0)
                        With m僇乕僪攝楍(n)
                            .暥帤怓 = IIf(bol, 怓僇僫, 怓偐側)
                            .榞僽儔僔 = IIf(bol, brs僇僞僇僫, brs傂傜偑側)
                        End With
                    Next
                End If
                If pp僎乕儉幚峴拞 Then Call aa僇乕僪偺攝抲偲嵞昤夋(3)
        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僎乕儉攚宨偺柧傞偝)
    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 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 ReadOnly Property p僒僂儞僪偁偨傝DEF() As String
        Get
            Return p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷婯掕抣, "", 1)
        End Get
    End Property
    Friend ReadOnly Property p僒僂儞僪僴僘儗DEF() As String
        Get
            Return p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷婯掕抣, "", 0)
        End Get
    End Property
    Friend Property p僒僂儞僪偁偨傝() As String
        Get
            Return p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷Get, "", 1)
        End Get
        Set(ByVal Value As String)
            Call p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷Let, Value, 1)
        End Set
    End Property
    Friend Property p僒僂儞僪僴僘儗() As String
        Get
            Return p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷Get, "", 0)
        End Get
        Set(ByVal Value As String)
            Call p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷Let, Value, 0)
        End Set
    End Property
    Friend Function p僒僂儞僪偁偨傝僴僘儗_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "", Optional ByVal r偁偨傝_1僴僘儗_0 As Integer = 0) As String
        Const PropName As String = "p僒僂儞僪偁偨傝僴僘儗" : Static cut As String = "||||" : Dim ttt As String, sss As String
        Static 抣DEF偁偨傝 As String = "" : Static 抣偁偨傝 As String ''''''''Const file偁偨傝 As String = "偁偨傝.WAV"
        Static 抣DEF僴僘儗 As String = "" : Static 抣僴僘儗 As String ''''''''Const file僴僘儗 As String = "僴僘儗.WAV"
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣DEF偁偨傝 = gm僒僂儞僪偁偨傝 ''''''''''''嘳App僼僅儖僟柤僷僗僙僷儗乕僞晅() + file偁偨傝
                抣DEF僴僘儗 = gm僒僂儞僪僴僘儗 ''''''''''''嘳App僼僅儖僟柤僷僗僙僷儗乕僞晅() + file僴僘儗
                抣偁偨傝 = 抣DEF偁偨傝
                抣僴僘儗 = 抣DEF僴僘儗
            Case gco僾儘僷婯掕抣
                If 抣DEF偁偨傝 = "" Then sss = p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷弶婜壔)
                If r偁偨傝_1僴僘儗_0 = 1 Then Return 抣DEF偁偨傝 Else Return 抣DEF僴僘儗
            Case gco僾儘僷Get
                If 抣DEF偁偨傝 = "" Then sss = p僒僂儞僪偁偨傝僴僘儗_RW(gco僾儘僷弶婜壔)
                If r偁偨傝_1僴僘儗_0 = 1 Then Return 抣偁偨傝 Else Return 抣僴僘儗
            Case gco僾儘僷Let
                If Not 嘳僼傽僀儖偼懚嵼(s) Then Return ""
                If r偁偨傝_1僴僘儗_0 = 1 Then 抣偁偨傝 = s Else 抣僴僘儗 = s
            Case gco僾儘僷iniWR
                ttt = 抣僴僘儗 & cut & 抣偁偨傝
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, ttt)
            Case gco僾儘僷iniRD
                ttt = 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)
                Dim n = InStr(ttt, cut)
                If n > 0 Then
                    sss = Left(ttt, n - 1) : If 嘳僼傽僀儖偼懚嵼(sss) Then 抣僴僘儗 = sss
                    sss = Mid(ttt, n + Len(cut)) : If 嘳僼傽僀儖偼懚嵼(sss) Then 抣偁偨傝 = sss
                End If
        End Select
        Return CStr(抣DEF偁偨傝)
    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 As String = "|**|"
        Static 抣() As String = {""} 'Use  抣( 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
                If InStr(rAryDataStr, ":\") = 0 Then
                    Call p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷弶婜壔, gggstrary, "")
                    rAryDataStr = 嘳暥傪攝楍偐傜嶌惉(抣, cut)
                End If
                Dim max As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(rAryDataStr, cut, rwAry)
                Return CStr(max)
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                ReDim 抣(2)
                抣(1) = p僒僂儞僪偁偨傝DEF
                抣(2) = p僒僂儞僪僴僘儗DEF
            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)
                Return p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷convSTRtoARY, 抣, w)
        End Select
        Return ""
    End Function
    '***********************************************************************
    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 "僾儘僷僥傿丂偐側僇僫丂僆儕僕僫儖"
    '***********************************************************************
    Friend Function p僸儞僩昞帵偺嵞愝掕傪幚峴() As Integer
        Return CInt(p僸儞僩昞帵_RW(689574))
    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
        '暥帤傪丂昞帵偟側偄 = 1    '暥帤傪丂偡偙偟昞帵 = 2    '暥帤傪丂偐側傝昞帵 = 3    '暥帤傪丂偡傋偰昞帵 = 4
        Const PropName As String = "p僸儞僩昞帵" : Const 抣DEF As Integer = 2 : Static 抣 As Integer : Dim 媽抣 As Integer
        Static 壓, 忋 As Integer : Static 儊僰() As ToolStripMenuItem  'p僸儞僩昞帵 return 1 to 4  儊僯儏乕僀儞僨僢僋僗
        媽抣 = 抣
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : 抣 = 抣DEF : Call frmMain.aa儊僯儏乕僆僽僕僃愝掕(PropName, 儊僰, 壓, 忋)
            Case gco僾儘僷Get : Return CStr(抣)
            Case gco僾儘僷Let : 抣 = 嘳悢抣斖埻Int(1, 4, Val(s))
            Case gco僾儘僷MenuClick : 抣 = 嘳悢抣斖埻Int(1, 4, Val(s))
            Case gco僾儘僷iniWR : Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD : 抣 = 嘳悢抣斖埻Int(1, 4, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))
            Case 689574   'p僸儞僩昞帵偺嵞愝掕傪幚峴
                'no op
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case 689574, gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷MenuClick, gco僾儘僷iniRD
                Dim r尰嵼偺僇乕僪枃悢 As Integer = p尰嵼偺僇乕僪枃悢
                If r尰嵼偺僇乕僪枃悢 > 0 Then
                    Dim c, a, b, max As Integer : Dim e As Boolean
                    Select Case 抣
                        Case 1, 4
                            For a = 1 To r尰嵼偺僇乕僪枃悢 : m僇乕僪攝楍(a).僸儞僩暥帤 = (抣 = 4) : Next
                        Case 2, 3
                            For a = 1 To r尰嵼偺僇乕僪枃悢 : m僇乕僪攝楍(a).僸儞僩暥帤 = False : Next
                            max = r尰嵼偺僇乕僪枃悢 \ IIf(抣 = 2, 4, 2)
                            c = 0
                            Randomize()
                            Do While c < max
                                b = 嘳悢抣斖埻Int(1, r尰嵼偺僇乕僪枃悢, r尰嵼偺僇乕僪枃悢 * Rnd())
                                If m僇乕僪攝楍(b).僸儞僩暥帤 = False Then
                                    If b Mod 2 = 1 Then
                                        e = (m僇乕僪攝楍(b + 1).僸儞僩暥帤 = False)
                                    Else
                                        e = (m僇乕僪攝楍(b - 1).僸儞僩暥帤 = False)
                                    End If
                                    If e Then
                                        m僇乕僪攝楍(b).僸儞僩暥帤 = True
                                        c = c + 1
                                    End If
                                End If
                            Loop
                    End Select
                End If
        End Select
        If 媽抣 <> 抣 Then
            Select Case 僾儘僷僐儅儞僪
                Case gco僾儘僷弶婜壔, gco僾儘僷Let, gco僾儘僷iniRD, gco僾儘僷MenuClick
                    Try
                        For a As Integer = 壓 To 忋 : 儊僰(a).Checked = (抣 = a) : Next
                    Catch : End Try
            End Select
            Select Case 僾儘僷僐儅儞僪
                Case gco僾儘僷Let, gco僾儘僷MenuClick
                    Try
                        If (Not frmMain.mmLoading) And pp僎乕儉幚峴拞 Then
                            Call aa僇乕僪偺攝抲偲嵞昤夋(3)
                        End If
                    Catch : End Try
            End Select
        End If
        Return CStr(抣)
    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僎乕儉僇乕僪宆_巊梡曄峏_捛壛(ByVal r捛壛Index As Integer) As Integer
        If p僎乕儉僇乕僪宆_巊梡拞偱偡(r捛壛Index) Then Return r捛壛Index
        Dim wAry僇乕僪宆ID(0) As Integer
        Dim m As Integer = p僎乕儉僇乕僪宆_巊梡拞_僇乕僪宆ID_Ary(wAry僇乕僪宆ID)
        m = m + 1
        ReDim Preserve wAry僇乕僪宆ID(m)
        wAry僇乕僪宆ID(m) = -1
        For a As Integer = 1 To m - 1
            If wAry僇乕僪宆ID(a) > r捛壛Index Then
                For b As Integer = m To a + 1 Step -1
                    wAry僇乕僪宆ID(b) = wAry僇乕僪宆ID(b - 1)
                Next
                wAry僇乕僪宆ID(a) = r捛壛Index
                Exit For
            End If
        Next
        If wAry僇乕僪宆ID(m) = -1 Then
            wAry僇乕僪宆ID(m) = r捛壛Index
        End If
        Dim Ary僇乕僪_巊梡偡傞側傜True(c僇乕僪宆Allmax) As Boolean
        For a As Integer = 0 To UBound(Ary僇乕僪_巊梡偡傞側傜True)
            Ary僇乕僪_巊梡偡傞側傜True(a) = False
        Next
        Dim c As Integer
        For a As Integer = 1 To UBound(wAry僇乕僪宆ID)
            c = wAry僇乕僪宆ID(a)
            Ary僇乕僪_巊梡偡傞側傜True(c) = True
        Next
        gggbol = p僎乕儉僇乕僪宆_巊梡曄峏(Ary僇乕僪_巊梡偡傞側傜True)
        qqqqq(p僎乕儉僇乕僪宆_IndexStr_FromAry(Ary僇乕僪_巊梡偡傞側傜True))
        Return r捛壛Index
    End Function
    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 = c僴乕僩宍  '8
        'Private Const c僇乕僪宆USERmin As Integer = cUser0宍 '9
        'Private Const c僇乕僪宆Allmax As Integer = cUser7宍  '16     
        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

                'p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX 偑丂壥偰尵偭偰偄側偄応崌偼丄p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX丂傪愭摢偵曄峏偡傞丅
                t = 惎 + CStr(p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX) + 惎
                If InStr(抣, t) = 0 Then
                    p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX = Val(Mid(抣, 2))   '"仛0仛3.....仛5仛6仛11仛14仛...16仛"  
                End If
                'qqqqq(CStr(p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX) & ", " & 抣)
                'non
            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僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_NextSet() As Integer
        '偐側僇僫丂屌桳
        Return CInt(p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW(125478))
    End Function
    Friend Property p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX() As Integer
        Get
            Return CInt(p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW(gco僾儘僷Get))
        End Get
        Set(ByVal Value As Integer)
            Call p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW(gco僾儘僷Let, CStr(Value))
        End Set
    End Property
    Private Function p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        'Public Const c僇乕僪宆ALLmin As Integer = c巐妏宍  '0
        'Public Const c僇乕僪宆APPmax As Integer = c僴乕僩宍  '8
        'Private Const c僇乕僪宆USERmin As Integer = cUser0宍 '9
        'Private Const c僇乕僪宆Allmax As Integer = cUser7宍  '16     
        Const PropName As String = "p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX"
        Static 抣 As Integer   'c巐妏宍=0   to   cUser7宍=16    
        Dim wAry僇乕僪宆ID(0) As Integer : Dim mmm As Integer : Dim a As Integer : Dim nnn As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷弶婜壔, gco僾儘僷Get, gco僾儘僷Let, 125478
                mmm = p僎乕儉僇乕僪宆_巊梡拞_僇乕僪宆ID_Ary(wAry僇乕僪宆ID)  'return wAry僇乕僪宆ID (  1  to  mmm  )
                If mmm = 0 Then
                    ReDim wAry僇乕僪宆ID(1) : wAry僇乕僪宆ID(1) = c巐妏宍  '0
                End If
        End Select
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                If mmm < 0 Then 抣 = 0 Else 抣 = wAry僇乕僪宆ID(1)

            Case gco僾儘僷Get
                For a = 1 To mmm
                    If wAry僇乕僪宆ID(a) = 抣 Then Return CStr(抣)
                Next
                If mmm = 0 Then Return CStr(0) Else Return CStr(wAry僇乕僪宆ID(1))

            Case gco僾儘僷Let
                nnn = Val(s)
                抣 = 0
                For a = 1 To mmm
                    If wAry僇乕僪宆ID(a) = nnn Then
                        抣 = nnn : Exit For
                    End If
                Next
                If a > mmm Then
                    抣 = wAry僇乕僪宆ID(1)
                End If

            Case 125478
                'p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_NextSet   
                For a = 1 To mmm
                    If wAry僇乕僪宆ID(a) = 抣 Then
                        If a = mmm Then a = 1 Else a = a + 1
                        抣 = wAry僇乕僪宆ID(a)
                        Return CStr(抣)
                    End If
                Next
                '尰嵼偺丂抣丂偑丂p僎乕儉僇乕僪宆_巊梡拞丂帡側偄応崌偼
                Dim sss As String = p僎乕儉僇乕僪宆巊梡拞
                抣 = Val(Mid(sss, 2))  '"仛0仛3.....仛5仛6仛11仛14仛...16仛"  
                Return CStr(抣)

            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))

            Case gco僾儘僷iniRD
                gggstr = p僎乕儉僇乕僪宆巊梡拞偺尰嵼偺IDX_RW(gco僾儘僷Let, 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))

        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend Function p僇乕僪偺柧傞偝ListBox憖嶌(ByVal ListBoxTo攞悢_0_攞悢ToListBox_1 As Integer, ByRef box As ListBox) As Boolean
        If box Is Nothing Then Return False
        Select Case ListBoxTo攞悢_0_攞悢ToListBox_1
            Case 0 '
                p僇乕僪偺柧傞偝 = CSng(p僇乕僪偺柧傞偝_RW(12345, CStr(box.SelectedIndex))) '0 to 10)
            Case 1 '
                box.SelectedIndex = 嘳悢抣斖埻Int(0, box.Items.Count - 1, CInt(p僇乕僪偺柧傞偝_RW(12347, "")))  '0 to 10
        End Select
        Return True
    End Function
    Friend ReadOnly Property p僇乕僪偺柧傞偝DEF() As Single
        Get
            Return CSng(p僇乕僪偺柧傞偝_RW(gco僾儘僷婯掕抣))
        End Get
    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))   'set 0.0 to 1.0
        End Set
    End Property
    Private Function p僇乕僪偺柧傞偝_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByRef s As String = "") As String
        Const PropName As String = "p僇乕僪偺柧傞偝"
        Static 抣 As Single : Const 抣DEF As Single = 0.7
        Dim old As Integer
        old = 抣
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = 抣DEF
            Case gco僾儘僷Get
                Return CStr(抣)  '0.0 to 1.0
            Case gco僾儘僷Let
                抣 = 嘳悢抣斖埻Sng(0.0, 1.0, CSng(s))
            Case gco僾儘僷婯掕抣
                Return CStr(抣DEF)
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                抣 = 嘳悢抣斖埻Sng(0.0, 1.0, Val(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)))
            Case 12345 'p尰嵼偺僼僅儞僩僒僀僘攞悢ListBox憖嶌(0)  Val(s) =  box.SelectedIndex  0 to 10
                抣 = 嘳悢抣斖埻Sng(0.0, 1.0, Val(s) / 10)
                Return CStr(抣)
            Case 12347 'p尰嵼偺僼僅儞僩僒僀僘攞悢ListBox憖嶌(1)  return  box.SelectedIndex  0 to 10
                Return CStr(抣 * 10)  'return 0 to 11
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    Friend ReadOnly Property p僼僅儞僩柤DEF() As String
        Get
            Return CStr(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, Value)
        End Set
    End Property
    Private 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僾儘僷弶婜壔
                抣 = "俵俽 僑僔僢僋"
            Case gco僾儘僷婯掕抣
                Return "俵俽 僑僔僢僋"
            Case gco僾儘僷Get
                Return 抣
            Case gco僾儘僷Let, gco僾儘僷MenuClick
                If 抣 <> s Then 抣 = s
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, 抣)
            Case gco僾儘僷iniRD
                抣 = 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s)
        End Select
        Return 抣
    End Function
    '***********************************************************************
    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尰嵼偺僼僅儞僩僒僀僘"
        Static 抣 As Single
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = 12.0  '僇乕僪僒僀僘偺曄壔偵傛傝丂忢偵曄峏偝傟傞丅
            Case gco僾儘僷Get
                Return CStr(抣)
            Case gco僾儘僷Let
                If 抣 <> Val(s) Then
                    抣 = Math.Max(8, Math.Min(144, Val(s)))
                End If
                Return CStr(抣)
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                抣 = CSng(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))
        End Select
        Return CStr(抣)
    End Function
    '***********************************************************************
    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尰嵼偺僼僅儞僩儃乕儖僪"
        Static 抣 As Boolean
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = True  '僇乕僪僒僀僘偺曄壔偵傛傝丂忢偵曄峏偝傟傞丅
            Case gco僾儘僷婯掕抣
                Return CStr(True)
            Case gco僾儘僷Get
                Return CStr(抣)
            Case gco僾儘僷Let
                If 抣 <> CBool(s) Then 抣 = CBool(s)
            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
    '***********************************************************************
    Friend Function p尰嵼偺僼僅儞僩僒僀僘攞悢ListBox憖嶌(ByVal ListBoxTo攞悢_0_攞悢ToListBox_1 As Integer, ByRef box As ListBox) As Boolean
        If box Is Nothing Then Return False
        Select Case ListBoxTo攞悢_0_攞悢ToListBox_1
            Case 0 '
                p尰嵼偺僼僅儞僩僒僀僘攞悢 = CSng(p尰嵼偺僼僅儞僩僒僀僘攞悢_RW(12345, CStr(box.SelectedIndex))) '0 to 4
            Case 1 '
                box.SelectedIndex = 嘳悢抣斖埻Int(0, box.Items.Count - 1, CInt(p尰嵼偺僼僅儞僩僒僀僘攞悢_RW(12347, "")))  '0 to 4
        End Select
        Return True
    End Function
    Friend ReadOnly Property p尰嵼偺僼僅儞僩僒僀僘攞悢DEF() As Single
        Get
            Return CSng(p尰嵼偺僼僅儞僩僒僀僘攞悢_RW(gco僾儘僷婯掕抣))
        End Get
    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 壓 As Integer = 0 : Const 忋 As Integer = 4   'box.SelectedIndex  0 to 4
        Static 抣 As Single : Dim a As Integer
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤
                Return PropName
            Case gco僾儘僷弶婜壔
                抣 = 1.0  '僇乕僪僒僀僘偺曄壔偵傛傝丂忢偵曄峏偝傟傞丅
            Case gco僾儘僷婯掕抣
                Return CStr(1.0)
            Case gco僾儘僷Get
                Return CStr(抣)
            Case gco僾儘僷Let
                If 抣 <> Val(s) Then
                    抣 = 嘳悢抣斖埻Sng(0.7, 1.3, Val(s))
                End If
                Return CStr(抣)
            Case gco僾儘僷iniWR
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, CStr(抣))
            Case gco僾儘僷iniRD
                p尰嵼偺僼僅儞僩僒僀僘攞悢 = CSng(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s))

            Case 12345 'p尰嵼偺僼僅儞僩僒僀僘攞悢ListBox憖嶌(0)  Val(s) =  box.SelectedIndex  0 to 4
                a = 嘳悢抣斖埻Int(壓, 忋, Val(s))
                Select Case a
                    Case Is <= 0 : 抣 = 0.7
                    Case Is <= 1 : 抣 = 0.85
                    Case Is <= 2 : 抣 = 1.0
                    Case Is <= 3 : 抣 = 1.15
                    Case Else : 抣 = 1.3
                End Select
                Return CStr(抣)

            Case 12347 'p尰嵼偺僼僅儞僩僒僀僘攞悢ListBox憖嶌(1)  return  box.SelectedIndex  0 to 4
                Select Case 抣
                    Case Is <= 0.7 : a = 0
                    Case Is <= 0.85 : a = 1
                    Case Is <= 1.0 : a = 2
                    Case Is <= 1.15 : a = 3
                    Case Else : a = 4
                End Select
                Return CStr(a)

        End Select
        Return CStr(抣)
    End Function
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Private Const c儕僗僩偺怓攚宨 As Integer = 1
    Private Const c儕僗僩偺怓僇乕僪 As Integer = 2
    Private Const c儕僗僩偺怓僇乕僪榞 As Integer = 3
    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    'Private Function p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓_屇傃弌偟僒儞僾儖()
    '    p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨) = 0
    '    p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪) = 0
    '    p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺偺怓僇乕僪榞) = 0
    '    Dim a As Integer = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓攚宨)
    '    Dim b As Integer = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓僇乕僪)
    '    Dim c As Integer = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺偺怓僇乕僪榞)
    'End Function
    Friend ReadOnly Property p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(ByVal typIDX123 As Integer) As Integer
        Get
            Return CInt(p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓_RW(gco僾儘僷婯掕抣, typIDX123))
        End Get
    End Property
    Friend Property p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(ByVal typIDX123 As Integer) As Integer
        Get
            Return CInt(p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓_RW(gco僾儘僷Get, typIDX123))
        End Get
        Set(ByVal Value As Integer)
            Call p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓_RW(gco僾儘僷Let, typIDX123, CStr(Value))
        End Set
    End Property
    Friend Function p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓_RW(ByRef 僾儘僷僐儅儞僪 As Integer, Optional ByVal typIDX123 As Integer = 1, Optional ByRef s As String = "") As String
        Const PropName As String = "p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓" : Const cut As String = "," : Static 婯掕抣() As Integer = {0, &H55FFFF&, &HFF0020&, &H55AA&}
        Const 壓 As Integer = 1 : Const 忋 As Integer = 3 : Static 抣(忋) As Integer
        Dim typ As Integer = 嘳悢抣斖埻Int(壓, 忋, typIDX123)
        Select Case 僾儘僷僐儅儞僪
            Case gco僾儘僷柤 : Return PropName
            Case gco僾儘僷弶婜壔 : For a As Integer = 壓 To 忋 : 抣(a) = 婯掕抣(a) : Next
            Case gco僾儘僷婯掕抣 : Return CStr(婯掕抣(typ))
            Case gco僾儘僷Get : Return CStr(抣(typ))
            Case gco僾儘僷Let : 抣(typ) = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(s)))
            Case gco僾儘僷iniWR
                Dim ww As String = CStr(抣(壓)) & cut & CStr(抣(壓 + 1)) & cut & CStr(抣(壓 + 2)) & cut
                Return 嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniWR, PropName, ww)
            Case gco僾儘僷iniRD
                Dim ary() As String = {""}
                Dim m As Integer = 嘳暥傪僇僢僩偟偰攝楍偵偡傞(嘳Ini僨乕僞乕暥_RW(gco僾儘僷iniRD, PropName, s), cut, ary, False)
                If m = 忋 Then
                    For a As Integer = 壓 To 忋
                        抣(a) = CInt(嘳怓偺抣偺専嵏廋惓抣(Val(ary(a))))
                    Next
                End If
        End Select
        Return "0"
    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僎乕儉梡_夋憸僼傽僀儖偺愗懼僞僀儅乕()")
        '2023/06/17 ************************************************************ 
        wChangeDone = False
        If Not p僎乕儉攚宨夋憸傪昞帵BOOL Then Return
        '2023/06/17 ************************************************************ 
        'qqqqq("rCur僼傽僀儖   " & rCur僼傽僀儖)
        'qqqqq("rNext僼傽僀儖  " & rNext僼傽僀儖)
        gggstr = zz僎乕儉昤夋梡僼傽僀儖怴婯愝掕(frmMain, rNext僼傽僀儖)
        gggbol = aa昤夋梡_pctBoxs_僙僢僩Image(frmMain, rNext僼傽僀儖, pp僎乕儉幚峴拞)
        gggbol = aa僇乕僪偺攝抲偲嵞昤夋(3)
        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僎乕儉梡.夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨
        '2023/06/02 ************************************************************ 
        If Not p僎乕儉攚宨夋憸傪昞帵BOOL Then
            p僎乕儉攚宨夋憸傪昞帵BOOL = True
        End If
        '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

    Private Sub DlgFile僇乕僪梡_夋憸僼傽僀儖偺愗懼僞僀儅乕(ByVal rCur僼傽僀儖 As String, ByVal rNext僼傽僀儖 As String, ByRef wChangeDone As Boolean) Handles DlgFile僇乕僪梡.夋憸僼傽僀儖偺愗懼僞僀儅乕
        '2022/09/23  僞僀儅乕偵傛傞丄僇乕僪梡偺夋憸僼傽僀儖偺丄帺摦曄峏偼側偟丅
    End Sub
    Private Sub DlgFile僇乕僪梡_夋憸僼傽僀儖偺愗懼僞僀儅乕堦昩偛偲偺捠抦(ByRef wIs枮婜 As Boolean) Handles DlgFile僇乕僪梡.夋憸僼傽僀儖偺愗懼僞僀儅乕堦昩偛偲偺捠抦
        '2022/09/23  僞僀儅乕偵傛傞丄僇乕僪梡偺夋憸僼傽僀儖偺丄帺摦曄峏偼側偟丅
    End Sub
    Private Sub DlgFile僇乕僪梡_夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨(ByVal rNew僼傽僀儖 As String, ByRef wChangeDone As Boolean) Handles DlgFile僇乕僪梡.夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨
        '2022/09/23  僟僀傾儘僌傪巊梡偟偰丄柧帵揑偵僇乕僪夋憸偑曄峏偝傟偨丅
        Dim wPctCurBmp廲墶斾棪 As Single
        Dim ff As String = DlgFile僇乕僪梡.aa夋憸僼傽僀儖僆乕僾儞_into_ImageBox(rNew僼傽僀儖, frmMain.pctCardBmp.Image, wPctCurBmp廲墶斾棪)
        If ff <> "" Then
            'gggbol = 嘳Clipboard_SetImage_From_GDIBmp_Or_Image(0, frmMain.pctCardBmp.Image)
            'qqqqq("Img曉偡.Width  " + Format(frmMain.pctCardBmp.Image.Width, "0000") + ",  Img曉偡.Height  " + Format(frmMain.pctCardBmp.Image.Height, "0000") + vbCrLf)
            If app偡偖偵僎乕儉傪奐巒 Then
                gggbol = zz昁偢僎乕儉傪幚峴偡傞_偁傞偄偼僎乕儉忬懺傪嵞昤夋(3, 0, False)
            End If
            wChangeDone = True
        Else
            wChangeDone = False
        End If
        app偡偖偵僎乕儉傪奐巒 = False
        'qqqqq("DlgFile僇乕僪梡_夋憸僼傽僀儖偺慖戰偑幚峴偝傟偨")
    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_夋憸愗傝懼偊僞僀儅乕偺僆儞僆僼(ByRef rEventOwner As Integer, ByRef rTimerOnOff As Boolean, ByRef wRetVal As Boolean) Handles 僀儀儞僩gAppEventMaker.夋憸愗傝懼偊僞僀儅乕偺僆儞僆僼
        If rEventOwner = gmDlgFile僎乕儉梡 Then
            If DlgFile僎乕儉梡 Is Nothing Then Return
            Dim eee As Boolean = (Not DlgFile僎乕儉梡.Visible)
            If rTimerOnOff Then
                eee = eee And (Not p僎乕儉攚宨夋憸偺愗傝懼偊_僞僀儉僇僂儞僩僆乕僶乕())
            Else
                eee = False
            End If
            DlgFile僎乕儉梡.tim愗傝懼偊僞僀儅乕.Enabled = eee
        Else

        End If
    End Sub

#End Region

#Region "僀儀儞僩 from 僒僂儞僪愝掕Dlg ( frmDlgSoundKana )"
    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 frmDlgSoundKana
                        僒僂儞僪愝掕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_僟僀傾儘僌偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer) Handles 僒僂儞僪愝掕Dlg.僟僀傾儘僌偺弶婜壔傪偟偰偔偩偝偄
        wIsOK = True
        wMe_gmDlgID = gmDlg僒僂儞僪愝掕
    End Sub
    Private Sub 僒僂儞僪愝掕Dlg_尰嵼偺僒僂儞僪僼傽僀儖儕僗僩傪偔偩偝偄(ByRef wFileAry() As String) Handles 僒僂儞僪愝掕Dlg.尰嵼偺僒僂儞僪僼傽僀儖儕僗僩傪偔偩偝偄
        ReDim wFileAry(0)
        gggint = CInt(p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷GetARY, wFileAry, ""))
    End Sub
    Private Sub 僒僂儞僪愝掕Dlg_尰嵼偺僾儘僷僥傿僨乕僞乕傪偔偩偝偄(ByRef w僒僂儞僪傪柭傜偡 As Boolean, ByRef w僒僂儞僪傪柭傜偡DEF As Boolean, ByRef w僒僂儞僪偁偨傝 As String, ByRef w僒僂儞僪偁偨傝DEF As String, ByRef w僒僂儞僪僴僘儗 As String, ByRef w僒僂儞僪僴僘儗DEF As String) Handles 僒僂儞僪愝掕Dlg.尰嵼偺僾儘僷僥傿僨乕僞乕傪偔偩偝偄
        w僒僂儞僪傪柭傜偡 = p僒僂儞僪傪柭傜偡 : w僒僂儞僪傪柭傜偡DEF = p僒僂儞僪傪柭傜偡DEF
        w僒僂儞僪偁偨傝 = p僒僂儞僪偁偨傝 : w僒僂儞僪偁偨傝DEF = p僒僂儞僪偁偨傝DEF
        w僒僂儞僪僴僘儗 = p僒僂儞僪僴僘儗 : w僒僂儞僪僴僘儗DEF = p僒僂儞僪僴僘儗DEF
    End Sub
    Private Sub 僒僂儞僪愝掕Dlg_怴偟偄僒僂儞僪僼傽僀儖儕僗僩傪愝掕偟側偝偄(ByRef rFileAry() As String) Handles 僒僂儞僪愝掕Dlg.怴偟偄僒僂儞僪僼傽僀儖儕僗僩傪愝掕偟側偝偄
        gggint = CInt(p僒僂儞僪僼傽僀儖偺攝楍_RW(gco僾儘僷LetARY, rFileAry, ""))
    End Sub
    Private Sub 僒僂儞僪愝掕Dlg_怴偟偄僾儘僷僥傿僨乕僞乕傪愝掕偟側偝偄(ByVal r愝掕code_000 As String, ByVal r僒僂儞僪傪柭傜偡 As Boolean, ByVal r僒僂儞僪偁偨傝 As String, ByVal r僒僂儞僪僴僘儗 As String) Handles 僒僂儞僪愝掕Dlg.怴偟偄僾儘僷僥傿僨乕僞乕傪愝掕偟側偝偄
        If Len(r愝掕code_000) <> 3 Then Return '"000"  "100"  "110"  "111" ....
        If Mid(r愝掕code_000, 1, 1) = "1" Then p僒僂儞僪傪柭傜偡 = r僒僂儞僪傪柭傜偡
        If Mid(r愝掕code_000, 2, 1) = "1" Then p僒僂儞僪偁偨傝 = r僒僂儞僪偁偨傝
        If Mid(r愝掕code_000, 3, 1) = "1" Then p僒僂儞僪僴僘儗 = r僒僂儞僪僴僘儗
    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 ( frmDlgOptionKana )"
    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 frmDlgOptionKana
                        僆僾僔儑儞愝掕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_僟僀傾儘僌偺弶婜壔傪偟偰偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer) Handles 僆僾僔儑儞愝掕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 (frmDlg僇乕僪宆僇儗儞僩慖戰 )"

    Friend Sub mn3opt僎乕儉梡僇乕僪宆傪愗懼_Click(ByVal rOwner As Form)
        If gm傾僾儕廔椆偡傞 Then Return
        偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg = New frmDlg僇乕僪宆僇儗儞僩慖戰
        偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg.Show()   '.ShowDialog()
    End Sub

    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg_僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer, ByRef w僟僀傾儘僌僥僉僗僩 As String, ByRef w巊梡栚揑儊僢僙乕僕 As String, ByRef w僞僥屄悢 As Integer, ByRef w巊梡屄悢_0_to_max As Integer, ByRef w傾僾儕宆_max As Integer, ByRef w僙儖暆 As Integer, ByRef w僙儖崅 As Integer, ByRef wCell娫僞僥儓僐 As Integer, ByRef w恾宍奜墢榞暆 As Integer, ByRef w恾宍奜墢榞怓 As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg.僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄
        wIsOK = True
        wMe_gmDlgID = gmDlg偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏
        w僟僀傾儘僌僥僉僗僩 = "僎乕儉梡僇乕僪宆傪愗懼"
        w巊梡栚揑儊僢僙乕僕 = ""
        w僞僥屄悢 = 4
        w巊梡屄悢_0_to_max = c僇乕僪宆Allmax 'cUser7宍  '16     
        w傾僾儕宆_max = c僇乕僪宆APPmax 'c僴乕僩宍  '8
        w僙儖暆 = 60
        w僙儖崅 = 60
        wCell娫僞僥儓僐 = 20
        w恾宍奜墢榞暆 = 1
        w儕僗僩攚宨怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨)
        w慖戰怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪)
        w恾宍奜墢榞怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞)
    End Sub

    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg_僇乕僪僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByVal r僇乕僪宆IDX As Integer, ByVal r僙儖暆 As Integer, ByVal r僙儖崅 As Integer, ByRef w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer, ByRef w僇乕僪傪巊梡偟偰偄傞 As Boolean) Handles 偐側僇僫僎乕儉梡僇乕僪宆慖戰曄峏Dlg.僇乕僪僨乕僞乕傪偔偩偝偄
        w僇乕僪傪巊梡偟偰偄傞 = p僎乕儉僇乕僪宆_巊梡拞偱偡(r僇乕僪宆IDX)
        Dim Rgn榞 As Integer = 0
        wIsOK = aa僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(False, r僇乕僪宆IDX, r僙儖暆, r僙儖崅, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, Rgn榞, 0, 0, 0, 0)
        '-----------
        If Rgn榞 <> 0 Then DeleteObject(Rgn榞)
        Rgn榞 = 0
    End Sub

#End Region

#Region "僀儀儞僩 from 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg ( 巐frmDlgUseCardSelect )"

    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 巐frmDlgUseCardSelect
                        偐側僇僫僎乕儉梡僇乕僪宆愝掕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_僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByRef wMe_gmDlgID As Integer, ByRef w僟僀傾儘僌僥僉僗僩 As String, ByRef w巊梡栚揑儊僢僙乕僕 As String, ByRef w僞僥屄悢 As Integer, ByRef w巊梡屄悢_0_to_max As Integer, ByRef w傾僾儕宆_max As Integer, ByRef w僙儖暆 As Integer, ByRef w僙儖崅 As Integer, ByRef wCell娫僞僥儓僐 As Integer, ByRef w恾宍奜墢榞暆 As Integer, ByRef w恾宍奜墢榞怓 As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僂僀儞僪僂偺弶婜壔僨乕僞乕傪偔偩偝偄
        wIsOK = True
        wMe_gmDlgID = gmDlg偐側僇僫僇乕僪宆傪愝掕
        w僟僀傾儘僌僥僉僗僩 = "僎乕儉梡僇乕僪宆偺愗傝懼偊僌儖乕僾愝掕"
        w巊梡栚揑儊僢僙乕僕 = "僎乕儉拞偵愗傝懼偊傞" & vbCrLf & "僇乕僪宆僌儖乕僾傪慖戰"
        w僞僥屄悢 = 4
        w巊梡屄悢_0_to_max = c僇乕僪宆Allmax 'cUser7宍  '16     
        w傾僾儕宆_max = c僇乕僪宆APPmax 'c僴乕僩宍  '8
        w僙儖暆 = 60
        w僙儖崅 = 60
        wCell娫僞僥儓僐 = 20
        w恾宍奜墢榞暆 = 1
        w儕僗僩攚宨怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨)
        w慖戰怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪)
        w恾宍奜墢榞怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞)
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇乕僪僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByVal r僇乕僪宆IDX As Integer, ByVal r僙儖暆 As Integer, ByVal r僙儖崅 As Integer, ByRef w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer, ByRef w僇乕僪傪巊梡偟偰偄傞 As Boolean) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇乕僪僨乕僞乕傪偔偩偝偄
        w僇乕僪傪巊梡偟偰偄傞 = p僎乕儉僇乕僪宆_巊梡拞偱偡(r僇乕僪宆IDX)
        Dim Rgn榞 As Integer = 0
        wIsOK = aa僎乕儉僇乕僪宆儕乕僕儑儞傪嶌傞(False, r僇乕僪宆IDX, r僙儖暆, r僙儖崅, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, Rgn榞, 0, 0, 0, 0)
        '-----------
        If Rgn榞 <> 0 Then DeleteObject(Rgn榞)
        Rgn榞 = 0
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇乕僪宆偺慖戰忬懺傪曄峏偟偰壓偝偄(ByRef wIsOK As Boolean, ByRef r僇乕僪慖戰僨乕僞乕() As Boolean) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇乕僪宆偺慖戰忬懺傪曄峏偟偰壓偝偄
        wIsOK = p僎乕儉僇乕僪宆_巊梡曄峏(r僇乕僪慖戰僨乕僞乕)
        gggbol = zz昁偢僎乕儉傪幚峴偡傞_偁傞偄偼僎乕儉忬懺傪嵞昤夋(3, 1, False)
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪(ByRef wIsOK As Boolean, ByRef r僐儅儞僪 As Integer, ByRef r捛壛僨乕僞乕 As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇乕僪宆慖戰僟僀傾儘僌偐傜僐儅儞僪幚峴偺梫惪
        wIsOK = True
        Select Case r僐儅儞僪
            Case gccom傾僾儕廔椆
                Call frmMain.mn1game偙偺傾僾儕傪廔椆_Click(Nothing, Nothing)
            Case Else
                wIsOK = False
        End Select
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇乕僪枃悢偲僗僀僗僀儊僯儏乕傪巊梡偟傑偡偐(ByRef wIsOK As Boolean, ByRef w僇乕僪枃悢儊僯儏乕傪巊梡偡傞 As Boolean, ByRef w僗僀僗僀儊僯儏乕傪巊梡偡傞 As Boolean) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇乕僪枃悢偲僗僀僗僀儊僯儏乕傪巊梡偟傑偡偐
        wIsOK = True
        w僇乕僪枃悢儊僯儏乕傪巊梡偡傞 = False
        w僗僀僗僀儊僯儏乕傪巊梡偡傞 = False
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇乕僪枃悢巜掕Checked愝掕(ByRef wIsOK As Boolean, ByRef mnu僇乕僪枃悢_1 As System.Windows.Forms.ToolStripMenuItem, ByRef mnu僇乕僪枃悢_2 As System.Windows.Forms.ToolStripMenuItem, ByRef mnu僇乕僪枃悢_3 As System.Windows.Forms.ToolStripMenuItem, ByRef mnu僇乕僪枃悢_4 As System.Windows.Forms.ToolStripMenuItem, ByRef mnu僇乕僪枃悢_5 As System.Windows.Forms.ToolStripMenuItem) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇乕僪枃悢巜掕Checked愝掕
        'no use
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇儔乕偑曄峏偝傟傑偟偨(ByVal rIndex As Integer, ByVal rColor As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇儔乕偑曄峏偝傟傑偟偨
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(rIndex) = rColor
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇儔乕傪偡傋偰尦偵栠偟側偝偄(ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt As Integer, ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇儔乕傪偡傋偰尦偵栠偟側偝偄
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨) = rColor1stt
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪) = rColor2stt
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞) = rColor3stt
        w儕僗僩攚宨怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨)
        w慖戰怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪)
        w恾宍奜墢榞怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞)
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄(ByRef w儕僗僩攚宨怓 As Integer, ByRef w慖戰怓 As Integer, ByRef w恾宍奜墢榞怓 As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.僇儔乕傪婯掕抣偵儕僙僢僩偟側偝偄
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓攚宨)
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓僇乕僪)
        p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓僇乕僪榞)
        w儕僗僩攚宨怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨)
        w慖戰怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪)
        w恾宍奜墢榞怓 = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞)
    End Sub
    Private Sub 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg_儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄(ByRef w尦偵栠偡 As Boolean, ByRef w婯掕抣偵儕僙僢僩 As Boolean, ByVal rColor1stt As Integer, ByVal rColor2stt As Integer, ByVal rColor3stt As Integer) Handles 偐側僇僫僎乕儉梡僇乕僪宆愝掕Dlg.儊僯儏乕偺Enabled僨乕僞乕傪偔偩偝偄
        w尦偵栠偡 = Not ((p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨) = rColor1stt) And (p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪) = rColor2stt) And (p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞) = rColor3stt))
        w婯掕抣偵儕僙僢僩 = Not ((p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓攚宨) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓攚宨)) And (p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓僇乕僪)) And (p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓(c儕僗僩偺怓僇乕僪榞) = p偐側僇僫僎乕儉梡僇乕僪宆傪愝掕僟僀傾儘僌偺怓DEF(c儕僗僩偺怓僇乕僪榞)))
    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

End Class

