private void FontNameComboBox_SelectedValueChanged(object sender, EventArgs e) { string FontName = Enum.ToObject(typeof(FontNameHandle), FontNameComboBox.SelectedIndex).ToString(); FontData = FontControl.GetFont(FontName); ExampleLabel.ForeColor = FontData.FontColor; ExampleLabel.BackColor = Color.FromArgb(255 - FontData.FontColor.R, 255 - FontData.FontColor.G, 255 - FontData.FontColor.B); FontSizeTextBox.Text = ((int)FontData.Size).ToString(); OutlineSizeTextBox.Text = ((int)FontData.OutlineSize).ToString(); FontColorLabel.Text = ExampleLabel.ForeColor.ToString().Substring(6); OutlineColorLabel.Text = ExampleLabel.BorderColor.ToString().Substring(6); BoldCheckBox.Checked = FontData.Bold; UpdateExampleLabel(); ErrorProvider.SetError(SaveFontButton, ""); }
private void NewBackupFontButton_Click(object sender, EventArgs e) { string FontName; FontData FontData; if (MessageBox.Show("是否啟動字型還原?", "還原系統", MessageBoxButtons.OKCancel) == DialogResult.OK) { for (int i = 0; i < NewFontTypeComboBox.Items.Count; i++) { FontName = Enum.ToObject(typeof(FontNameHandle), i).ToString(); FontData = FontControl.GetFont(FontName); FontControl.SetFontType(FontName, "Regular"); } MessageBox.Show("已還原."); NewFontTypeComboBox.SelectedIndex = 1; NewFontTypeComboBox.SelectedIndex = 0; } }