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

#Region "愰尵"
    Event 僼僅儞僩傪愝掕偟偰偔偩偝偄(ByVal rFontName As String, ByVal rFontSize As Integer, ByVal rFontBold As Boolean)
    Private mNew幚峴拞 As Boolean = True
    Private mLoading As Boolean
#End Region

    Friend Function aa僟僀傾儘僌_僼僅儞僩愝掕_Show1(ByVal rOwner As Form, ByVal rUser As Control, 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 rUser Is Nothing Then GoTo UnLoadPos
            '********************************************
            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
            With rUser.Font
                Dim a As Integer = lst僼僅儞僩柤.FindStringExact(.Name)   'lst僼僅儞僩柤.SelectedIndex = 嘳儕僗僩儃僢僋僗偐傜_暥偺儕僗僩傪扵偟偰_僀儞僨僢僋僗傪曉偡(lst僼僅儞僩柤, wFontName, True)
                If a >= 0 Then lst僼僅儞僩柤.SelectedIndex = a
                a = cbo僼僅儞僩僒僀僘.FindStringExact(CStr(CInt(.Size)))
                If a >= 0 Then cbo僼僅儞僩僒僀僘.SelectedIndex = a
                chk懢帤.Checked = .Bold
            End With
            '********************************************
            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 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
        With lblSmpUP.Font
            RaiseEvent 僼僅儞僩傪愝掕偟偰偔偩偝偄(.Name, .Size, .Bold)
        End With
    End Sub
    Private Sub btn暵偠傞_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn暵偠傞.Click
        Me.Close()
    End Sub

    Private Sub frmDlgListFont_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class