Option Strict Off
Option Explicit On
'------------------------------------ 2024/03/23 ------------------------------------
Public Class frmDlgListFont
#Region "愰尵"
    Event 僼僅儞僩僨乕僞乕傪偔偩偝偄(ByVal Opcode As Integer, ByRef wFontName As String, ByRef wFontSize As Integer, ByRef wFontBold As Boolean)
    Event 僼僅儞僩傪愝掕偟偰偔偩偝偄(ByVal Opcode As Integer, ByVal rFontName As String, ByVal rFontSize As Integer, ByVal rFontBold As Boolean)
    Event aae僀儀儞僩_FormClosed_偺嵟屻偵屇傃弌偟偰偄傑偡()
    Private mNew幚峴拞 As Boolean = True
    Private mLoading As Boolean
#End Region

#Region "Form 僀儀儞僩"
    Friend Function aa僟僀傾儘僌_僼僅儞僩愝掕_Show0(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
            '********************************************
            If lst僼僅儞僩柤.Items.Count = 0 Then
                lst僼僅儞僩柤.Items.Clear()
                Dim wFonts() As String = {""}
                Dim n As Integer = 嘳僼僅儞僩僐儞儃娙堈儕僗僩嶌惉(wFonts, Nothing, "", "", True)
                gggint = 嘳儕僗僩儃僢僋僗偵_暥攝楍偐傜儕僗僩傪擖傟傞(lst僼僅儞僩柤, wFonts, True, -1, -1)
                gggbol = 嘳僼僅儞僩僒僀僘儕僗僩嶌惉(cbo僼僅儞僩僒僀僘, 30)
            End If
            '********************************************
            mLoading = False
            Dim wFontName As String = "", wFontSize As Integer = 9, wFontBold As Boolean = False
            RaiseEvent 僼僅儞僩僨乕僞乕傪偔偩偝偄(1, wFontName, wFontSize, wFontBold)
            Dim a As Integer = lst僼僅儞僩柤.FindStringExact(wFontName)
            If a >= 0 Then lst僼僅儞僩柤.SelectedIndex = a
            a = cbo僼僅儞僩僒僀僘.FindStringExact(CStr(CInt(wFontSize)))
            If a >= 0 Then cbo僼僅儞僩僒僀僘.SelectedIndex = a
            chk懢帤.Checked = wFontBold
            '********************************************
            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
            Me.Show(rOwner)
            If Not zzAppIniFileOp(0) Then gggint = 嘳FormMove(gco僼僅乕儉傪恊僼僅乕儉偺拞怱偵堏摦, Me, , , , , , , , 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 frmDlgListFont_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        gggint = zzAppIniFileOp(1)  '昁偢屇傃弌偟傑偡丅
    End Sub
    Private Sub frmDlgListFont_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        RaiseEvent aae僀儀儞僩_FormClosed_偺嵟屻偵屇傃弌偟偰偄傑偡()
    End Sub
    Private Sub frmDlgListFont_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        qqqqq("frmDlgListFont_Disposed")
    End Sub
    '仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴仴
    '僼僅乕儉僒僀僘偲埵抲偩偗傪曐懚偡傞応崌偺丄娙堈_嫟捠張棟
    '奺僼僅乕儉偵婰擖偡傞丅
    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, "屌桳偺幆暿暥")
    End Function
    '仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯仯
#End Region

#Region "僐儞僩儘乕儖 僀儀儞僩丂僟僀傾儘僌撪偱偺惍崌惈"
    Private Sub lst僼僅儞僩柤_SelectedIndexChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst僼僅儞僩柤.SelectedIndexChanged
        If mLoading Or mNew幚峴拞 Then Return
        Dim fn As String = lst僼僅儞僩柤.SelectedItem.ToString
        With lblSmpUP
            .Font = New Font(fn, .Font.Size, .Font.Style, .Font.Unit)
        End With
    End Sub
    Private Sub cbo僼僅儞僩僒僀僘_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbo僼僅儞僩僒僀僘.SelectedIndexChanged
        If mLoading Or mNew幚峴拞 Then Return
        Dim c As Single = Val(cbo僼僅儞僩僒僀僘.GetItemText(cbo僼僅儞僩僒僀僘.SelectedItem))
        If c < 8 Then c = 11.0
        Dim fsty As FontStyle = lblSmpUP.Font.Style
        fsty = fsty Or IIf(chk懢帤.Checked = True, FontStyle.Bold, FontStyle.Regular)
        lblSmpUP.Font = New Font(lblSmpUP.Font.FontFamily, c, fsty)
    End Sub
    Private Sub chk懢帤_CheckedChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles chk懢帤.CheckedChanged
        If mLoading Or mNew幚峴拞 Then Return
        lblSmpUP.Font = New Font(lblSmpUP.Font, IIf(chk懢帤.Checked = True, FontStyle.Bold, FontStyle.Regular))
    End Sub
    Private Sub btn暵偠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn暵偠傞.Click
        Me.Close()
    End Sub
#End Region

#Region "儊僯儏乕 僀儀儞僩"
    Private Sub btn愝掕_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn愝掕.Click
        btn愝掕.ContextMenuStrip = mnuPop
        mnuPop.Show(btn愝掕, 0, 0)
    End Sub
    Private Sub mnu儊僀儞僥僉僗僩偵愝掕_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnu儊僀儞僥僉僗僩偵愝掕.Click, mnu帿彂儕僗僩偵愝掕.Click, mnu娍帤儕僗僩偵愝掕.Click, mnu儐乕僓乕儃僞儞偺昞帵僥僉僗僩偵愝掕.Click, mnu偡傋偰偺儃僞儞孮偵愝掕.Click
        Dim Opcode As Integer = 0
        If sender Is Me.mnu儊僀儞僥僉僗僩偵愝掕 Then
            Opcode = 1
        ElseIf sender Is Me.mnu帿彂儕僗僩偵愝掕 Then
            Opcode = 2
        ElseIf sender Is Me.mnu娍帤儕僗僩偵愝掕 Then
            Opcode = 3
        ElseIf sender Is Me.mnu儐乕僓乕儃僞儞偺昞帵僥僉僗僩偵愝掕 Then
            Opcode = 4
        ElseIf sender Is Me.mnu偡傋偰偺儃僞儞孮偵愝掕 Then
            Opcode = 5
        End If
        If Opcode > 0 Then
            With lblSmpUP.Font
                RaiseEvent 僼僅儞僩傪愝掕偟偰偔偩偝偄(Opcode, .Name, .Size, .Bold)
            End With
        End If
    End Sub
#End Region

End Class