Option Strict Off
Option Explicit On
'------------------------------------ 2024/03/26 ------------------------------------
Public Class frmDlgBtnsPosSet
    Event aaeDlgWnd_ShowTrue_HideFalse(ByRef ShowTrue_HideFalse As Boolean)
    Event aae僀儀儞僩_FormClosed_偺嵟屻偵屇傃弌偟偰偄傑偡()
    Private mUserPtr As clsPatapata = Nothing

    Friend Function Dlg_LoadShow1(ByVal rOwner As Form, ByVal rPct As PictureBox, ByVal rPtrUser As clsPatapata, ByVal rBackColorMain As Color, ByVal X As Integer, ByVal Y As Integer, ByVal WD As Integer, ByVal HT As Integer) As Boolean
        Try
            mUserPtr = rPtrUser
            With rPct.Image
                PCT.SetBounds(0, 0, .Width, .Height, BoundsSpecified.Size)
                PCT.Image = .Clone
            End With
            With pctDrag
                .Image = New Bitmap(400, 100)
                .Parent = PCT : .Visible = False : .Enabled = False
            End With
            Dim addx As Integer = Me.Width - Me.ClientRectangle.Width
            Dim addy As Integer = Me.Height - Me.ClientRectangle.Height
            Dim xy As Integer = PCT.Left
            Dim w As Integer = addx + xy + PCT.Width + xy
            Dim h As Integer = addy + PCT.Top + PCT.Height + xy
            Me.SetBounds(0, 0, w, h, BoundsSpecified.Size)
            '---------------------------------------------
            Dim xxx As Integer = lbl堏摦愭.Left - lbl堏摦懳徾.Right
            w = (PCT.Right - lbl堏摦懳徾.Left - xxx) \ 2
            xy = lbl堏摦愭HED.Left - lbl堏摦懳徾.Right
            lbl堏摦懳徾.Width = w
            lbl堏摦愭HED.Left = lbl堏摦懳徾.Right + xy
            lbl堏摦愭.Left = lbl堏摦懳徾.Right + xxx
            lbl堏摦愭.Width = PCT.Right - lbl堏摦愭.Left
            '---------------------------------------------
            With lbl僇僶乕
                .Parent = PCT
                .BackColor = rBackColorMain
                .SetBounds(X, Y, WD, HT, BoundsSpecified.All)
            End With
            '---------------------------------------------
            btnOK.Enabled = False
            Me.Text = "儃僞儞偺埵抲傪曄峏"
            Me.Icon = rOwner.Icon
            Me.ShowDialog(rOwner)
            '---------------------------------------------
            RaiseEvent aaeDlgWnd_ShowTrue_HideFalse(True)
        Catch ex As Exception
            MsgBox("ERROR in frmDlgBtnsPosSet.Dlg_LoadShow1()" & vbCrLf & ex.ToString)
        End Try
    End Function

    Private Sub frmDlgStdBtnAllSet_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        RaiseEvent aaeDlgWnd_ShowTrue_HideFalse(False)
    End Sub
    Private Sub frmDlgStdBtnAllSet_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        RaiseEvent aae僀儀儞僩_FormClosed_偺嵟屻偵屇傃弌偟偰偄傑偡()
    End Sub
    Private Sub frmDlgStdBtnAllSet_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        'qqqqq("frmDlgStdBtnAllSet_Disposed")
    End Sub
    Private Sub btnCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCAN.Click
        Me.Close()
    End Sub
    Private Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click
        If mUserPtr Is Nothing Then Return
        If 2 = MsgBox("儃僞儞偺埵抲傪曄峏偟傑偡丅" & vbCrLf & vbCrLf & _
                "曄峏偟偨忬懺傪尦偵栠偡偵偼丄暋嶨側嶌嬈偑昁梫偵側傞応崌傕偁傝傑偡丅" & vbCrLf & vbCrLf & _
                "僿儖僾僼傽僀儖偺  [ 儃僞儞偺埵抲傪曄峏 ]  傪嶲徠偟偰偔偩偝偄丅" & vbCrLf & vbCrLf & _
                "儃僞儞偺埵抲傪曄峏偟傑偡偐丠", 305, "儃僞儞偺埵抲傪曄峏偟傑偡") Then
            'Ret = 1 '< 椆夝 >   'Ret = 2 '< 庢徚 >
            Return
        End If
        Call mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(300, 0, 0, 0, Nothing, "")
        Me.Close()
    End Sub

