Option Strict Off
Option Explicit On
'------------------------------------ 2024/04/10 ------------------------------------
Public Class frmDlgBtnsColorEX

#Region "宣言"
    Event 色のデーターをください(ByRef wIsグループカラー As Boolean, ByVal rContName As String, ByVal rIndex As Integer, ByRef wBackColorUP As Integer, ByRef wForeColorUP As Integer, ByRef wBackColorDN As Integer, ByRef wForeColorDN As Integer)
    Event 色を設定してください(ByVal rContName As String, ByVal rIndex As Integer, ByVal rBackColorUP As Integer, ByVal rForeColorUP As Integer, ByVal rBackColorDN As Integer, ByVal rForeColorDN As Integer)
    Event 色を標準に戻してください(ByVal rContName As String, ByVal rIndex As Integer)
    Private mNew実行中 As Boolean = True
    Private mLoading As Boolean
    Private mContName As String = ""
    Private mIndex As Integer = 0
    '**************************************************************************
    '宣言
    Private WithEvents o色見本 As 五clsColorSetUa = Nothing
    Private flg_o色見本Loading As Boolean = True
#End Region

#Region "Form イベント"
    Friend Function aaダイアログ_色を設定_Show1(ByVal rEnabled標準に戻す As Boolean, ByVal rContName As String, ByVal rIndex As Integer, ByVal rOwner As Form, Optional ByVal rDlgText As String = "", Optional ByVal rShowPosX As Integer = 0, Optional ByVal rShowPosY As Integer = 0) As Boolean
        mNew実行中 = False
        mLoading = True
        Try
            '********************************************
            o色見本 = New 五clsColorSetUa(flg_o色見本Loading, Me, lblColorBoxTMP)
            '********************************************
            mContName = rContName : mIndex = rIndex
            '********************************************
            mLoading = False
            Call zzReadInCurContColor()
            '********************************************
            radUP.Checked = True       '2023/10/19  順番が大事
            rbt背景の色.Checked = True  '2023/10/19  順番が大事
            '********************************************
            If rContName = "" Then 'rOwner BackColor Set
                lblSmpUP.BackColor = rOwner.BackColor
                radUP.Checked = True
                radUP.Visible = False
                radDN.Visible = False
                btn下へコピー.Visible = False
                btn標準に戻す.Visible = False
                lblSmpDN.Visible = False
            End If
            btn標準に戻す.Visible = rEnabled標準に戻す
            'qqqqq(rContName)
            Dim x, y As Integer
            If rShowPosX = 0 And rShowPosY = 0 Then
                Dim pt As Point = System.Windows.Forms.Cursor.Position : x = pt.X : y = pt.Y
            ElseIf rShowPosX = -1 And rShowPosY = -1 Then
                Me.StartPosition = FormStartPosition.CenterParent
            Else
                x = rShowPosX : y = rShowPosY
            End If
            Me.SetBounds(x, y, 0, 0, BoundsSpecified.Location)
            Me.Text = IIf(rDlgText <> "", rDlgText, "色の設定")
            Me.Icon = rOwner.Icon
            gggint = ⅩFormMove(gcoフォームをスクリーン内に移動, Me)
            Me.ShowDialog(rOwner)
            '********************************************
        Catch ex As Exception
            Call ⅩMsgBox_OK_情報("aaダイアログ_色を設定_Show1()" & gggCR2 & ex.ToString)
        End Try
        mLoading = False
        Return True
UnLoadPos:
        Me.Close()
        Return False
    End Function
    Private Sub frmDlgColorFontSet_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        o色見本.Dispose()
        o色見本 = Nothing
    End Sub
    Private Sub frmDlgColorFontSet_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        qqqqq("frmDlgColorFontSet_Disposed")
    End Sub
#End Region

