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

#Region "愰尵"
    Private mMe_gmDlgID As Integer = 0
    Private Const cPointMax As Integer = 5000
    Private Const cfmt000 As String = "000"

    Private mNew_ing As Boolean = True
    Private m僒儞僾儖WD As Integer = 400 ' pct僒儞僾儖.Width
    Private m僒儞僾儖HT As Integer = 400 ' pct僒儞僾儖.Height

    Private c揾傝偮傇偟怓 As Integer = &HFFFF00&
    Private c奜榞専嵏怓 As Integer = &HFF&
    Private c奜榞姰惉怓 As Integer = &HFF0000&

    Private Const c僇乕僪僨僓僀儞嶌惉 As String = "僇乕僪僨僓僀儞嶌惉"
    Private Const c僇乕僪偺曐懚偲夞暅 As String = "僇乕僪僨僓僀儞偺曐懚偲夞暅"
    Private mPoint(cPointMax) As POINTAPI
    Private mCurPointMax As Integer
    Private mCurbai As Single
    Private mShow1僼僅乕儉暆, mShow1僼僅乕儉崅 As Integer, mCur僼僅乕儉暆, mCur僼僅乕儉崅 As Integer
    Private mMsEvFirst, mLoading, mMsDragDrawing As Boolean
    Private mTaisho, m婎弨柺愊 As Integer
    Private m婎弨斾棪, m婎弨斾棪墶, m婎弨墶, m婎弨廲, m婎弨斾棪廲, mOld婎弨斾棪 As Single
    Private mFirstX, mFirstY, mOldX, mOldY, mOldXXXX, mOldYYYY As Integer

    Private m儁僀儞僩儌乕僪 As Boolean = False
    Private mChange As Boolean = False
    Private m儕僗僩僨乕僞乕偐傜偺儅僂僗僀儀儞僩幚峴拞 As Boolean
    Private mStartHight, m奜榞暆, m僼僅乕儉嵞彫暆 As Integer
    Private m僞僀僩儖僿僢僪暥帤_帪崗暥帤楍偺慜偵 As String

    Private mpct僌儔僼_BKUP As Image = Nothing
    Private mpct僒儞僾儖_BKUP As Image = Nothing
    Private mpct曐懚栠偡_BKUP As Image = Nothing

    Private mpct僒儞僾儖_Color_BackColor As Color = Nothing
    Private m僨僓僀儞儃僢僋僗撪偺桳岠側僇乕僪椞堟偺嵟掅尷奅 As Single = 0.5!
    '***************************************************
    Private Structure mnuary
        Dim mnu As ToolStripMenuItem
        Dim val As Single
    End Structure
    Private mnu0_15 As Integer = 15
    Private mnu廲墶偺斾棪ary(mnu0_15) As mnuary  '0 to 15  16 item
    Private mnu0_6 As Integer = 6
    Private mnupop尦偵栠偡ary(mnu0_6) As mnuary   '0 to 6    7 item
    '**************************************************************************************************************************************
    Private WithEvents 僀儀儞僩gAppEventMaker As 屲clsEventMaker
    '**************************************************************************************************************************************
    Private WithEvents m岥岥僇乕僪曐懚偲夞暅 As 屲clsCellListBox
    Private m岥岥僇乕僪曐懚偲夞暅Curindex As Integer = -1
    '***************************************************
#End Region

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