#Region "僪儔僢僌僪儘僢僾丂偲丂僐僺乕堏摦"
    Dim mDown As Boolean = False, mDownX As Integer = -1, mDownY As Integer = -1, mBtnGrupIndex As Integer = 0, mCurBtnIDX As Integer = 0, mOfstX, mOfstY As Integer
    Dim mDownrcag As Rectangle

    Private Sub PCT_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PCT.MouseDown
        If mUserPtr Is Nothing Then Return
        Dim wIsMoveDownToUp As Boolean
        '2024/03/24 僄儔乕偺掶惓**************************************************
        gggbol = zzMousEventsFlagsClear()
        '2024/03/24 僄儔乕偺掶惓**************************************************
        gggbol = 嘳儅僂僗僀儀儞僩専嵏2022(gcoMsDown, e.Button, e.X, e.Y, 3, 3, 3, 3, wIsMoveDownToUp)
        Dim cxxx As Integer = e.X : Dim cyyy As Integer = e.Y
        Dim wText As String = ""
        Dim n As Integer = mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(10, cxxx, cyyy, mBtnGrupIndex, mDownrcag, wText)
        With pctDrag
            If n > 0 Then
                Dim rg As Rectangle = mDownrcag
                .SetBounds(mDownrcag.Left, rg.Top, rg.Width, rg.Height, BoundsSpecified.All)
                gggbol = 嘳Image_Image_Copy(pctDrag.Image, PCT.Image, 0, 0, rg.Width, rg.Height, rg.Left, rg.Top, rg.Width, rg.Height)
                pctDrag.Refresh()
                lbl堏摦懳徾.Text = wText
                .Visible = True
                mCurBtnIDX = n : mDown = True : mDownX = cxxx : mDownY = cyyy : mOfstX = cxxx - pctDrag.Left : mOfstY = cyyy - pctDrag.Top
            Else
                .Visible = False
                lbl堏摦懳徾.Text = ""
            End If
        End With
    End Sub
    Private Sub PCT_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PCT.MouseMove
        If mUserPtr Is Nothing Then Return
        Dim wIsMoveDownToUp As Boolean
        gggbol = 嘳儅僂僗僀儀儞僩専嵏2022(gcoMsMove, e.Button, e.X, e.Y, 3, 3, 3, 3, wIsMoveDownToUp)
        Dim rg As Rectangle, wText As String = ""
        If pctDrag.Visible Then
            Dim n As Integer = mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(11, e.X, e.Y, mBtnGrupIndex, rg, wText)
            If n > 0 Then
                lbl堏摦愭.Text = wText
            Else
                lbl堏摦愭.Text = ""
            End If
            If mDown And mCurBtnIDX > 0 And mDownX > 0 And mDownY > 0 Then
                pctDrag.SetBounds(e.X - mOfstX, e.Y - mOfstY, 0, 0, BoundsSpecified.Location)
            End If
        End If
    End Sub
    Private Sub PCT_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PCT.MouseUp
        If mUserPtr Is Nothing Then Return
        Dim wIsMoveDownToUp As Boolean
        gggbol = 嘳儅僂僗僀儀儞僩専嵏2022(gcoMsUp, e.Button, e.X, e.Y, 3, 3, 3, 3, wIsMoveDownToUp)
        If pctDrag.Visible = False Then
            'no op
        Else
            Dim rg As Rectangle, wText As String = ""
            Dim n As Integer = mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(12, e.X, e.Y, mBtnGrupIndex, rg, wText)
            If mBtnGrupIndex > 0 Then
                If n <> mCurBtnIDX Then
                    gggbol = 嘳Image_Image_Copy(PCT.Image, PCT.Image, mDownrcag.Left, mDownrcag.Top, mDownrcag.Width, mDownrcag.Height, rg.Left, rg.Top, rg.Width, rg.Height)
                    gggbol = 嘳Image_Image_Copy(PCT.Image, pctDrag.Image, rg.Left, rg.Top, rg.Width, rg.Height, 0, 0, rg.Width, rg.Height)
                    gggint = mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(100, mCurBtnIDX, n, mBtnGrupIndex, rg, wText)
                    btnOK.Enabled = (1 = mUserPtr.aaf儃僞儞僨乕僞乕偺愝掕曄峏(200, 0, 0, 0, rg, wText))
                Else
                    'no op
                End If
            Else
                Beep()
            End If
        End If
        Call zzMousEventsFlagsClear()
    End Sub

    '仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭
    Function zzMousEventsFlagsClear() As Boolean
        '2024/03/24 僄儔乕偺掶惓**************************************************
        mDown = False : mDownX = -1 : mDownY = -1 : mCurBtnIDX = 0 : mOfstX = 0 : mOfstY = 0
        pctDrag.Visible = False : lbl堏摦懳徾.Text = "" : lbl堏摦愭.Text = ""
        '2024/03/24 僄儔乕偺掶惓**************************************************
        Return True
    End Function

#End Region

End Class