#Region "Controls イベント"
    Private Sub zzReadInCurContColor()
        Dim wIsグループカラー As Boolean
        Dim wBackColorUP As Integer, wForeColorUP As Integer, wBackColorDN As Integer, wForeColorDN As Integer
        RaiseEvent 色のデーターをください(wIsグループカラー, mContName, mIndex, wBackColorUP, wForeColorUP, wBackColorDN, wForeColorDN)
        '********************************************
        lblSmpUP.BackColor = ⅩColor構造体_from_色値(wBackColorUP) : lblSmpUP.ForeColor = ⅩColor構造体_from_色値(wForeColorUP)
        lblSmpDN.BackColor = ⅩColor構造体_from_色値(wBackColorDN) : lblSmpDN.ForeColor = ⅩColor構造体_from_色値(wForeColorDN)
        '********************************************
        btn標準に戻す.Enabled = Not wIsグループカラー
    End Sub
    Private Sub btn閉じる_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn閉じる.Click
        Me.Close()
    End Sub
    Private Sub lblSmpUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSmpUP.Click
        radUP.Checked = True
    End Sub
    Private Sub lblSmpDN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSmpDN.Click
        radDN.Checked = True
    End Sub
    Private Sub radDN_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radDN.CheckedChanged
        Call radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
    End Sub
    Private Sub radUP_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radUP.CheckedChanged
        Call radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
    End Sub
    Private Sub rbt背景の色_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbt背景の色.CheckedChanged
        Call radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
    End Sub
    Private Sub rbt文字の色_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbt文字の色.CheckedChanged
        Call radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
    End Sub
    Private Sub radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
        If mLoading Or mNew実行中 Then Return
        Dim lbl As Label = IIf(radDN.Checked, lblSmpDN, lblSmpUP)
        If rbt文字の色.Checked Then
            o色見本.CboxCurMainColor = ⅩColor構造体_to_色値(lbl.ForeColor)
        Else
            o色見本.CboxCurMainColor = ⅩColor構造体_to_色値(lbl.BackColor)
        End If
    End Sub
    Private Sub btn下へコピー_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn下へコピー.Click
        gggbol = ⅩObjColorFontCopy(lblSmpUP, lblSmpDN)
    End Sub
    Private Sub btn標準に戻す_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn標準に戻す.Click
        RaiseEvent 色を標準に戻してください(mContName, mIndex)
        Call zzReadInCurContColor()
        Call radDN_radUP_rbt文字の色_rbt背景の色_CheckedChanged_COM()
    End Sub
    Private Sub btnUpDNに設定_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpDNに設定.Click
        Dim BKUP As Integer = ⅩColor構造体_to_色値(lblSmpUP.BackColor)
        Dim FRUP As Integer = ⅩColor構造体_to_色値(lblSmpUP.ForeColor)
        Dim BKDN As Integer = ⅩColor構造体_to_色値(lblSmpDN.BackColor)
        Dim FRDN As Integer = ⅩColor構造体_to_色値(lblSmpDN.ForeColor)
        RaiseEvent 色を設定してください(mContName, mIndex, BKUP, FRUP, BKDN, FRDN)
        Call zzReadInCurContColor()
    End Sub
    Private Sub o色見本_OnCboxColorChanged(ByVal rCurMainColor As Integer, ByVal rCurColor As Integer, ByVal rChangeMode As 五clsColorSetUa.EnmColorChangeMode, ByVal rEventMouseUp As Boolean) Handles o色見本.OnCboxColorChanged
        If mLoading Then Exit Sub
        If flg_o色見本Loading Then Exit Sub
        If rCurColor >= 0 Then
            gggbol = o色見本.CboxCurColorSetIntoControlBackOrFore(IIf(radUP.Checked, lblSmpUP, lblSmpDN), (Not rbt文字の色.Checked), True)
        End If
        'Debug.Print("o色見本_OnCboxColorChanged  " + CStr(rChangeMode) + "   " + CStr(rEventMouseUp))
    End Sub
#End Region

End Class