#Region "僼僅乕儉僀儀儞僩"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Public Sub New()
        ' 偙偺屇傃弌偟偼丄Windows 僼僅乕儉 僨僓僀僫偱昁梫偱偡丅
        InitializeComponent()
        ' InitializeComponent() 屇傃弌偟偺屻偱弶婜壔傪捛壛偟傑偡丅
        mNew_ing = True
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUserCardMake_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        m僒儞僾儖WD = pct僒儞僾儖.Width
        m僒儞僾儖HT = pct僒儞僾儖.Height
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUserCardMake_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd
        Me.Refresh()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUserCardMake_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        gggbol = zzMenuAryMakeDel(2)
        '--------------------------------------------------
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僼僅乕儉偺昞帵徚嫀(mMe_gmDlgID, False)
        '--------------------------------------------------
        gggbol = zzAppIniFileOp(1)
        '--------------------------------------------------
        mpct僌儔僼_BKUP.Dispose()
        mpct僒儞僾儖_BKUP.Dispose()
        mpct曐懚栠偡_BKUP.Dispose()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub 巐frmDlgUserCardMake_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        qqqqq("巐frmDlgUserCardMake_Disposed")
        Call frmMain.儐乕僓乕僇乕僪偺曇廤_SetNothing()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzMenuAryMakeDel(ByVal make1_del2 As Integer) As Boolean
        Dim a As Integer
        If make1_del2 = 1 Then
            a = -1
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪05 : .val = 0.5! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪06 : .val = 0.6! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪07 : .val = 0.7! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪08 : .val = 0.8! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪09 : .val = 0.9! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪10 : .val = 1.0! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪11 : .val = 1.1! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪12 : .val = 1.2! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪13 : .val = 1.3! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪14 : .val = 1.4! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪15 : .val = 1.5! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪16 : .val = 1.6! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪17 : .val = 1.7! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪18 : .val = 1.8! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪19 : .val = 1.9! : End With
            a = a + 1 : With mnu廲墶偺斾棪ary(a) : .mnu = mnu廲墶偺斾棪20 : .val = 2.0! : End With
            a = -1
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop001億僀儞僩栠偡 : .val = 1.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop003億僀儞僩栠偡 : .val = 3.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop005億僀儞僩栠偡 : .val = 5.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop010億僀儞僩栠偡 : .val = 10.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop020億僀儞僩栠偡 : .val = 20.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop050億僀儞僩栠偡 : .val = 50.0! : End With
            a = a + 1 : With mnupop尦偵栠偡ary(a) : .mnu = mnupop100億僀儞僩栠偡 : .val = 100.0! : End With
        Else
            For a = 0 To mnu0_15 : mnu廲墶偺斾棪ary(a).mnu = Nothing : Next
            For a = 0 To mnu0_6 : mnupop尦偵栠偡ary(a).mnu = Nothing : Next
        End If
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Friend Function aaDlgShow(ByRef rOwner As Form, ByRef 廲墶min As Single, ByRef 廲墶max As Single, ByRef r僨僓僀儞儃僢僋僗撪偺桳岠側僇乕僪椞堟偺嵟掅尷奅 As Single, _
                                      ByRef r僞僀僩儖僿僢僪暥帤_帪崗暥帤楍偺慜偵 As String, ByRef r僞僀僩儖暥愝掕偺挿偝 As Integer, ByRef rWindowDefHight As Integer, _
                                      ByRef r僇乕僪儕僗僩儓僐屄悢 As Integer, ByRef r僇乕僪儕僗僩僞僥屄悢 As Integer, ByRef r僇乕僪儕僗僩屄悢_1_to_max As Integer) As Boolean
        '---------------------------------------------
        mNew_ing = False
        '---------------------------------------------
        mChange = False
        mLoading = True
        mMe_gmDlgID = gmDlg儐乕僓乕僇乕僪偺曇廤
        '-----------------------------------
        m僨僓僀儞儃僢僋僗撪偺桳岠側僇乕僪椞堟偺嵟掅尷奅 = r僨僓僀儞儃僢僋僗撪偺桳岠側僇乕僪椞堟偺嵟掅尷奅
        m僞僀僩儖僿僢僪暥帤_帪崗暥帤楍偺慜偵 = r僞僀僩儖僿僢僪暥帤_帪崗暥帤楍偺慜偵 '偙偺僋儔僗傪巊梡偡傞僾儘僌儔儉偑暋悢偁傞偺偱丄偦傟偧傟偵僇僗僞儅僀僘偱偒傞傛偆偵偡傞丅
        '-----------------------------------
        僀儀儞僩gAppEventMaker = gAppEventMaker
        '-----------------------------------
        pct僒儞僾儖.Image = New Bitmap(400, 400)
        pctUser0.Image = New Bitmap(137, 120)
        pct僇乕僪昗弨宆.Image = New Bitmap(220, 220)
        pct僇乕僪怴婯曐懚.Image = New Bitmap(220, 220)
        '-----------------------------------
        mpct僌儔僼_BKUP = pct僌儔僼.Image.Clone  '嵞昤夋帪偵僐僺乕尦偲側傞
        mpct僒儞僾儖_BKUP = pct僒儞僾儖.Image.Clone
        mpct曐懚栠偡_BKUP = pct僇乕僪怴婯曐懚.Image.Clone
        '-----------------------------------
        Dim bm As Bitmap = pct僒儞僾儖.Image
        mpct僒儞僾儖_Color_BackColor = bm.GetPixel(2, 2)
        '-----------------------------------
        m僒儞僾儖WD = pct僒儞僾儖.Width
        m僒儞僾儖HT = pct僒儞僾儖.Height
        m僼僅乕儉嵞彫暆 = Me.Width
        m奜榞暆 = lst.Left
        '-----------------------------------
        gggbol = zzMenuAryMakeDel(1)
        Dim a As Integer
        For a = 0 To mnu0_15 : With mnu廲墶偺斾棪ary(a) : .mnu.Visible = (.val >= 廲墶min And .val <= 廲墶max) : End With : Next
        '-----------------------------------
        If Not zzAppIniFileOp(0) Then gggint = 嘳FormMove(gco僼僅乕儉傪僗僋儕乕儞拞怱偵堏摦, Me)
        '-----------------------------------
        If rWindowDefHight = 0 Then mStartHight = Me.Height Else mStartHight = rWindowDefHight 'Me.Height 嵞愝掕
        pnl僇乕僪曐懚偲夞暅.Visible = False
        '***************************************************
        m岥岥僇乕僪曐懚偲夞暅 = New 屲clsCellListBox
        Dim 岥岥岥width As Integer, 岥岥岥height As Integer
        Dim 岥岥岥left As Integer = 270, 岥岥岥top As Integer = 78
        Dim 巊梡屄悢 As Integer = r僇乕僪儕僗僩屄悢_1_to_max
        Dim rw恾宍奜墢榞暆 As Integer = 2
        Dim rw僙儖暆 As Integer = 90
        Dim rw僙儖崅 As Integer = 90
        Dim rwCell娫僞僥儓僐 As Integer = 30
        Dim rMouseChkInSide_0_to_03 As Single = 0.05
        Dim rw儕僗僩攚宨怓 As Integer = &HFF0000&
        Dim rw慖戰怓 As Integer = &HFF00&
        Dim rw恾宍奜墢榞怓 As Integer = &HFFFFFF&
        gggbol = m岥岥僇乕僪曐懚偲夞暅.僙儖儕僗僩嶌惉偲弶婜壔(pnl僇乕僪曐懚偲夞暅, BorderStyle.None, True, r僇乕僪儕僗僩儓僐屄悢, r僇乕僪儕僗僩僞僥屄悢, 巊梡屄悢, rw恾宍奜墢榞暆, rw僙儖暆, rw僙儖崅, rwCell娫僞僥儓僐, rMouseChkInSide_0_to_03, rw儕僗僩攚宨怓, rw慖戰怓, rw恾宍奜墢榞怓, 岥岥岥left, 岥岥岥top, 岥岥岥width, 岥岥岥height)
        '---------------------------------------------------
        'qqqqq("m岥岥岥   " + Format(岥岥岥width, "000") + ", " + Format(岥岥岥height, "000"))
        '***************************************************
        '-----------------------------------
        gggbol = zzClear(True, False)
        mTaisho = 0 : m婎弨斾棪 = 1.0# : mOld婎弨斾棪 = 0 : m婎弨墶 = 400 : m婎弨廲 = 400 : m婎弨柺愊 = m婎弨墶 * m婎弨廲
        '-----------------------------------
        m儕僗僩僨乕僞乕偐傜偺儅僂僗僀儀儞僩幚峴拞 = False
        '-----------------------------------
        mLoading = False
        '-----------------------------------
        Call mnu廲墶偺斾棪_Click_COM(1.0!)
        Call mnu恾宍偺懳徧儌乕僪_Click_COM(0)
        '-----------------------------------
        lst.Height = Me.ClientRectangle.Height - lst.Top - m奜榞暆
        '--------------------------------------------------
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent僼僅乕儉偺昞帵徚嫀(mMe_gmDlgID, True)
        '--------------------------------------------------
        mShow1僼僅乕儉暆 = Me.Width : mShow1僼僅乕儉崅 = Me.Height : mCur僼僅乕儉暆 = mShow1僼僅乕儉暆 : mCur僼僅乕儉崅 = mShow1僼僅乕儉崅
        '-----------------------------------
        gggbol = zzMeCap_MeSize_BtnsTabStops_Set()
        'gggbol = zz僇乕僪傪昗弨偵栠偡EnabledSet()
        '--------------------------------------------------
        Call mnu僨僓僀儞偵栠傞_Click(Nothing, Nothing)
        '--------------------------------------------------
        Me.Icon = rOwner.Icon
        Me.Owner = rOwner
        Me.Show()
        '-----------------------------------
        Return mChange
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "儊僯儏乕僀儀儞僩"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu廲墶偺斾棪_Click_COM(ByVal 斾棪 As Single)
        '---------------------------------------------
        If mNew_ing Then Return
        '---------------------------------------------
        Dim a As Integer
        m婎弨斾棪 = 斾棪
        For a = 0 To mnu0_15 : With mnu廲墶偺斾棪ary(a) : .mnu.Checked = (.val = m婎弨斾棪) : End With : Next
        '---------------------------------------------
        If mLoading Then Return
        If mOld婎弨斾棪 = m婎弨斾棪 Then Return
        '---------------------------------------------
        Dim n, hh, ww As Single
        n = m婎弨斾棪 : ww = Math.Sqrt(m婎弨柺愊 / n) : hh = ww * n : ww = CInt(CInt(ww \ 4) * 4) : hh = CInt(CInt(hh \ 4) * 4)
        '---------------------------------------------
        m婎弨斾棪墶 = ww / m婎弨墶 : m婎弨斾棪廲 = hh / m婎弨廲
        '---------------------------------------------
        gggbol = zzpct僌儔僼_Cls() : gggbol = zzpct僒儞僾儖_Cls() : pctUser0.Visible = False
        '---------------------------------------------
        Dim pts(0) As POINTAPI, m As Integer
        If lst.Items.Count > 2 Then
            m = lst.Items.Count - 1
            ReDim pts(m)
            For a = 0 To m
                Call zzListStrToPoint(lst.Items(a), pts(a))
            Next
        End If
        '---------------------------------------------
        Dim oldww, oldhh As Integer : Dim hiww As Single, hihh As Single
        With pct僌儔僼
            oldww = .Width : oldhh = .Height
            .SetBounds(.Left, .Top, ww, hh, BoundsSpecified.All)
            hiww = .Width / oldww : hihh = .Height / oldhh
        End With
        '---------------------------------------------
        If UBound(pts) > 2 Then
            For a = 0 To m
                pts(a).X = pts(a).X * hiww : pts(a).Y = pts(a).Y * hihh
            Next
            Call btn恾宍僋儕傾_Click(Nothing, New System.EventArgs())
            '---------------------------------------------
            For a = 0 To m
                lst.Items.Add(Format(pts(a).X, cfmt000) & "," & Format(pts(a).Y, cfmt000))
            Next
            '---------------------------------------------
            gggbol = pct僌儔僼_Line_ReDrawAll_僒儞僾儖_Draw(pts)
            '---------------------------------------------
        Else
            Call btn恾宍僋儕傾_Click(Nothing, New System.EventArgs())
        End If
        '---------------------------------------------
        mOld婎弨斾棪 = m婎弨斾棪
        '---------------------------------------------
        'qqqqq CStr(ww) + ", " + CStr(hh) + "  /  斾棪 " + CStr(m婎弨斾棪墶) + ", " + CStr(m婎弨斾棪廲)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu廲墶偺斾棪05_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu廲墶偺斾棪05.Click, mnu廲墶偺斾棪06.Click, mnu廲墶偺斾棪07.Click, mnu廲墶偺斾棪08.Click, mnu廲墶偺斾棪09.Click, mnu廲墶偺斾棪10.Click, mnu廲墶偺斾棪11.Click, mnu廲墶偺斾棪12.Click, mnu廲墶偺斾棪13.Click, mnu廲墶偺斾棪14.Click, mnu廲墶偺斾棪15.Click, mnu廲墶偺斾棪16.Click, mnu廲墶偺斾棪17.Click, mnu廲墶偺斾棪18.Click, mnu廲墶偺斾棪19.Click, mnu廲墶偺斾棪20.Click
        If mNew_ing Then Return
        Dim 斾棪 As Single = _
             IIf(sender Is mnu廲墶偺斾棪05, 0.5!, IIf(sender Is mnu廲墶偺斾棪06, 0.6!, IIf(sender Is mnu廲墶偺斾棪07, 0.7!, IIf(sender Is mnu廲墶偺斾棪08, 0.8!, _
             IIf(sender Is mnu廲墶偺斾棪09, 0.9!, IIf(sender Is mnu廲墶偺斾棪10, 1.0!, IIf(sender Is mnu廲墶偺斾棪11, 1.1!, IIf(sender Is mnu廲墶偺斾棪12, 1.2!, _
             IIf(sender Is mnu廲墶偺斾棪13, 1.3!, IIf(sender Is mnu廲墶偺斾棪14, 1.4!, IIf(sender Is mnu廲墶偺斾棪15, 1.5!, IIf(sender Is mnu廲墶偺斾棪16, 1.6!, _
             IIf(sender Is mnu廲墶偺斾棪17, 1.7!, IIf(sender Is mnu廲墶偺斾棪18, 1.8!, IIf(sender Is mnu廲墶偺斾棪19, 1.9!, IIf(sender Is mnu廲墶偺斾棪20, 2.0!, 0.0!))))))))))))))))
        If 斾棪 <> 0.0! Then Call mnu廲墶偺斾棪_Click_COM(斾棪)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍偺懳徧儌乕僪_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍偺懳徧儌乕僪.Click
        'no op
    End Sub
    Private Sub mnu恾宍偺懳徧儌乕僪_Click_COM(ByVal idx As Integer)
        mTaisho = idx
        mnu恾宍偺懳徧儌乕僪側偟.Checked = (idx = 0)
        mnu恾宍偺懳徧儌乕僪嵍塃.Checked = (idx = 1)
        mnu恾宍偺懳徧儌乕僪忋壓.Checked = (idx = 2)
        mnu恾宍偺懳徧儌乕僪忋壓嵍塃.Checked = (idx = 3)
        gggbol = zzPctNonePosSet()
        Call btn恾宍僋儕傾_Click(Nothing, Nothing)
    End Sub
    Private Sub mnu恾宍偺懳徧儌乕僪側偟_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍偺懳徧儌乕僪側偟.Click, mnu恾宍偺懳徧儌乕僪嵍塃.Click, mnu恾宍偺懳徧儌乕僪忋壓.Click, mnu恾宍偺懳徧儌乕僪忋壓嵍塃.Click
        If mNew_ing Then Return
        Dim index As Integer = IIf(sender Is mnu恾宍偺懳徧儌乕僪側偟, 0, IIf(sender Is mnu恾宍偺懳徧儌乕僪嵍塃, 1, IIf(sender Is mnu恾宍偺懳徧儌乕僪忋壓, 2, IIf(sender Is mnu恾宍偺懳徧儌乕僪忋壓嵍塃, 3, -1))))
        If index >= 0 Then
            Call mnu恾宍偺懳徧儌乕僪_Click_COM(index)
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍夋憸_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍夋憸.Click
        mnu恾宍夋憸僇乕僪僨乕僞乕傪嶌惉.Enabled = (pctUser0.Visible = True)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍夋憸奜晹僀儊乕僕偺巊梡曽朄_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍夋憸奜晹僀儊乕僕偺巊梡曽朄.Click
        MsgBox("Windows OS 偺丂[ 儁僀儞僩 ]丂傪婲摦偟傑偡丅" & gggCR2 & _
        "丂侾丂[ 儁僀儞僩 ]丂偵丂400亊400丂掱搙偺敀抧僉儍儞僷僗傪嶌傝傑偡丅" & gggCR2 & _
        "丂俀丂僉儍儞僷僗撪偵丄堦杮偺慄偱暵偠偨恾宍傪嶌偭偰揾傝偮傇偟傑偡丅" & gggCR2 & _
        "丂俁丂恾宍偵恓忬偺撍婲晹暘偑偁傟偽丄僄儔乕偵側傞偙偲偑偁傝傑偡丅" & gggCR2 & _
        "丂係丂恾宍偺柺愊偺僒僀僘偼丄僉儍儞僶僗偺俁侽亾埲忋偵偟傑偡丅" & gggCR2 & _
        "丂俆丂僉儍儞僷僗傪偡傋偰慖戰偟僋儕僢僾儃乕僪偵僐僺乕偟傑偡丅" & gggCR2 & _
        "丂俇丂儊僯儏乕丂[ 僋儕僢僾儃乕僪偐傜揬傝晅偗 ]丂傪幚峴偟傑偡丅" & gggCR2 & _
        "丂俈丂儊僯儏乕丂[ 僇乕僪僨乕僞乕傪嶌惉 ]丂傪幚峴偟傑偡丅" & gggCR2 & _
        "丂俉丂偙偺傾僾儕偱巊梡偱偒傞丄僇乕僪僨乕僞乕偑嶌惉偝傟傑偡丅" & gggCR2, MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "奜晹僀儊乕僕偺巊梡曽朄")
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍夋憸儁僀儞僩傪幚峴_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍夋憸儁僀儞僩傪幚峴.Click
        Dim f As String = "c:\WINDOWS\system32\mspaint.exe"
        If 嘳僼傽僀儖偼懚嵼(f) Then
            gggint = Shell(f, AppWinStyle.NormalFocus)
        Else
            MsgBox(f & gggCR2 & "僼傽僀儖偑尒偮偐傝傑偣傫", MsgBoxStyle.OkOnly, "[ 儁僀儞僩 ]  傪幚峴")
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍夋憸僋儕僢僾儃乕僪_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍夋憸僋儕僢僾儃乕僪.Click
        Dim eee As Boolean = False
        With pct僌儔僼
            pctUser0.SetBounds(.Left, .Top, Width, .Height)
        End With
        If 嘳僋儕僢僾儃乕僪偐傜pctImage傊僐僺乕(pctUser0, 0, 0, pct僌儔僼.Width, pct僌儔僼.Height) Then
            gggbol = zzpct僌儔僼_Cls() : gggbol = zzpct僒儞僾儖_Cls()
            pctUser0.Visible = True
            pctUser0.BringToFront()
            pctUser0.Refresh()
        End If
        mnu恾宍夋憸僇乕僪僨乕僞乕傪嶌惉.Enabled = True
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu恾宍夋憸僇乕僪僨乕僞乕傪嶌惉_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu恾宍夋憸僇乕僪僨乕僞乕傪嶌惉.Click
        If Not pctUser0.Visible Then Return
        Try
            Dim a As Integer : Dim pts(0) As POINTAPI
            gggbol = zzClear(True, True)
            '--------------------------------------------------------
            gggbol = zzpct僒儞僾儖_Cls()
            Me.Cursor = Cursors.WaitCursor : Me.Refresh()
            With pctUser0
                gggint = GMCOM嘳夋憸偺奜榞偺_POINT_攝楍傪嶌惉(pctUser0, 嘳Color峔憿懱_to_怓抣(pctUser0.BackColor), pts, True, c揾傝偮傇偟怓, c奜榞専嵏怓, c奜榞姰惉怓)
                '2016-0814 add ----------------------------------------
                gggint = GMCOM嘳夋憸偺奜榞偺_POINT_攝楍傪埑弅(pts, 0.003) ' 0.005) ' 0.01)
                '2016-0814 add ----------------------------------------
                .Refresh()
                '------------------------------------------------------
                lst.Items.Clear()
                For a = 0 To UBound(pts) : lst.Items.Add(Format(CInt(pts(a).X), cfmt000) & "," & Format(CInt(pts(a).Y), cfmt000)) : Next
                '------------------------------------------------------
                Call zz僒儞僾儖昤夋幚峴()
            End With
            Me.Cursor = System.Windows.Forms.Cursors.Default : Me.Refresh()
            btn尦偵栠偡.Enabled = (lst.Items.Count > 2) : btnpop000尦偵栠偡.Enabled = btn尦偵栠偡.Enabled
            'qqqqq CStr(lst.ListCount)
            Return
        Catch ex As Exception
            MsgBox(ErrorToString()) : Me.Cursor = Cursors.Default : Return
        End Try
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu暵偠傞偙偺僂僀儞僪僂傪暵偠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu暵偠傞偙偺僂僀儞僪僂傪暵偠傞.Click
        Me.Close()
    End Sub
