void font_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button == null) return; TextBlock t = button.Content as TextBlock; if (t == null) return; Action<TextBlock> func = button.Tag as Action<TextBlock>; if (func == null) return; var dlg = new FontChooser(); dlg.Owner = MainWindow.mainWindow; dlg.SetPropertiesFromObject(t); dlg.PreviewSampleText = "The quick brown fox jumps over the lazy white dog."; if (dlg.ShowDialog() == true) { dlg.ApplyPropertiesToObject(t); t.Text = GetFontName(t); func(t); } }
private void titlefontchooserbtn_Click(object sender, RoutedEventArgs e) { var fc = new FontChooser { SelectedFontFamily = titlefontlabel.FontFamily, SelectedFontSize = titlefontlabel.FontSize, SelectedFontStyle = titlefontlabel.FontStyle, SelectedFontWeight = titlefontlabel.FontWeight }; var dr = fc.ShowDialog(); if (dr != true) { return; } titlefontlabel.FontFamily = fc.SelectedFontFamily; titlefontlabel.FontSize = fc.SelectedFontSize; titlefontlabel.FontStyle = fc.SelectedFontStyle; titlefontlabel.FontWeight = fc.SelectedFontWeight; Properties.Settings.Default.DefaultTitleFontFamily = fc.SelectedFontFamily.ToString(); Properties.Settings.Default.DefaultTitleFontSize = fc.SelectedFontSize; Properties.Settings.Default.DefaultTitleFontStyle = FontConversions.FontStyleToString(fc.SelectedFontStyle); Properties.Settings.Default.DefaultTitleFontWeight = FontConversions.FontWeightToString(fc.SelectedFontWeight); titlefontlabel.Content = string.Format("{0}, {1}pt, {2}, {3}", titlefontlabel.FontFamily, titlefontlabel.FontSize, titlefontlabel.FontStyle, titlefontlabel.FontWeight); }
private void btnFont_Click(object sender, RoutedEventArgs e) { if (_currentNoteControl != null) { var form = new FontChooser(); form.Owner = this.FindParentWindow(); form.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (form.ShowDialog().ValueOrFalse()) { form.ApplyPropertiesToTextSelection(_currentNoteControl.txtNote.Selection); } } }
public void Execute(object parameter) { UserTagView tag = Exceptions.CheckArgumentNull((UserTagView)parameter, "parameter"); FontChooser chooser = new FontChooser { FontDescriptor = (FontDescriptor)tag.Font }; if (chooser.ShowDialog() == true) { tag.Font = (FontDescriptorView)chooser.FontDescriptor; } }
private void button1_Click(object sender, EventArgs e) { FontChooser fontchooser = new FontChooser(); ElementHost.EnableModelessKeyboardInterop(fontchooser); WindowInteropHelper helper = new WindowInteropHelper(fontchooser); helper.Owner = this.Handle; fontchooser.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (fontchooser.ShowDialog() == true) { this.textBox1.Font = fontchooser.myfont; this.textBox1.ForeColor = fontchooser._color; } }
private void OnFontChange(object sender, RoutedEventArgs e) { FontChooser fontChooser = new FontChooser(); fontChooser.Owner = this; fontChooser.SetPropertiesFromObject(FontName); fontChooser.PreviewSampleText = FontName.Text; if (fontChooser.ShowDialog().Value) { fontChooser.ApplyPropertiesToObject(FontName); fontChooser.ApplyPropertiesToObject(SpecialFontTextBox); fontChooser.ApplyPropertiesToObject(CurrencySpecialFontSymbolLeft); fontChooser.ApplyPropertiesToObject(CurrencySpecialFontSymbol); } }
private void SelectFont(TextBlock control) { var fontDlg = new FontChooser { SelectedFontFamily = control.FontFamily, SelectedFontSize = control.FontSize, SelectedFontStyle = control.FontStyle, SelectedFontWeight = control.FontWeight, Owner = this }; if (fontDlg.ShowDialog() == true) { control.FontFamily = fontDlg.SelectedFontFamily; control.FontSize = fontDlg.SelectedFontSize; control.FontStyle = fontDlg.SelectedFontStyle; control.FontWeight = fontDlg.SelectedFontWeight; control.TextDecorations = fontDlg.SelectedTextDecorations; var points = GraphicsUtils.PixelsToPoints(this, control.FontSize); control.Text = String.Format("{0}, {1} pt", control.FontFamily.Source, points); setDirty(); } }
private void titlefontchooserbtn_Click(object sender, RoutedEventArgs e) { var fc = new FontChooser { SelectedFontFamily = titlefontlabel.FontFamily, SelectedFontSize = titlefontlabel.FontSize, SelectedFontStyle = titlefontlabel.FontStyle, SelectedFontWeight = titlefontlabel.FontWeight }; var dr = fc.ShowDialog(); if (dr != true) { return; } titlefontlabel.FontFamily = fc.SelectedFontFamily; titlefontlabel.FontSize = fc.SelectedFontSize; titlefontlabel.FontStyle = fc.SelectedFontStyle; titlefontlabel.FontWeight = fc.SelectedFontWeight; titlefontlabel.Content = string.Format("{0}, {1}pt, {2}, {3}", titlefontlabel.FontFamily, titlefontlabel.FontSize, titlefontlabel.FontStyle, titlefontlabel.FontWeight); }
private void fontchooserbtn_Click(object sender, RoutedEventArgs e) { var fc = new FontChooser { SelectedFontFamily = fontlabel.FontFamily, SelectedFontSize = fontlabel.FontSize, SelectedFontStyle = fontlabel.FontStyle, SelectedFontWeight = fontlabel.FontWeight }; var dr = fc.ShowDialog(); if (dr != true) return; fontlabel.FontFamily = fc.SelectedFontFamily; fontlabel.FontSize = fc.SelectedFontSize; fontlabel.FontStyle = fc.SelectedFontStyle; fontlabel.FontWeight = fc.SelectedFontWeight; fontlabel.Content = string.Format("{0}, {1}pt, {2}, {3}", fontlabel.FontFamily, fontlabel.FontSize, fontlabel.FontStyle, fontlabel.FontWeight); }
private void titlefontchooserbtn_Click(object sender, RoutedEventArgs e) { var fc = new FontChooser { SelectedFontFamily = titlefontlabel.FontFamily, SelectedFontSize = titlefontlabel.FontSize, SelectedFontStyle = titlefontlabel.FontStyle, SelectedFontWeight = titlefontlabel.FontWeight }; var dr = fc.ShowDialog(); if (dr != true) return; titlefontlabel.FontFamily = fc.SelectedFontFamily; titlefontlabel.FontSize = fc.SelectedFontSize; titlefontlabel.FontStyle = fc.SelectedFontStyle; titlefontlabel.FontWeight = fc.SelectedFontWeight; Properties.Settings.Default.DefaultTitleFontFamily = fc.SelectedFontFamily.ToString(); Properties.Settings.Default.DefaultTitleFontSize = fc.SelectedFontSize; Properties.Settings.Default.DefaultTitleFontStyle = FontConversions.FontStyleToString(fc.SelectedFontStyle); Properties.Settings.Default.DefaultTitleFontWeight = FontConversions.FontWeightToString(fc.SelectedFontWeight); titlefontlabel.Content = string.Format("{0}, {1}pt, {2}, {3}", titlefontlabel.FontFamily, titlefontlabel.FontSize, titlefontlabel.FontStyle, titlefontlabel.FontWeight); }