/// <summary> /// Initialize a new instance of <see cref="MainWindow" />. /// </summary> public MainWindow() { InitializeComponent(); // Add a new initialized item CharSetFontMappings = new ObservableCollection <CharSetFontMapping> { new CharSetFontMapping { CharSet = new FullCharSetSource(), Font = new SystemFontSource(FontInfo.GetControlFont(this)) } }; // Default setting GenerationSetting = new GenerationSetting { TextureSize = Settings.Default.DefaultTextureSize, GlyphSize = Settings.Default.DefaultGlyphSize, GlyphSpace = Settings.Default.DefaultGlyphSpace, SurfaceFileNameFormat = Settings.Default.DefaultSurfaceFileFormat, MetadataFileName = Settings.Default.DefaultMetaFileName, OutputDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) }; }
private void fontSelecterButtonClick(object sender, RoutedEventArgs e) { //We can pass a bool to choose if we preview the font directly in the list of fonts. bool previewFontInFontList = false; //True to allow user to input arbitrary font sizes. False to only allow predtermined sizes bool allowArbitraryFontSizes = false; ColorFontDialog dialog = new ColorFontDialog(previewFontInFontList, allowArbitraryFontSizes); //TextElement.Foreground = "{DynamicResource MaterialDesignBody}" //Background = "{DynamicResource MaterialDesignPaper}" //FontFamily = "{DynamicResource MaterialDesignFont}" dialog.Background = this.FindResource("MaterialDesignPaper") as SolidColorBrush; dialog.Foreground = this.FindResource("MaterialDesignBody") as SolidColorBrush; dialog.Font = FontInfo.GetControlFont(tbTitleAction); //Optional custom allowed size range dialog.FontSizes = new int[] { 10, 12, 14, 16, 18, 20, 22 }; if (dialog.ShowDialog() == true) { FontInfo font = dialog.Font; if (font != null) { FontInfo.ApplyFont(tbTitleAction, font); } } }
private void mnSetting_Click(object sender, RoutedEventArgs e) { try { SettingWindow sw = new SettingWindow() { Owner = this }; sw.BoardFontInfo = FontInfo.GetControlFont(this.tbBoard); sw.BoardBackground = this.tbBoard.Background; if (sw.ShowDialog() == true) { RegistryHelper regHelper = new RegistryHelper(this); regHelper.SaveSettings(); this.HighlightCurrentString(); this.ResetClientsUpdate(); } } catch (Exception ex) { #if DEBUG Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); #endif MessageBox.Show(ex.Message, "Применение (сохранение) настроек", MessageBoxButton.OK, MessageBoxImage.Information); } }
public MainWindow() { InitializeComponent(); fileManager = new FileManager(); fileManager.SetFont(FontInfo.GetControlFont(LoadedFontFamily)); //process = new Process(); stopwatch = new Stopwatch(); //workerManager = new WorkerManager(FFMpegProgress, ConsoleBox); }
private void Button_SpotDetailFont_Click(object sender, RoutedEventArgs e) { ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog(); fntDialog.Owner = this; fntDialog.Font = FontInfo.GetControlFont(this.SpotDetailList[0]); if (fntDialog.ShowDialog() == true) { SettingInfo.SpotDetailFontInfo = fntDialog.Font; } }
private void Button_TitleFont_Click(object sender, RoutedEventArgs e) { ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog(); fntDialog.Owner = this; fntDialog.Font = FontInfo.GetControlFont(this.TextBox_Title); if (fntDialog.ShowDialog() == true) { SettingInfo.TitleFontInfo = fntDialog.Font; } }
private void button_Click(Object sender, RoutedEventArgs e) { ColorFontDialog dialog = new ColorFontDialog(); dialog.Font = FontInfo.GetControlFont(label); if (dialog.ShowDialog() == true) { font = dialog.Font; } }
private void Font_Executed(object sender, ExecutedRoutedEventArgs e) { var dlg = new ColorFontDialog(showColorPicker: false); dlg.Font = FontInfo.GetControlFont(tables.SelectedContent as Control); if (dlg.ShowDialog() == true) { FontInfo.ApplyFont(tables.SelectedContent as Control, dlg.Font); } e.Handled = true; }
void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { _selectedFont = FontInfo.GetControlFont(this.DummyTextBox); _smallTemplateImage = new BitmapImage(new Uri("Data/Small.png", UriKind.Relative)); _mediumTemplateImage = new BitmapImage(new Uri("Data/Medium.png", UriKind.Relative)); Lines.Text = File.ReadAllText("Data/Default.txt"); Directory.CreateDirectory("./Output"); RedrawPreview(); }
private void btFont_Click(object sender, RoutedEventArgs e) { ColorFontDialog fntDialog = new ColorFontDialog(); fntDialog.Owner = this; fntDialog.Font = FontInfo.GetControlFont(this.tbExample); if (fntDialog.ShowDialog() == true) { FontInfo selectedFont = fntDialog.Font; if (selectedFont != null) { FontInfo.ApplyFont(this.tbExample, selectedFont); } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog(); fntDialog.Owner = this; fntDialog.Font = FontInfo.GetControlFont(this.txtText); if (fntDialog.ShowDialog() == true) { FontInfo selectedFont = fntDialog.Font; if (selectedFont != null) { FontInfo.ApplyFont(this.txtText, selectedFont); } } }
private void saveButtonClick(object sender, RoutedEventArgs e) { Actions[SelectedNumber].Title = tbTitleAction.Text; Actions[SelectedNumber].Titlefont = FontInfo.GetControlFont(tbTitleAction); Actions[SelectedNumber].ShowTitleLabel = showTitleToggleButton.IsChecked ?? false; if (Actions[SelectedNumber] is LaunchAction) { var fullPath = FindExePath(tbPath.Text); if (File.Exists(fullPath) && fullPath != (Actions[SelectedNumber] as LaunchAction).ExePath) { var icon = GetBestIcon(fullPath); if (icon != null) { //Bitmap bitmap = IconUtil.ToBitmap(icon); Bitmap bitmap = icon.ToBitmap(); bitmap.Save("Temp.png"); controller.AddImage(SelectedNumber + 1, "Temp.png"); } } (Actions[SelectedNumber] as LaunchAction).ExePath = fullPath; (Actions[SelectedNumber] as LaunchAction).Args = tbArgs.Text; var result = LaunchAction.ProcessRunningAction.FocusOldProcess; Enum.TryParse(tbNewProcessAction.SelectedItem.ToString(), out result); (Actions[SelectedNumber] as LaunchAction).AlreadyRunningAction = result; controller.Save(); } else if (Actions[SelectedNumber] is TextStringAction) { (Actions[SelectedNumber] as TextStringAction).Value = tbValue.Text; } else if (Actions[SelectedNumber] is FolderAction) { (Actions[SelectedNumber] as FolderAction).ExeConditionName = tbFolderCondition.Text; } else if (Actions[SelectedNumber] is HotkeyAction) { (Actions[SelectedNumber] as HotkeyAction).MainKey = MainKey; (Actions[SelectedNumber] as HotkeyAction).Modifiers = Modifiers; } Color c = Color.FromArgb(ClrPcker_Background.SelectedColor.Value.R, ClrPcker_Background.SelectedColor.Value.G, ClrPcker_Background.SelectedColor.Value.B); Actions[SelectedNumber].BackgroundColor = c; controller.Save(); controller.LoadIcons(); }
private void Button_Click(object sender, RoutedEventArgs e) { ColorFontDialog dialog = new ColorFontDialog(true, true, true); dialog.Owner = this; dialog.Font = FontInfo.GetControlFont(this.TextBlockSample); //dialog.FontSizes = new int[] { 10, 12, 14, 16, 18 }; if (dialog.ShowDialog() == true) { FontInfo font = dialog.Font; if (font != null) { FontInfo.ApplyFont(this.TextBlockSample, font); } } }
private void FontMenuItem_Click(object sender, RoutedEventArgs e) { var dialog = new ColorFontDialog { Font = FontInfo.GetControlFont(LogTextBox) }; if (dialog.ShowDialog() == true) { var font = dialog.Font; if (font != null) { FontInfo.ApplyFont(LogTextBox, font); } } }
void OnfontMenuClick(object sender, RoutedEventArgs e) { FontWindow fw = new FontWindow(); fw.Title = "글꼴"; fw.Owner = Owner; fw.Font = FontInfo.GetControlFont(this.beforeTextBox); if (fw.ShowDialog() == true) { FontInfo selectedFont = fw.Font; if (selectedFont != null) { FontInfo.ApplyFont(this.beforeTextBox, selectedFont); FontInfo.ApplyFont(this.afterTextBox, selectedFont); } } }
private void font_Click(object sender, RoutedEventArgs e) { //https://github.com/sskodje/WpfColorFont bool previewFontInFontList = true; ColorFontDialog dialog = new ColorFontDialog(previewFontInFontList); dialog.Font = FontInfo.GetControlFont(mainTextBox); if (dialog.ShowDialog() == true) { FontInfo font = dialog.Font; if (font != null) { FontInfo.ApplyFont(mainTextBox, font); } } }
/// <summary> /// This event is handled when user wants to set font settings of the code editor /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FontSettingsItem_Click(object sender, RoutedEventArgs e) { ColorFontDialog fntDialog = new ColorFontDialog { Owner = this, Font = FontInfo.GetControlFont(TabManager.CodeEditorBox) }; if (fntDialog.ShowDialog() == true) { FontInfo selectedFont = fntDialog.Font; if (selectedFont != null) { FontInfo.ApplyFont(TabManager.CodeEditorBox, selectedFont); } } }
public MainWindow() { InitializeComponent(); SpotList = new List <TextBox>(); SpotDetailList = new List <TextBox>(); SpotIndexColorList = new List <Xceed.Wpf.Toolkit.ColorPicker>(); SettingInfo = new SettingInfo(); SettingInfo.TitleFontInfo = FontInfo.GetControlFont(this.TextBox_Title); SettingInfo.TitleDetailFontInfo = FontInfo.GetControlFont(this.TextBox_Title); SettingInfo.SpotFontInfo = FontInfo.GetControlFont(this.TextBox_Title); SettingInfo.SpotDetailFontInfo = FontInfo.GetControlFont(this.TextBox_Title); SettingInfo.TitleSize = 25d; SettingInfo.TitleDetailSize = 20d; SettingInfo.SpotSize = 15d; SettingInfo.SpotDetailSize = 12d; SettingInfo.ImageAreaRatio = 0.618d; Button_Generate.IsEnabled = false; this.DataContext = SettingInfo; }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); if (this.DialogResult == true) { this.BoardFontInfo = FontInfo.GetControlFont(this.tbExample); this.BoardBackground = this.tbExample.Background; this._editor.inkBoard.Width = this.slWidth.Value; this._editor.inkBoard.Height = this.slHeight.Value; this._editor.IP = this.cbIp.SelectedItem.ToString(); this._editor.Port = Int32.Parse(this.tbPort.Text.Trim()); FontInfo.ApplyFont(this._editor.tbBoard, this.BoardFontInfo); this._editor.tbBoard.Background = this.BoardBackground; this._editor.ResetClientsUpdate(); } }
void AddElement(int type) { ElementControl E = new ElementControl(type, elements.Count); elements.Add(E); elements.Last().TopClick += Element_Click; elements.Last().DataChanged += Element_DataChanged; elements.Last().LayerUpClick += LayerUp_Click; elements.Last().LayerDownClick += LayerDown_Click; elements.Last().DeletElementClick += DeletElement_Click; elements.Last().FontButtonClick += FontButton_Click; elements.Last().TextBorderSatusChange += TextBorderCheck_Change; fonts.Add(FontInfo.GetControlFont(cardWidth)); switch (type) { case 0: card.Set(new CardBackground()); break; case 1: card.Set(new CardFram()); break; case 2: card.Set(new CardImage()); break; case 3: card.Set(new CardImgNum()); break; case 4: card.Set(new CardText()); break; } ShowElements(); }
void newBtn_Click(object sender, RoutedEventArgs e) { ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog(); //fntDialog.Owner = this; Canvas canva2 = ((tabs.SelectedItem as TabItem).Content as StackPanel).Children[0] as Canvas; foreach (TextBlock a in canva2.Children.OfType <TextBlock>()) { if (a.Name == (sender as Button).Name) { Control s = new Control(); s.FontFamily = a.FontFamily; s.FontSize = a.FontSize; s.FontWeight = a.FontWeight; s.FontStyle = a.FontStyle; s.Foreground = a.Foreground; fntDialog.Font = FontInfo.GetControlFont(s as Control); } } if (fntDialog.ShowDialog() == true) { Canvas canva = ((tabs.SelectedItem as TabItem).Content as StackPanel).Children[0] as Canvas; foreach (TextBlock a in canva.Children.OfType <TextBlock>()) { if (a.Name == (sender as Button).Name) { FontInfo selectedFont = fntDialog.Font; if (selectedFont != null) { a.FontFamily = selectedFont.Family; a.FontSize = selectedFont.Size; a.FontWeight = selectedFont.Weight; a.FontStyle = selectedFont.Style; } } } } //throw new NotImplementedException(); }
private void mnSetting_Click(object sender, RoutedEventArgs e) { try { SettingWindow sw = new SettingWindow() { Owner = this }; sw.BoardFontInfo = FontInfo.GetControlFont(this.tbBoard); sw.BoardBackground = this.tbBoard.Background; if (sw.ShowDialog() == true) { FontInfo.ApplyFont(this.tbBoard, sw.BoardFontInfo); this.tbBoard.Background = sw.BoardBackground; } } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show(ex.Message, "Применение настроек", MessageBoxButton.OK, MessageBoxImage.Information); } }