#End Region

#Region "儃僞儞僀儀儞僩"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btnpop000尦偵栠偡_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnpop000尦偵栠偡.Click
        mnupop000尦偵栠偡.Show(btnpop000尦偵栠偡, btnpop000尦偵栠偡.Width \ 2, btnpop000尦偵栠偡.Height \ 2)
    End Sub
    Private Sub mnupop001億僀儞僩栠偡_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnupop001億僀儞僩栠偡.Click, mnupop003億僀儞僩栠偡.Click, mnupop005億僀儞僩栠偡.Click, mnupop010億僀儞僩栠偡.Click, mnupop020億僀儞僩栠偡.Click, mnupop050億僀儞僩栠偡.Click, mnupop100億僀儞僩栠偡.Click
        If mNew_ing Then Return
        Dim index As Integer = IIf(sender Is mnupop001億僀儞僩栠偡, 1, IIf(sender Is mnupop003億僀儞僩栠偡, 3, IIf(sender Is mnupop005億僀儞僩栠偡, 5, IIf(sender Is mnupop010億僀儞僩栠偡, 10, _
                               IIf(sender Is mnupop020億僀儞僩栠偡, 20, IIf(sender Is mnupop050億僀儞僩栠偡, 50, IIf(sender Is mnupop100億僀儞僩栠偡, 100, 0)))))))
        If index > 0 Then Call mnupop尦偵栠偡_Click_Ret_COM(index)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnupop尦偵栠偡_Click_Ret_COM(ByVal 栠偡僇僂儞僩 As Integer)
        Dim n As Integer = 栠偡僇僂儞僩 - 1
        Do While n > 0
            With lst.Items
                .RemoveAt(.Count - 1)
            End With
            n = n - 1
        Loop
        Call btn尦偵栠偡_Click(Nothing, Nothing)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn恾宍僋儕傾_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn恾宍僋儕傾.Click
        gggbol = zzClear(True, False)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn尦偵栠偡_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn尦偵栠偡.Click
        Dim n As Integer
        Dim pts(2) As POINTAPI
        n = lst.Items.Count - 1
        If n < 2 Then Return
        If zzListStrToPoint(lst.Items(n - 2), pts(0)) And zzListStrToPoint(lst.Items(n - 1), pts(1)) And zzListStrToPoint(lst.Items(n), pts(2)) Then
            lst.Items.RemoveAt(n)
            mOldX = pts(1).X : mOldY = pts(1).Y : mOldXXXX = pts(0).X : mOldYYYY = pts(0).Y
            gggbol = zzpct僌儔僼_Cls()
            Dim m As Integer = lst.Items.Count - 1
            ReDim pts(m)
            For n = 0 To m
                gggbol = zzListStrToPoint(lst.Items(n), pts(n))
            Next
            '---------------------------------------------
            gggbol = pct僌儔僼_Line_ReDrawAll_僒儞僾儖_Draw(pts)
            '---------------------------------------------
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn奼戝偲弅彫_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn奼戝偲弅彫.Click
        If mCurbai < 1 Then mCurbai = Math.Min(1.0#, mCurbai * 1.5) Else mCurbai = 0.1
        gggbol = zzpct僒儞僾儖_Cls()
        gggbol = zzMakeRgnAndDrawDo(pct僒儞僾儖, mCurbai, m僒儞僾儖WD, m僒儞僾儖HT, mCurPointMax)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "僐儞僩儘乕儖僀儀儞僩"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function pct僌儔僼_Line_ReDrawAll_僒儞僾儖_Draw(ByVal pts() As POINTAPI) As Boolean
        m儕僗僩僨乕僞乕偐傜偺儅僂僗僀儀儞僩幚峴拞 = False
        Dim g As Graphics
        g = Graphics.FromImage(pct僌儔僼.Image)
        If g IsNot Nothing Then
            gggbol = 嘳Image_Draw_Lines_POINTAPI(g, pts, Color.Black, 2)
            g.Dispose()
        End If
        '---------------------------------------------
        gggbol = zz僒儞僾儖昤夋幚峴()
        lst.Refresh() : pct僌儔僼.Refresh() : pct僒儞僾儖.Refresh()
        'Me.Refresh()
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function pct僌儔僼_Line(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer) As Boolean
        Dim g As Graphics
        g = Graphics.FromImage(pct僌儔僼.Image)
        If g IsNot Nothing Then
            Dim p As New Pen(Color.Black, 2)
            If p IsNot Nothing Then
                g.DrawLine(p, x1, y1, x2, y2)
                p.Dispose()
            End If
            g.Dispose()
        End If
        pct僌儔僼.Refresh()
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub pct僌儔僼_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pct僌儔僼.MouseDown
        Dim X As Integer = e.X : Dim Y As Integer = e.Y
        If X < 0 Or X > pct僌儔僼.ClientSize.Width Or Y < 0 Or Y > pct僌儔僼.ClientSize.Height Then Return
        mMsEvFirst = False
        mMsDragDrawing = False
        gggint = pct嘳儅僂僗僀儀儞僩専嵏2022(gcoMsDown, e.Button, X, Y, 2, 2, 2, 2)
        If lst.Items.Count = 0 Then
            mMsEvFirst = True
            mFirstX = X : mFirstY = Y
            mOldX = X : mOldY = Y
            gggbol = pct僌儔僼_Line(X - 1, Y - 1, X + 1, Y + 1)
        End If
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub pct僌儔僼_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pct僌儔僼.MouseMove
        Dim X As Integer = e.X : Dim Y As Integer = e.Y
        If X < 0 Or X > pct僌儔僼.ClientSize.Width Or Y < 0 Or Y > pct僌儔僼.ClientSize.Height Then Return
        Dim n, a As Integer
        Dim cccc As Color
        If e.Button = Windows.Forms.MouseButtons.None Then
            'no op
        Else
            If pct嘳儅僂僗僀儀儞僩専嵏2022(gcoMsMove, e.Button, X, Y, 2, 2, 2, 2) Then
                If mOldX >= 0 And mOldY >= 0 Then gggbol = pct僌儔僼_Line(mOldX, mOldY, X, Y)
                If (lst.Items.Count > 1) And ((mOldX = X And mOldXXXX = X) Or (mOldY = Y And mOldYYYY = Y)) Then
                    lst.Items.RemoveAt(lst.Items.Count - 1)
                End If
                lst.Items.Add(Format(X, cfmt000) & "," & Format(Y, cfmt000))
                mOldXXXX = mOldX : mOldYYYY = mOldY : mOldX = X : mOldY = Y : mMsDragDrawing = True
            Else

            End If
        End If
        '-------------------------------------------------------------------------
        cccc = Color.White
        For a = 0 To lst.Items.Count - 1
            n = Val(lst.Items(a))
            If System.Math.Abs(X - n) = 0 Then
                cccc = Color.Yellow : Exit For
            End If
        Next
        If lblXY0.BackColor <> cccc Then lblXY0.BackColor = cccc
        cccc = Color.White
        For a = 0 To lst.Items.Count - 1
            n = Val(Mid(lst.Items(a), 5))
            If Math.Abs(Y - n) = 0 Then
                cccc = Color.Yellow : Exit For
            End If
        Next
        If lblXY1.BackColor <> cccc Then lblXY1.BackColor = cccc
        '-------------------------------------------------------------------------
        lblXY0.Text = Format(X, cfmt000)
        lblXY1.Text = Format(Y, cfmt000)
        '-------------------------------------------------------------------------
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub pct僌儔僼_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pct僌儔僼.MouseUp
        Dim X As Integer = e.X : Dim Y As Integer = e.Y
        If X < 0 Or X > pct僌儔僼.ClientSize.Width Or Y < 0 Or Y > pct僌儔僼.ClientSize.Height Then Return
        '-----------------------------------------------------------------------------------------------------------------
        If mMsDragDrawing Or pct嘳儅僂僗僀儀儞僩専嵏2022(gcoMsUp, e.Button, X, Y, 2, 2, 2, 2) Then
            If mOldX >= 0 And mOldY >= 0 Then pct僌儔僼_Line(mOldX, mOldY, X, Y)
            If Not mMsDragDrawing Then lst.Items.Add(Format(X, cfmt000) & "," & Format(Y, cfmt000))
            mOldXXXX = mOldX : mOldYYYY = mOldY : mOldX = X : mOldY = Y
            btn恾宍僋儕傾.Enabled = (lst.Items.Count > 0)
            btn尦偵栠偡.Enabled = (lst.Items.Count > 2)
            btnpop000尦偵栠偡.Enabled = btn尦偵栠偡.Enabled
            '-----------------------------------------------------------------------------------------------------------------
            If lst.Items.Count > 1 Then
                If mOldX >= 0 And mOldY >= 0 Then gggbol = pct僌儔僼_Line(mOldX, mOldY, X, Y)
            End If
            '----------------------------------------------------------------------------
            If Not m儕僗僩僨乕僞乕偐傜偺儅僂僗僀儀儞僩幚峴拞 Then Call zz僒儞僾儖昤夋幚峴()
            '----------------------------------------------------------------------------
        End If
        mMsEvFirst = False : mMsDragDrawing = False
        '-------------------------------------------------------------------------
        btn恾宍僋儕傾.Enabled = (lst.Items.Count > 0)
        '-------------------------------------------------------------------------
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub pct僌儔僼_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pct僌儔僼.SizeChanged
        If mNew_ing Then Return
        If mLoading Then Return
        '-------------------------------------------------------------------------
        Dim xxx As Integer = pct僌儔僼.Right + m奜榞暆
        pct僒儞僾儖.SetBounds(xxx, pct僌儔僼.Top, pct僌儔僼.Width, pct僌儔僼.Height)
        '-------------------------------------------------------------------------
        If pct僒儞僾儖.Image IsNot Nothing Then
            pct僒儞僾儖.Image.Dispose()
        End If
        pct僒儞僾儖.Image = New Bitmap(pct僒儞僾儖.Width, pct僒儞僾儖.Height)
        '-------------------------------------------------------------------------
        m僒儞僾儖WD = pct僒儞僾儖.Width
        m僒儞僾儖HT = pct僒儞僾儖.Height
        '-------------------------------------------------------------------------
        btn奼戝偲弅彫.Left = Math.Max(lblXY1.Right + m奜榞暆, pct僒儞僾儖.Left)
        '-------------------------------------------------------------------------
        Dim xxxx As Integer = Me.Width - Me.ClientRectangle.Width
        Dim yyyy As Integer = Me.Height - Me.ClientRectangle.Height
        xxxx = Math.Max(m僼僅乕儉嵞彫暆, xxxx + pct僒儞僾儖.Right + m奜榞暆)
        yyyy = yyyy + pct僒儞僾儖.Bottom + m奜榞暆
        yyyy = Math.Max(mStartHight, yyyy)
        Me.SetBounds(Me.Left, Me.Top, xxxx, yyyy)
        lst.Height = Me.ClientSize.Height - lst.Top - m奜榞暆
        '-------------------------------------------------------------------------
        gggbol = zzPctNonePosSet()
        gggbol = zzpct僌儔僼_Cls()
        gggbol = zzpct僒儞僾儖_Cls()
        '-------------------------------------------------------------------------
        gggbol = zzClear(True, False)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Function pct嘳儅僂僗僀儀儞僩専嵏2022(ByRef gcoMsDown_gcoMsMove_gcoMsUp As Integer, ByRef MouseButtonsButton As Integer, ByRef X As Integer, ByRef Y As Integer, _
                                 ByRef MoveShiftX As Integer, ByRef MoveShiftY As Integer, ByRef UpShiftX As Integer, ByRef UpShiftY As Integer, Optional ByRef wIsMoveDownToUp As Boolean = False) As Boolean
        '-----------------------------------------------------------------------------------------------------------------------------
        '2022/10/04 懠偺僋儔僗偲嫟梡偟偰僄儔乕偵側傞偺偱丄偙偺僋儔僗愱梡偲偟偰丂屲bas堦斒.vb丂偐傜僐僺乕偟偨
        '-----------------------------------------------------------------------------------------------------------------------------
        '2021/03/19
        '-----------------------------------------------------------------------------------------------------------------------------
        'Boolean = pct嘳儅僂僗僀儀儞僩専嵏2022(gcoMsDown_gcoMsMove_gcoMsUp, Index, Button, X, Y, @MoveShiftX, @MoveShiftY, @UpShiftX, @UpShiftY, wIsMoveDownToUp)
        '-----------------------------------------------------------------------------------------------------------------------------
        '儅僂僗儉乕僽偺帪揰偱偼丄儅僂僗僪儔僢僌偑幚峴偝傟丄X 偐 Y 偑慜夞傛傝丂MoveShiftX / MoveShiftY丂埲忋摦偄偰偄傟偽丄True丂傪曉偡丅
        '-----------------------------------------------------------------------------------------------------------------------------
        '儅僂僗傾僢僾偺帪揰偱偼丄X 偲 Y 偑 儅僂僗僟僂儞帪傛傝丂UpShiftX / UpShiftY丂偺斖埻埲撪偵偁傞応崌偵偺傒丂True丂傪曉偡丅
        '-----------------------------------------------------------------------------------------------------------------------------
        'wIsMoveDownToUp丂儅僂僗僟僂儞帪偲斾妑偟偰丄X 偐 Y 偑丂UpShiftX / UpShiftY丂偺斖埻撪傪墇偊偰堏摦偡傟偽丂True丂傪曉偡丅
        '-----------------------------------------------------------------------------------------------------------------------------
        Dim 儕僞儞 As Boolean = False
        Static MsDown As Boolean : Static DnX As Integer : Static DnY As Integer : Static DnBtn As Integer : Static MvX As Integer : Static MvY As Integer
        wIsMoveDownToUp = False
        If (gcoMsDown = gcoMsDown_gcoMsMove_gcoMsUp) And (MsDown = False) Then
            MsDown = True : DnBtn = MouseButtonsButton : DnX = X : DnY = Y : MvX = X : MvY = Y
            儕僞儞 = (X >= 0 And Y >= 0)
        ElseIf (MsDown = True) And (DnBtn = MouseButtonsButton) Then
            If gcoMsMove = gcoMsDown_gcoMsMove_gcoMsUp Then
                儕僞儞 = (Math.Abs(MvX - X) >= MoveShiftX Or Math.Abs(MvY - Y) >= MoveShiftY)
                MvX = X : MvY = Y
                'If 儕僞儞 Then qqqqq("嘳儅僂僗僀儀儞僩専嵏2018 " + CStr(MvX))
            ElseIf gcoMsUp = gcoMsDown_gcoMsMove_gcoMsUp Then
                wIsMoveDownToUp = Not (Math.Abs(DnX - X) <= UpShiftX And Math.Abs(DnY - Y) <= UpShiftY)
                儕僞儞 = Not wIsMoveDownToUp
                GoTo DataClearExit
            Else
                GoTo DataClearExit
            End If
        Else
            GoTo DataClearExit
        End If
        Return 儕僞儞
        '----------------------------------------------------
DataClearExit:
        MsDown = False : DnBtn = -1 : DnX = -100000 : DnY = -100000 : MvX = -100000 : MvY = -100000
        Return 儕僞儞
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "儘乕僇儖僿儖僷乕娭悢"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzClear(ByRef pctSmpl僋儕傾幚峴 As Boolean, ByRef r儁僀儞僩儌乕僪 As Boolean) As Boolean
        Dim e As Boolean
        m儁僀儞僩儌乕僪 = r儁僀儞僩儌乕僪
        If pctSmpl僋儕傾幚峴 Then
            gggbol = zzpct僒儞僾儖_Cls()
            lst.Items.Clear() : mCurPointMax = 0 : mCurbai = 1.0#
        End If
        '----------------------------------------------------------
        gggbol = zzpct僌儔僼_Cls()
        btn恾宍僋儕傾.Enabled = False : btn尦偵栠偡.Enabled = False : btnpop000尦偵栠偡.Enabled = False
        mOldX = -1 : mOldY = -1 : mOldXXXX = -1 : mOldYYYY = -1 : mFirstX = -1 : mFirstY = -1
        mMsEvFirst = False : mMsDragDrawing = False
        '----------------------------------------------------------
        pctUser0.Visible = m儁僀儞僩儌乕僪
        '----------------------------------------------------------
        e = Not m儁僀儞僩儌乕僪 : pct僌儔僼.Visible = e : mnu恾宍偺懳徧儌乕僪.Enabled = e
        '----------------------------------------------------------
        e = (mCurPointMax > 2) : btn奼戝偲弅彫.Enabled = e
        '----------------------------------------------------------
        pctUser0.BringToFront()
        'qqqqq "zzClear()"
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzListStrToPoint(ByRef ListStr As String, ByRef pt As POINTAPI, Optional ByRef wx As Single = 0, Optional ByRef wy As Single = 0) As Boolean
        Dim p As Integer
        p = InStr(ListStr, ",")
        If p > 0 Then
            pt.X = Val(Microsoft.VisualBasic.Left(ListStr, p - 1))
            pt.Y = Val(LTrim(Mid(ListStr, p + 1)))
            wx = pt.X
            wy = pt.Y
            Return True
        End If
        Return False
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzMakeRgnAndDrawDo(ByRef pct As PictureBox, ByRef bai As Single, ByRef ScleWD As Single, ByRef ScleHT As Single, ByRef PointMax As Integer, _
                Optional ByVal DoOffSetRgn As Boolean = False, Optional ByRef wRgnWD As Integer = 0, Optional ByRef wRgnHT As Integer = 0, Optional ByRef 揾傝怓 As Integer = 255, Optional ByRef 僼儗乕儉捛壛 As Boolean = True, Optional ByRef 奜榞怓 As Integer = -1) As Boolean
        Dim a, rgn As Integer : Dim w, h As Single : Dim pt(cPointMax) As POINTAPI
        If mLoading Then Return False
        If pct Is pct僇乕僪怴婯曐懚 Then
            pct僇乕僪怴婯曐懚.Image.Dispose()
            pct僇乕僪怴婯曐懚.Image = mpct曐懚栠偡_BKUP.Clone
        ElseIf pct Is pct僇乕僪昗弨宆 Then
            gggbol = zzpct僇乕僪昗弨宆_Cls()
        End If
        If PointMax < 3 Then Return False
        w = pct.ClientRectangle.Width * bai : h = pct.ClientRectangle.Height * bai
        For a = 0 To PointMax
            pt(a).X = CInt((w * mPoint(a).X) / ScleWD) : pt(a).Y = CInt((h * mPoint(a).Y) / ScleHT)
        Next
        rgn = CreatePolygonRgn(pt, PointMax, WINDING)
        '---------------------------------------------------
        Dim rc As RECT : gggint = GetRgnBox(rgn, rc) : wRgnWD = 嘳Rect暆(rc) : wRgnHT = 嘳Rect崅(rc)
        If DoOffSetRgn Then gggint = OffsetRgn(rgn, -rc.lll, -rc.ttt)
        '---------------------------------------------------
        gggbol = zzMakeRgnAndDrawDoDo(pct.Image, rgn, w, h, 揾傝怓, 僼儗乕儉捛壛, 奜榞怓)        'Call zzMakeRgnAndDrawDoDo(pct, rgn, w, h, 揾傝怓, 僼儗乕儉捛壛, 奜榞怓)
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzMakeRgnAndDrawDoDo(ByRef img As Image, ByRef rgn As Integer, ByRef drawWD As Integer, ByRef drawHT As Integer, _
                            Optional ByRef 揾傝怓 As Integer = 255, Optional ByRef 僼儗乕儉捛壛 As Boolean = True, Optional ByRef 奜榞怓 As Integer = -1) As Boolean
        If mLoading Then Return False
        If rgn = 0 Then Return False
        Dim g As Graphics
        g = Graphics.FromImage(img)
        If g IsNot Nothing Then
            Dim hdc As Integer
            hdc = g.GetHdc
            If hdc <> 0 Then
                Dim Brs揾傝怓 As Integer = CreateSolidBrush(揾傝怓)
                If Brs揾傝怓 <> 0 Then
                    If Not 僼儗乕儉捛壛 Then
                        gggint = FillRgn(hdc, rgn, Brs揾傝怓)
                    Else
                        Dim ww As Integer = Math.Max(2, (drawWD + drawHT) * 0.02)
                        gggint = FillRgn(hdc, rgn, GetStockObject(WHITE_BRUSH))
                        gggint = FrameRgn(hdc, rgn, Brs揾傝怓, ww, ww)
                        gggint = FrameRgn(hdc, rgn, GetStockObject(BLACK_BRUSH), 1, 1)
                    End If
                    '奜榞怓偑巜掕偝傟偰偄傟偽丄摿暿側怓偱侾僺僋僙儖暆偺慄偱丄奜榞慄傪昤偔
                    If 奜榞怓 >= 0 Then
                        Dim brs奜榞怓 As Integer = CreateSolidBrush(奜榞怓)
                        If brs奜榞怓 <> 0 Then
                            gggint = FrameRgn(hdc, rgn, brs奜榞怓, 1, 1)
                            gggint = DeleteObject(brs奜榞怓)
                        End If
                    End If
                    'pct.Refresh()
                    gggint = DeleteObject(Brs揾傝怓)
                End If
                g.ReleaseHdc(hdc)
            End If
            g.Dispose()
        End If
        gggint = DeleteObject(rgn)
        rgn = 0
        'pct.Refresh()
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzmnu僇乕僪偲偟偰曐懚Enabled() As Boolean
        Dim bm As Bitmap, cccc As Color, dddd As Color
        bm = pct僒儞僾儖.Image
        cccc = mpct僒儞僾儖_Color_BackColor
        Dim n, m, ww, hh, X, Y, dig As Integer
        With pct僒儞僾儖
            ww = .ClientRectangle.Width : hh = .ClientRectangle.Height
        End With
        dig = 20 : n = 0 : m = 0
        For X = 2 To ww - 1 Step dig
            For Y = 2 To hh - 1 Step dig
                dddd = bm.GetPixel(X, Y)
                If False = cccc.Equals(dddd) Then
                    n = n + 1
                End If
            Next
        Next
        m = m僨僓僀儞儃僢僋僗撪偺桳岠側僇乕僪椞堟偺嵟掅尷奅 * (ww * hh) \ (dig * dig)
        'qqqqq("zzmnu僇乕僪偲偟偰曐懚Enabled()")
        Return (n > m)
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzMeCap_MeSize_BtnsTabStops_Set() As Boolean
        Dim e As Boolean
        e = (pnl僇乕僪曐懚偲夞暅.Visible = False)
        Me.Text = CStr("仠儐乕僓乕僇乕僪偺曇廤丂亅丂" + IIf(e, c僇乕僪僨僓僀儞嶌惉, c僇乕僪偺曐懚偲夞暅))
        Me.SetBounds(0, 0, mCur僼僅乕儉暆, mCur僼僅乕儉崅, BoundsSpecified.Size)
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzpct僌儔僼_Cls() As Boolean
        Dim RET As Boolean = 嘳Image慡堟StrechCopy(pct僌儔僼.Image, mpct僌儔僼_BKUP)
        pct僌儔僼.Refresh()
        Return RET
    End Function
    Private Function zzpct僒儞僾儖_Cls() As Boolean
        Dim RET As Boolean = 嘳ImageClear(pct僒儞僾儖.Image, pct僒儞僾儖.BackColor) '嘳Image慡堟StrechCopy(pct僒儞僾儖.Image, mpct僒儞僾儖_BKUP)
        pct僒儞僾儖.Refresh()
        Return RET
    End Function
    Private Function zzpct僇乕僪昗弨宆_Cls() As Boolean
        pct僇乕僪昗弨宆.Image.Dispose() : pct僇乕僪昗弨宆.Image = mpct曐懚栠偡_BKUP.Clone : Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzPctNonePosSet() As Boolean
        If mLoading Then Return False
        With pct僌儔僼
            Dim xxx As Integer = .Left : Dim yyy As Integer = .Top : Dim www As Integer = .Width \ 2 : Dim hhh As Integer = .Height \ 2
            Select Case mTaisho
                Case 0 '懳徧惈側偟
                Case 1 '嵍塃懳徧
                    pctNone0.SetBounds(xxx, yyy, www, .Height)
                Case 2 '忋壓懳徧
                    pctNone0.SetBounds(xxx, yyy + hhh, .Width, .Height - hhh)
                Case 3 '忋壓嵍塃巐晹暘懳徧
                    pctNone0.SetBounds(xxx, yyy, www, .Height)
                    pctNone1.SetBounds(xxx, yyy + hhh, .Width, .Height - hhh)
            End Select
        End With
        pctNone0.BringToFront()
        pctNone1.BringToFront()
        pctNone0.Visible = (mTaisho <> 0)
        pctNone1.Visible = (mTaisho = 3)
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz僒儞僾儖昤夋幚峴() As Boolean
        Dim e As Boolean
        Dim w, p, a, c, m, h As Integer
        If mLoading Then Return False

        gggbol = zzpct僒儞僾儖_Cls()
        m = lst.Items.Count
        mCurPointMax = m
        If m > 2 Then
            c = -1
            For a = 0 To m - 1
                If zzListStrToPoint(lst.Items(a), mPoint(c + 1)) Then c = c + 1
                If c = 3000 Then Exit For
            Next
            If m儁僀儞僩儌乕僪 Then
            Else
                Select Case mTaisho
                    Case 0 '懳徧惈側偟
                        c = c + 1 : mPoint(c).X = mPoint(0).X : mPoint(c).Y = mPoint(0).Y
                    Case 1 '嵍塃懳徧
                        w = m僒儞僾儖WD : p = m * 2 - 1
                        For a = 0 To m - 1
                            c = p - a : mPoint(c).X = w - mPoint(a).X : mPoint(c).Y = mPoint(a).Y
                        Next
                        c = p + 1 '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
                    Case 2 '忋壓懳徧
                        h = m僒儞僾儖HT : p = m * 2 - 1
                        For a = 0 To m - 1
                            c = p - a : mPoint(c).X = mPoint(a).X : mPoint(c).Y = h - mPoint(a).Y
                        Next
                        c = p + 1 '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
                    Case 3 '忋壓嵍塃巐晹暘懳徧
                        If mPoint(0).Y > mPoint(m - 1).Y Then
                            w = m僒儞僾儖WD : p = m * 2 - 1
                            For a = 0 To m - 1
                                c = p - a : mPoint(c).X = w - mPoint(a).X : mPoint(c).Y = mPoint(a).Y
                            Next
                            m = m * 2
                            h = m僒儞僾儖HT : p = m * 2 - 1
                            For a = 0 To m - 1
                                c = p - a : mPoint(c).X = mPoint(a).X : mPoint(c).Y = h - mPoint(a).Y
                            Next
                            c = p + 1 '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
                        Else
                            h = m僒儞僾儖HT : p = m * 2 - 1
                            For a = 0 To m - 1
                                c = p - a : mPoint(c).X = mPoint(a).X : mPoint(c).Y = h - mPoint(a).Y
                            Next
                            m = m * 2
                            w = m僒儞僾儖WD : p = m * 2 - 1
                            For a = 0 To m - 1
                                c = p - a : mPoint(c).X = w - mPoint(a).X : mPoint(c).Y = mPoint(a).Y
                            Next
                            c = p + 1 '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
                        End If
                End Select
                '2018/05/27 僄儔乕廋惓
                If mTaisho > 0 Then
                    If mPoint(c).X = 0 And mPoint(c).Y = 0 Then
                        c = c - 1 '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
                    End If
                End If
            End If
            mCurPointMax = c '屄悢偺悢偼丄攝楍偺僀儞僨僢僋僗亄侾偲側傞
            'qqqqq("zz僒儞僾儖昤夋幚峴  " + CStr(mCurPointMax))
        End If
        gggbol = zzMakeRgnAndDrawDo(pct僒儞僾儖, mCurbai, m僒儞僾儖WD, m僒儞僾儖HT, mCurPointMax)
        '----------------------------------------
        e = Not m儁僀儞僩儌乕僪
        m = lst.Items.Count
        btn恾宍僋儕傾.Enabled = e And (m > 0)
        btn尦偵栠偡.Enabled = e And (m > 3)
        btn奼戝偲弅彫.Enabled = (m > 3)
        btnpop000尦偵栠偡.Enabled = btn尦偵栠偡.Enabled
        '----------------------------------------
        For a = 0 To mnu0_6
            With mnupop尦偵栠偡ary(a) : .mnu.Visible = ((m - CInt(.val)) > 2) : End With
        Next
        '----------------------------------------
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "僇乕僪偺曐懚偲夞暅丂僂僀儞僪僂"
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu僇乕僪偺曐懚偲夞暅_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu僇乕僪偺曐懚偲夞暅.Click
        gggbol = zz僇乕僪偺曐懚偲夞暅ShowHide(1)
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz僇乕僪偺曐懚偲夞暅ShowHide(ByVal op As Integer) As Boolean
        Dim PnlShow As Boolean : Dim wRgnWD, wRgnHT As Integer
        Select Case op
            Case 1 'menu  pnl僇乕僪曐懚偲夞暅 show
                If pnl僇乕僪曐懚偲夞暅.Visible Then Return False
                With pnl僇乕僪曐懚偲夞暅
                    .SetBounds(0, MenuStrip1.Height, Me.ClientSize.Width, Me.ClientSize.Height - MenuStrip1.Height)
                End With
                With pct僇乕僪怴婯曐懚
                    .SetBounds(.Left, .Top, (200 * m婎弨斾棪墶), (200 * m婎弨斾棪廲))
                End With
                If mCurPointMax > 0 Then
                    gggbol = zzMakeRgnAndDrawDo(pct僇乕僪怴婯曐懚, 0.8, m僒儞僾儖WD, m僒儞僾儖HT, mCurPointMax, True, wRgnWD, wRgnHT)
                    With pct僇乕僪怴婯曐懚
                        .SetBounds(.Left, .Top, wRgnWD, wRgnHT)
                    End With
                End If
                '-------------------------------------------------------------------------------------------------------------------------
                gggbol = zzpnl僇乕僪昗弨偵栠偡儕僙僢僩()
                '-------------------------------------------------------------------------------------------------------------------------
                pnl僇乕僪曐懚偲夞暅.BringToFront()
                PnlShow = True
                '-------------------------------------------------------------------------------------------------------------------------
                mCur僼僅乕儉暆 = Me.Width : mCur僼僅乕儉崅 = Me.Height
                '-------------------------------------------------------------------------------------------------------------------------
            Case 3 'btn  僉儍儞僙儖
                PnlShow = False
        End Select
        pnl僇乕僪曐懚偲夞暅.Visible = PnlShow
        mnu僨僓僀儞偵栠傞.Visible = PnlShow
        gggbol = zzMeCap_MeSize_BtnsTabStops_Set()
        gggbol = zzMenuAllVisibleSet(Not PnlShow)
        '-------------------------------------------------------------------------------------------------------------------------
        If PnlShow Then
            Me.Width = mShow1僼僅乕儉暆 : Me.Height = mShow1僼僅乕儉崅
        Else
            Me.Width = mCur僼僅乕儉暆 : Me.Height = mCur僼僅乕儉崅
        End If
        '-------------------------------------------------------------------------------------------------------------------------
        Return True
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzpnl僇乕僪昗弨偵栠偡儕僙僢僩() As Boolean
        lstdef昗弨偵栠偡00.Visible = False
        gggint = gm傾僾儕屌桳僋儔僗.aaDlgCardRgnMakeIO(10021, , lstdef昗弨偵栠偡00)
        If lstdef昗弨偵栠偡00.Items.Count > 0 Then lstdef昗弨偵栠偡00.SelectedIndex = 0 Else lstdef昗弨偵栠偡00.SelectedIndex = -1
        '-------------------------------------------------------------------------------------------------------------------------
        gggbol = m岥岥僇乕僪曐懚偲夞暅.僙儖偺慖戰newold忬懺SET_AllOFF_OnlyOneSelectIF(-1)
        gggbol = m岥岥僇乕僪曐懚偲夞暅.aaCardDrawAll(True)  '(ByVal rNew慖戰巊梡 As Boolean) 
        gggbol = zzpct僇乕僪昗弨宆_Cls()
        pct僇乕僪昗弨宆.Tag = ""
        m岥岥僇乕僪曐懚偲夞暅Curindex = -1
        gggbol = zz僇乕僪偺曐懚偲夞暅EnabledSet()
        '-------------------------------------------------------------------------------------------------------------------------
        For a As Integer = 0 To lstdef昗弨偵栠偡00.Items.Count - 1
            qqqqq("lstdef昗弨偵栠偡00.Items(" & CStr(a) & ") = " & lstdef昗弨偵栠偡00.Items(a))
        Next
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz僇乕僪宆偼儐乕僓乕嶌惉宆(ByVal r僇乕僪宆IDX As Integer) As Boolean
        Dim a As Integer, sss As String
        For a = 0 To lstdef昗弨偵栠偡00.Items.Count - 1
            sss = lstdef昗弨偵栠偡00.Items(a)
            If r僇乕僪宆IDX = Val(sss) Then Return True
        Next
        Return False
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zz僇乕僪偺曐懚偲夞暅EnabledSet() As Boolean
        Dim e1 As Boolean = (mCurPointMax > 0)
        Dim e2 As Boolean = (m岥岥僇乕僪曐懚偲夞暅Curindex >= 0)
        pct僇乕僪怴婯曐懚.Visible = e1
        btn僇乕僪怴婯曐懚.Visible = e1 And e2
        Dim e3 As Boolean = e2 And (pct僇乕僪昗弨宆.Tag <> "")
        pct僇乕僪昗弨宆.Visible = e3
        btn僇乕僪昗弨宆偵栠偡.Visible = e3
        lblMsg僇乕僪宆嶌惉.Visible = Not e1
        lblMsg僇乕僪宆夞暅.Visible = Not e3
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn僇乕僪怴婯曐懚_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn僇乕僪怴婯曐懚.Click
        '怴偟偄恾宍傪尰嵼偺pct僇乕僪宆儕僗僩偺僇乕僪偲嵎偟懼偊
        Dim 曄峏僇乕僪IDX As Integer
        曄峏僇乕僪IDX = m岥岥僇乕僪曐懚偲夞暅Curindex
        If 2 = MsgBox("怴偟偄僨僓僀儞偺僇乕僪宆傪丄" & gggCR2 & "塃懁偺儕僗僩偱慖戰偝傟偰偄傞僇乕僪宆偵忋彂偒偟傑偡丅丂" & gggCR2 & "傛傠偟偄偱偡偐丠" & vbCrLf & "", 33, "儐乕僓乕僇乕僪偺宆傪曄峏") Then Return
        '-------------------------------------------------------------------------------------------------------------------------
        If False = gm傾僾儕屌桳僋儔僗.aaDlgCardRgnMakeIOEX(曄峏僇乕僪IDX, "", True, m婎弨斾棪, m婎弨斾棪墶, m婎弨斾棪廲, mCurPointMax, mPoint, m僒儞僾儖WD, m僒儞僾儖HT) Then Return
        '-------------------------------------------------------------------------------------------------------------------------
        gggint = gm傾僾儕屌桳僋儔僗.aaDlgCardRgnMakeIO(2009, , , 曄峏僇乕僪IDX) '2022/10/08 昁偢昁梫偱偡
        mChange = True
        '-------------------------------------------------------------------------------------------------------------------------
        gggint = gm傾僾儕屌桳僋儔僗.aaDlgCardRgnMakeIO(30001, "", Nothing, 曄峏僇乕僪IDX) '30001 偺応崌偼丄曄峏僇乕僪IDX = 僟僀傾儘僌撪偺儕僗僩僀儞僨僢僋僗傪巊梡偟偰偄傞丅cUser0宍 傪屇傃弌偟愭偱捛壛偡傞
        '-------------------------------------------------------------------------------------------------------------------------
        gggbol = zzpnl僇乕僪昗弨偵栠偡儕僙僢僩()
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub btn僇乕僪昗弨宆偵栠偡_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn僇乕僪昗弨宆偵栠偡.Click
        'btn  慖戰偟偨儐乕僓乕僇乕僪偺宍傪昗弨偵栠偡
        If pct僇乕僪昗弨宆.Tag = "" Then Return
        If 2 = MsgBox("尰嵼慖戰偝傟偰偄傞儐乕僓乕僇乕僪偺宍傪丄" & gggCR2 & "昗弨偺僇乕僪偺宍偵栠偟傑偡丅" & gggCR2 & "尰嵼偺儐乕僓乕僇乕僪偺僨乕僞乕偼徚幐偟偰暅尦偱偒傑偣傫丅" & gggCR2 & "傛傠偟偄偱偡偐丠", 49, "慖戰偟偨儐乕僓乕僇乕僪偺宍傪昗弨偵栠偡") Then Return
        '-------------------------------------------------------------------------------------------------------------------------
        gggint = gm傾僾儕屌桳僋儔僗.aaDlgCardRgnMakeIO(10023, "", Nothing, Val(pct僇乕僪昗弨宆.Tag))
        '-------------------------------------------------------------------------------------------------------------------------
        gggbol = zzpnl僇乕僪昗弨偵栠偡儕僙僢僩()
        gggbol = 僀儀儞僩gAppEventMaker.MakeEvent儐乕僓乕僇乕僪宆偺僨僓僀儞偑曄峏偝傟傑偟偨()
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Sub mnu僨僓僀儞偵栠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu僨僓僀儞偵栠傞.Click
        If pnl僇乕僪曐懚偲夞暅.Visible Then
            gggbol = zz僇乕僪偺曐懚偲夞暅ShowHide(3)
        End If
        mnu僨僓僀儞偵栠傞.Visible = False
    End Sub
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
    Private Function zzMenuAllVisibleSet(ByVal vs As Boolean) As Boolean
        mnu廲墶偺斾棪.Visible = vs
        mnu恾宍偺懳徧儌乕僪.Visible = vs
        mnu恾宍夋憸.Visible = vs
        mnu僇乕僪偺曐懚偲夞暅.Visible = vs
    End Function
    '仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠仠
#End Region

#Region "僀儀儞僩 from m岥岥僇乕僪曐懚偲夞暅"

    Private Sub m岥岥僇乕僪曐懚偲夞暅_僇乕僪僨乕僞乕傪偔偩偝偄(ByRef wIsOK As Boolean, ByVal r僇乕僪宆IDX As Integer, ByVal r僙儖暆 As Integer, ByVal r僙儖崅 As Integer, ByRef w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer, ByRef w僇乕僪傪巊梡偟偰偄傞 As Boolean) Handles m岥岥僇乕僪曐懚偲夞暅.僇乕僪僨乕僞乕傪偔偩偝偄
        Dim w夋暆, w夋崅 As Integer, wRgn榞 As Integer = 0
        gggbol = gm傾僾儕屌桳僋儔僗.aa僇乕僪宆儕乕僕儑儞傪嶌傞_UserCardMake(False, r僇乕僪宆IDX, r僙儖暆, 2, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, wRgn榞, w夋暆, w夋崅)
        If w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 = 0 Then Return
        wIsOK = True
    End Sub

    Private Sub m岥岥僇乕僪曐懚偲夞暅_慖戰僀儞僨僢僋僗偑曄傢傝傑偟偨(ByVal rIndex As Integer) Handles m岥岥僇乕僪曐懚偲夞暅.慖戰僀儞僨僢僋僗偑曄傢傝傑偟偨
        m岥岥僇乕僪曐懚偲夞暅Curindex = rIndex
        If m岥岥僇乕僪曐懚偲夞暅Curindex >= 0 Then
            gggbol = m岥岥僇乕僪曐懚偲夞暅.僙儖偺慖戰newold忬懺SET_AllOFF_OnlyOneSelectIF(m岥岥僇乕僪曐懚偲夞暅Curindex)
        Else
            gggbol = m岥岥僇乕僪曐懚偲夞暅.僙儖偺慖戰newold忬懺SET_AllOFF_OnlyOneSelectIF(-1)
        End If
        gggbol = m岥岥僇乕僪曐懚偲夞暅.aaCardDrawAll(True) '    gggbol = zzCardDrawAll(True)
        gggbol = zzpct僇乕僪宆儕僗僩_Click_昗弨偵栠偡op()
    End Sub
    Private Function zzpct僇乕僪宆儕僗僩_Click_昗弨偵栠偡op() As Boolean
        Dim CurCard宆 As Integer = 0
        If m岥岥僇乕僪曐懚偲夞暅Curindex >= 0 Then
            If zz僇乕僪宆偼儐乕僓乕嶌惉宆(m岥岥僇乕僪曐懚偲夞暅Curindex) Then
                'm岥岥僇乕僪曐懚偲夞暅Curindex = a
                'pct僇乕僪昗弨宆丂丂偵丂儐乕僓乕婯掕宆偺僀儊乕僕傪昤夋偡傞
                Dim WD, HT As Integer
                Dim w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 As Integer = 0
                With gm傾僾儕屌桳僋儔僗
                    CurCard宆 = .ppc僇乕僪宆USERmin + m岥岥僇乕僪曐懚偲夞暅Curindex
                    Dim pct僇乕僪昗弨宆defWD As Integer = 200
                    Dim rgntmp夋1 As Integer = 0, rgntmp榞1 As Integer = 0, tmpwd As Integer = 0, tmpht As Integer = 0
                    Dim wRgn榞 As Integer = 0
                    '儐乕僓乕婯掕宆  昗弨宆偺儕乕僕儑儞傪嶌傞 
                    gggint = .aaDlgCardRgnMakeIO(10022, "", , CurCard宆, pct僇乕僪昗弨宆defWD, 2, rgntmp夋1, rgntmp榞1, tmpwd, tmpht, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, wRgn榞, WD, HT)
                    If rgntmp夋1 <> 0 Then DeleteObject(rgntmp夋1)
                    If rgntmp榞1 <> 0 Then DeleteObject(rgntmp榞1)
                    If wRgn榞 <> 0 Then DeleteObject(wRgn榞)
                End With
                Dim rc As RECT
                gggint = GetRgnBox(w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, rc)
                gggint = OffsetRgn(w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, -rc.lll, -rc.ttt)
                WD = 嘳Rect暆(rc)
                HT = 嘳Rect崅(rc)
                With pct僇乕僪昗弨宆
                    .SetBounds(.Left, .Top, WD, HT)
                    gggbol = zzpct僇乕僪昗弨宆_Cls()
                    gggbol = zzMakeRgnAndDrawDoDo(pct僇乕僪昗弨宆.Image, w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞, WD, HT)  '偙偺屇傃弌偟偱丂(w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞)丂偼嶍彍偝傟傞丅
                    .Visible = True
                    .Tag = CStr(CurCard宆)
                End With
                If w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 <> 0 Then DeleteObject(w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞)
                w僇乕僪RGN_屇傃弌偟尦偱嶍彍偡傞 = 0
                '-------------------------------------------------------------
            Else
                pct僇乕僪昗弨宆.Tag = ""
                gggbol = zzpct僇乕僪昗弨宆_Cls()
            End If
        Else
            pct僇乕僪昗弨宆.Tag = ""
            gggbol = zzpct僇乕僪昗弨宆_Cls()
        End If
        '-------------------------------------------------------------
        gggbol = zz僇乕僪偺曐懚偲夞暅EnabledSet()
    End Function

#End Region

#Region "僀儀儞僩 from gAppEventMaker梡"

    Private Sub 僀儀儞僩gAppEventMaker_僇乕僪僔儑乕奐巒偲掆巭(ByVal r奐巒true掆巭false As Boolean) Handles 僀儀儞僩gAppEventMaker.僇乕僪僔儑乕奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        If r奐巒true掆巭false Then Call mnu暵偠傞偙偺僂僀儞僪僂傪暵偠傞_Click(Nothing, Nothing)
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僗僀僗僀偲儐儔儐儔奐巒偲掆巭() Handles 僀儀儞僩gAppEventMaker.僗僀僗僀偲儐儔儐儔奐巒偲掆巭
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        Call mnu暵偠傞偙偺僂僀儞僪僂傪暵偠傞_Click(Nothing, Nothing)
    End Sub

    Private Sub 僀儀儞僩gAppEventMaker_僼僅乕儉偺昞帵偲徚嫀(ByVal r僼僅乕儉柤ID As Integer, ByVal r昞帵True徚嫀False As Boolean) Handles 僀儀儞僩gAppEventMaker.僼僅乕儉偺昞帵偲徚嫀
        If gm傾僾儕廔椆偡傞 Then Return
        If Me.Visible = False Then Return
        If GMCOM_Dlgs懠偺僂僀儞僪僂偺昞帵_旕昞帵僀儀儞僩偱_rMe_僂僀儞僪僂傪徚嫀偟側偝偄(mMe_gmDlgID, r僼僅乕儉柤ID, r昞帵True徚嫀False) Then
            Call mnu暵偠傞偙偺僂僀儞僪僂傪暵偠傞_Click(Nothing, Nothing)
        End If
    End Sub
#End Region

End Class


