2 using System.Collections.Generic;
\r
4 using System.Windows;
\r
5 using System.Windows.Controls;
\r
6 using System.Windows.Data;
\r
7 using System.Windows.Documents;
\r
8 using System.Windows.Input;
\r
9 using System.Windows.Media;
\r
10 using System.Windows.Media.Imaging;
\r
11 using System.Windows.Shapes;
\r
16 /// NTFontSelectDialog.xaml の相互作用ロジック
\r
18 public partial class NTFontSelectDialog : Window
\r
20 public String FontName
\r
26 public NTFontSelectDialog()
\r
28 InitializeComponent();
\r
31 private void NTFontSelectDialog_Loaded(object sender, RoutedEventArgs e)
\r
33 edtFontName.Text = FontName;
\r
38 foreach (FontFamily fontFamily in Fonts.SystemFontFamilies)
\r
40 string source = fontFamily.Source;
\r
41 lstFonts.Items.Add(source);
\r
42 if (source.Equals(FontName))
\r
50 lstFonts.SelectedIndex = selIdx;
\r
51 lstFonts.ScrollIntoView(lstFonts.SelectedItem);
\r
56 private void lstFonts_selectionChanged(object sender, SelectionChangedEventArgs e)
\r
58 ListBox lb = sender as ListBox;
\r
61 ListBoxItem lbi =lb.SelectedItem as ListBoxItem;
\r
64 edtFontName.Text = lbi.Content.ToString();
\r
68 string fontName = lb.SelectedItem as string;
\r
69 if (fontName != null)
\r
71 edtFontName.Text = fontName;
\r
80 private void btnOK_Click(object sender, RoutedEventArgs e)
\r
82 this.DialogResult = true;
\r
83 FontName = edtFontName.Text;
\r
87 private void btnCancel_Click(object sender, RoutedEventArgs e)
\r
89 this.DialogResult = false;
\r
90 FontName = string.Empty;
\r