I am using the FontDialog and am having a couple problems.
First, I cannot get the apply button to work. I have tries several things but this is the latest incarnation. Whenever I click apply nothing happens.....
Also, whenever I click on either ok or cancel, then the window pops again. Everything else works properly. I cannot spot anything that would cause this.
Any suggestions will be greatly appreciated.
Jim
First, I cannot get the apply button to work. I have tries several things but this is the latest incarnation. Whenever I click apply nothing happens.....
Code:
Private Sub fontDlg_Apply(sender As System.Object, e As System.EventArgs)
lbxName.Font = fontDlg.Font
lbxContent.Font = fontDlg.Font
lbxName.ForeColor = fontDlg.Color
lbxContent.ForeColor = fontDlg.Color
End Sub
Code:
Private Sub tlsCustom_Click(sender As System.Object, e As System.EventArgs) Handles tlsCustom.Click
fontDlg.ShowColor = True
fontDlg.ShowApply = True
fontDlg.ShowEffects = True
fontDlg.ShowHelp = False
fontDlg.AllowScriptChange = False
fontDlg.AllowVectorFonts = False
fontDlg.MaxSize = 20
fontDlg.MinSize = 8
Me.lbxName.ForeColor = lbxName.ForeColor
Dim strFont As Font = Me.Font
Dim strColor As String = My.Settings.c4wFontColor.Name
If (fontDlg.ShowDialog() = DialogResult.OK) Then
lbxName.Font = fontDlg.Font
lbxName.ForeColor = fontDlg.Color
lbxContent.Font = fontDlg.Font
lbxContent.ForeColor = fontDlg.Color
End If
If (fontDlg.ShowDialog() = DialogResult.Cancel) Then
Exit Sub
End If
Dim result As DialogResult = MessageBox.Show("Would you like to keep these changes?", _
"Please Confirm", _
MessageBoxButtons.YesNo)
If result = 6 Then
My.Settings.c4wFont = fontDlg.Font
My.Settings.c4wFontColor = fontDlg.Color
My.Settings.Save()
Exit Sub
End If
If result = 7 Then
lbxName.Font = strFont
lbxContent.Font = strFont
lbxName.ForeColor = System.Drawing.Color.FromName(strColor)
lbxContent.ForeColor = System.Drawing.Color.FromName(strColor)
Exit Sub
End If
End Sub
Jim