private void OnViewFont(object sender, EventArgs e) { FontDialog dlg = UIUtil.CreateFontDialog(true); dlg.Font = Program.Config.UI.DataEditorFont.ToFont(); dlg.ShowColor = false; if (dlg.ShowDialog() == DialogResult.OK) { Program.Config.UI.DataEditorFont = new AceFont(dlg.Font); Program.Config.UI.DataEditorFont.OverrideUIDefault = true; if (m_bdc == BinaryDataClass.Text) { bool bModified = m_bModified; // Save modified state UISelectAllText(true); m_rtbText.SelectionFont = dlg.Font; UISelectAllText(false); m_bModified = bModified; UpdateUIState(false, false); } } dlg.Dispose(); }
private void ButtonFontFamily_Click(object sender, RoutedEventArgs e) { if (TextBox1.Selection.IsEmpty) { return; } FontDialog fd = new FontDialog(); if (float.TryParse(ComboBoxFontSize.Text, out float res)) { fd.Font = new Font(((string)ButtonFontFamily.Content).Substring(3), res); } else { fd.Font = new Font(((string)ButtonFontFamily.Content).Substring(3), LPTED.OADisplay.FontSize); } if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { TextBox1.Selection.ApplyPropertyValue(TextElement.FontFamilyProperty, fd.Font.FontFamily.Name); TextBox1.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, fd.Font.Size.ToString("f1")); ButtonFontFamily.Content = "字体:" + fd.Font.FontFamily.Name; ComboBoxFontSize.Text = fd.Font.Size.ToString("f1"); } fd.Dispose(); }
private void OnBtnSelPwFont(object sender, EventArgs e) { FontDialog dlg = UIUtil.CreateFontDialog(false); AceFont fOld = Program.Config.UI.PasswordFont; if (fOld.OverrideUIDefault) { dlg.Font = fOld.ToFont(); } else if (FontUtil.MonoFont != null) { dlg.Font = FontUtil.MonoFont; } else { try { dlg.Font = new Font(FontFamily.GenericMonospace, m_lvSecurityOptions.Font.SizeInPoints); } catch (Exception) { Debug.Assert(false); } } if (dlg.ShowDialog() == DialogResult.OK) { Program.Config.UI.PasswordFont = new AceFont(dlg.Font); Program.Config.UI.PasswordFont.OverrideUIDefault = true; } dlg.Dispose(); }
/// <summary> /// Edits the value /// </summary> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { this.value = value; if (provider != null) { var service1 = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service1 != null) { var fontDialog = new FontDialog(); fontDialog.ShowApply = false; fontDialog.ShowColor = false; fontDialog.AllowVerticalFonts = false; fontDialog.AllowScriptChange = false; fontDialog.FixedPitchOnly = true; fontDialog.ShowEffects = false; fontDialog.ShowHelp = false; var font = value as Font; if (font != null) { fontDialog.Font = font; } if (fontDialog.ShowDialog() == DialogResult.OK) { this.value = fontDialog.Font; } fontDialog.Dispose(); } } value = this.value; this.value = null; return(value); }
private void fontChangeButton_Click(object sender, EventArgs e) { FontDialog fontDialog = new FontDialog(); if (fontDialog.ShowDialog() == DialogResult.OK) { paintFont = fontDialog.Font; } fontDialog.Dispose(); }
private void fontToolStripMenuItem_Click(object sender, EventArgs e) { FontDialog fd = new FontDialog(); //fd.ShowDialog(); if (fd.ShowDialog() == DialogResult.OK) { richTextBox1.SelectionFont = richTextBox1.Font; fd.Dispose(); } }
/// <summary> /// 设置文字样式 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolTextStyle_Click(object sender, EventArgs e) { var dialog = new FontDialog { MinSize = 8, MaxSize = 64, ShowApply = false, ShowColor = false, ShowEffects = false, FontMustExist = true }; if (dialog.ShowDialog(this) != DialogResult.OK) { dialog.Dispose(); return; } editor.TextFont = toolTextStyle.Font = dialog.Font; dialog.Dispose(); }
private void button1_Click(object sender, System.EventArgs e) { // Font Dialog FontDialog aFontDialog = new FontDialog(); aFontDialog.ShowColor = true; aFontDialog.ShowEffects = true; aFontDialog.MinSize = 1; aFontDialog.MaxSize = 35; aFontDialog.Font = this.Font; if (aFontDialog.ShowDialog() == DialogResult.OK) { this.Font = aFontDialog.Font; } aFontDialog.Dispose(); // Color Dialog /* * * ColorDialog aClrDialog = new ColorDialog(); * aClrDialog.AllowFullOpen = false; * aClrDialog.Color = this.BackColor; * if (aClrDialog.ShowDialog() == DialogResult.OK) * { * this.BackColor = aClrDialog.Color; * } * * aClrDialog.Dispose(); */ // File Dialog /* * OpenFileDialog aOpenFileDialog = new OpenFileDialog(); * aOpenFileDialog.Filter = "Text Files (*.txt)|*.txt|Word Documents" + * "(*.doc)|*.doc|All Files (*.*)|*.*"; * aOpenFileDialog.ShowReadOnly = true; * aOpenFileDialog.Multiselect = true; * aOpenFileDialog.Title = "Open files for custom application"; * if (aOpenFileDialog.ShowDialog() == DialogResult.OK) * { * this.txtSSN.Text = aOpenFileDialog.FileName; * //Do something useful with aOpenFileDialog.FileName * //or aOpenFileDialog.FileNames * } * * aOpenFileDialog.Dispose(); */ }
private void scoreFontButton_Click(object sender, EventArgs e) { FontDialog dialog = new FontDialog(); dialog.Font = Properties.Settings.Default.ScoreFont; dialog.ShowDialog(); Properties.Settings.Default.ScoreFont = dialog.Font; viewInitArgs.ScoreFont = new FontInfo(dialog.Font.Name, (int)dialog.Font.Size); Properties.Settings.Default.Save(); scoreFontLabel.Text = string.Format("{0} {1}", dialog.Font.Name, dialog.Font.Size.ToString("0.0")); viewWindow.ScreenArea.InitViews(viewInitArgs); dialog.Dispose(); }
private void addresFontBtn_Click(object sender, EventArgs e) { FontDialog fontDialog = new FontDialog(); fontDialog.Font = addressFont; if (fontDialog.ShowDialog() != DialogResult.OK) { return; } this.addressFontTxt.Text = new FontConverter().ConvertToString(fontDialog.Font); addressFont = fontDialog.Font; restartTimer(); fontDialog.Dispose(); }
private void fontsToolStripMenuItem_Click(object sender, EventArgs e) { FontDialog fontDialog = new FontDialog(); fontDialog.Font = richTextBox1.Font; if (fontDialog.ShowDialog() == DialogResult.OK) { richTextBox1.Font = fontDialog.Font; } else { fontDialog.Dispose(); } }
private void fontToolStripMenuItem_Click(object sender, EventArgs e) { FontDialog fontDialog = new FontDialog(); if (fontDialog.ShowDialog().Equals(DialogResult.Cancel)) { fontDialog.Dispose(); } else { richTextBox1.Font = fontDialog.Font; LineNumberTextBox.Font = richTextBox1.Font; } }
private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e) { Class_PublicMethod class_PublicMethod = new Class_PublicMethod(); Font font = new Font("Tahoma", class_PublicMethod.GetGridFontSize()); FontDialog fontDialog = new FontDialog { Font = font }; if (fontDialog.ShowDialog() == DialogResult.OK) { class_PublicMethod.SetGridFontSize(fontDialog.Font.Size); } fontDialog.Dispose(); }
private void button1_Click(object sender, EventArgs e) { FontDialog fd = new FontDialog(); fd.FontMustExist = true; fd.Font = fontname.Font; if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Interactivity.codes.codeTextBox.Font = fd.Font; fontname.Tag = fd.Font; fontname.Text = fd.Font.ToString(); fontname.Font = new Font(fd.Font.FontFamily, 8.5F, fd.Font.Style); Properties.Settings.Default.EditorFont = fd.Font; } fd.Dispose(); }
private void fontChangeBtn_Click(object sender, EventArgs e) { FontDialog dlg = new FontDialog(); dlg.Font = Program.mainWindow.font1; try { if (dlg.ShowDialog(this) == DialogResult.OK) { Program.mainWindow.font1 = new Font(dlg.Font.FontFamily, Program.mainWindow.font1.Size, dlg.Font.Style); RefreshFontText(); Program.mainWindow.SetFonts(); } } catch (ArgumentException) { MessageBox.Show("Font not supported.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } dlg.Dispose(); }
public void QueryFontColor(Font2 fontIn, Color2 colorIn, out Font2 font, out Color2 color) { font = null; color = Color2.Empty; FontDialog fontDialog = new FontDialog { ShowColor = true, Font = GraphUtils.ToFont(fontIn), Color = GraphUtils.ToColor(colorIn) }; if (fontDialog.ShowDialog() != DialogResult.Cancel) { font = GraphUtils.ToFont2(fontDialog.Font); color = GraphUtils.ToColor2(fontDialog.Color); } fontDialog.Dispose(); }
//private void ReadCfgClick(object sender, EventArgs e) //{ // ReadConfig(); //} //private void OpenCfgClick(object sender, EventArgs e) //{ // string cfgFile = "\""+AppDomain.CurrentDomain.SetupInformation.ConfigurationFile+"\""; // Thread thread = new Thread(delegate() // { // Process convertorProcess = new Process(); // convertorProcess.StartInfo = new ProcessStartInfo("notepad", cfgFile); // convertorProcess.Start(); // }); // // backgroud thread - neblokuje ukonceni procesu (kdyz konci proces, ukonci se i vsechny bezici background vlakna) // thread.IsBackground = true; // thread.Start(); //} private void FontClick(object sender, EventArgs e) { FontDialog dia = new FontDialog(); dia.FontMustExist = true; dia.ShowColor = false; dia.ShowEffects = false; dia.Font = logGrid.Font; if (dia.ShowDialog() == DialogResult.OK) { float rat = (float)dia.Font.Height / logGrid.Font.Height; logGrid.RowTemplate.Height = (int)Math.Round(logGrid.RowTemplate.Height * rat); logGrid.Font.Dispose(); logGrid.Font = dia.Font; } dia.Dispose(); }
private void btnGridFont_Click(object sender, System.EventArgs e) { System.Windows.Forms.FontDialog frmTemp = new FontDialog(); frmTemp.ShowColor = true; frmTemp.Font = this.lblGridFont.Font; frmTemp.Color = this.lblGridRowForegroundColor.BackColor; if (frmTemp.ShowDialog() != DialogResult.Cancel) { this.lblGridFont.Font = frmTemp.Font; this.lblGridFontName.Text = frmTemp.Font.Name; this.lblGridFontSize.Text = frmTemp.Font.Size.ToString().Trim(); this.lblGridFontStyle.Text = frmTemp.Font.Style.ToString().Trim(); this.lblGridRowForegroundColor.BackColor = frmTemp.Color; } frmTemp.Dispose(); frmTemp = null; }
//set mail font //set clock font private void fontToolStripMenuItem4_Click(object sender, EventArgs e) { FontDialog fd = new FontDialog(); fd.Font = label2.Font; if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { label2.Font = fd.Font; string fontString = converter.ConvertToString(fd.Font); r = Registry.CurrentUser.OpenSubKey("SOFTWARE\\ClearAll\\RamC\\Data", true); r.SetValue("Clockfont", fontString); r.Close(); r.Dispose(); } fd.Dispose(); }
private void ButtonOAFontFamily_Click(object sender, RoutedEventArgs e) { FontDialog fd = new FontDialog(); fd.Font = new Font(LPTED.OADisplay.FontFamily.ToString(), LPTED.OADisplay.FontSize); if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LPTED.SavePage(NowPage); //先保存 LPTED.OADisplay.FontFamily = new FontFamily(fd.Font.FontFamily.Name); //储存设置 LPTED.OADisplay.FontSize = fd.Font.Size; ButtonOAFontFamily.Content = "字体:" + fd.Font.FontFamily.Name; LPTED.DisplaySource(NowPage);//重新加载 } fd.Dispose(); }
public void ShowFontDialog() { FontDialog dlg = new FontDialog(); try { dlg.Font = TextFont; if (dlg.ShowDialog() == DialogResult.OK) { TextFont = dlg.Font; } } finally { dlg.Dispose(); } }
private bool _disposedValue; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (_disposedValue) { return; } if (disposing) { _watermarkFontDlg.Dispose(); _watermarkFileBrowser.Dispose(); _outputBrowser.Dispose(); _folderBrowser.Dispose(); _fileBrowser.Dispose(); } _disposedValue = true; }
protected override void OnClick(EventArgs e) { base.OnClick(e); FontDialog fontDialog = new FontDialog(); try { fontDialog.Font = this.Font; if (fontDialog.ShowDialog() == DialogResult.OK) { this.Font = fontDialog.Font; } } finally { fontDialog.Dispose(); } }
private void selectFontButton_Click(object sender, EventArgs e) { FontDialog dlg = new FontDialog(); dlg.Font = mProjectView.CodeListViewFont; dlg.ShowEffects = false; Debug.WriteLine("Showing font dialog..."); if (dlg.ShowDialog() != DialogResult.Cancel) { FontConverter cvt = new FontConverter(); // Store invariant string, display localized string. mSettings.SetString(AppSettings.CDLV_FONT, cvt.ConvertToInvariantString(dlg.Font)); currentFontDisplayLabel.Text = cvt.ConvertToString(dlg.Font); SetDirty(true); } Debug.WriteLine("Font dialog done..."); dlg.Dispose(); }
private void footerFontBtn_Click(object sender, EventArgs e) { FontDialog fontDialog = new FontDialog(); fontDialog.Font = footerFont; if (fontDialog.ShowDialog() != DialogResult.OK) { return; } this.footerFontTxt.Text = new FontConverter().ConvertToString(fontDialog.Font); footerFont = fontDialog.Font; if (footerCheckBox.Checked) { restartTimer(); } fontDialog.Dispose(); }
public bool QueryFontColor(Font2 fontIn, Color2 colorIn, out Font2 font, out Color2 color) { font = null; color = Color2.Empty; FontDialog fontDialog = new FontDialog { ShowColor = true, Font = GraphUtils.ToFont(fontIn), Color = GraphUtils.ToColor(colorIn) }; bool ok = fontDialog.ShowDialog() == DialogResult.OK; if (ok) { font = GraphUtils.ToFont2(fontDialog.Font); color = GraphUtils.ToColor2(fontDialog.Color); } fontDialog.Dispose(); return(ok); }
private void _btnChangeFont_Click(object sender, EventArgs e) { var dialog = new FontDialog { Font = Config.Font }; var dialogResult = dialog.ShowDialog(); if (dialogResult != DialogResult.OK) { return; } Config.Font = dialog.Font; _txtFont.Text = Config.Font.Name; dialog.Dispose(); }
private void button_font_Click(object sender, EventArgs e) { //FontDialogクラスのインスタンスを作成 FontDialog fd = new FontDialog(); //初期のフォントを設定 fd.Font = text.Font; //初期の色を設定 fd.Color = text.ForeColor; //ユーザーが選択できるポイントサイズの最大値を設定する fd.MaxSize = 999; fd.MinSize = 2; //存在しないフォントやスタイルをユーザーが選択すると //エラーメッセージを表示する fd.FontMustExist = true; //横書きフォントだけを表示する fd.AllowVerticalFonts = false; //色を選択できるようにする fd.ShowColor = true; //取り消し線、下線、テキストの色などのオプションを指定可能にする //デフォルトがTrueのため必要はない fd.ShowEffects = true; //固定ピッチフォント以外も表示する //デフォルトがFalseのため必要はない fd.FixedPitchOnly = false; //ベクタ フォントを選択できるようにする //デフォルトがTrueのため必要はない fd.AllowVectorFonts = true; //ダイアログを表示する if (fd.ShowDialog() != DialogResult.Cancel) { //TextBox1のフォントと色を変える text.Font = fd.Font; text.ForeColor = fd.Color; } set_jimaku(); fd.Dispose(); }
private void OnBtnSelListFont(object sender, EventArgs e) { FontDialog dlg = UIUtil.CreateFontDialog(false); AceFont fOld = Program.Config.UI.StandardFont; if (fOld.OverrideUIDefault) { dlg.Font = fOld.ToFont(); } else { try { dlg.Font = m_lvSecurityOptions.Font; } catch (Exception) { Debug.Assert(false); } } if (dlg.ShowDialog() == DialogResult.OK) { Program.Config.UI.StandardFont = new AceFont(dlg.Font); Program.Config.UI.StandardFont.OverrideUIDefault = true; } dlg.Dispose(); }
private void btnChangeEnglishFont_Click(object sender, EventArgs e) { FontDialog dialog = new FontDialog(); dialog.Font = painter.EnglishFont; //设置为上一次的字体,方便修改 try { if (dialog.ShowDialog() == DialogResult.OK && dialog.Font != null) { painter.EnglishFont = dialog.Font; lblEnglishFontInfo.Text = string.Format("{0} {1}", dialog.Font.Name, dialog.Font.Size); lblEnglishFontPreview.Font = dialog.Font; } } catch (ArgumentException ex) { if (ex.Message.Contains("TrueType")) { Utils.ShowError("OpenType font is not supported! Try google how to convert .otf to .ttf ."); } } dialog.Dispose(); }