/// <summary>
        /// Edits the value
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            editedValue = value;
            using (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;

                Font font = value as Font;
                if (font != null) fontDialog.Font = font;

                if (fontDialog.ShowDialog() == DialogResult.OK)
                    editedValue = fontDialog.Font;
            }

            value = editedValue;
            editedValue = null;

            return value;
        }
Exemple #2
0
        /// <summary>
        /// Uses the fontDialog to allow the user to specify a font
        /// for the report header.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void SelectHeaderFont_Click(object sender, System.EventArgs e)
        {
            // Set the initial selection to the currently selected header font.
            // Since this one dialog is used for selection of both the header
            // and body fonts, this needs to be set each time.
            fontDialog1.Font = headerFont;

            // Show the font selection dialog.
            if (fontDialog1.ShowDialog() == DialogResult.OK)
            {
                // Update the selected font and the form controls
                // only if the user pressed OK.
                headerFont = fontDialog1.Font;
                headerFontDefinition.Text = headerFont.ToString();
            }
        }
Exemple #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            FontDialog fd = new FontDialog();

            System.Windows.Forms.DialogResult dr = fd.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.Cancel)
            {
                FontFamily fontFamily = new System.Windows.Media.FontFamily(fd.Font.Name);
                double fontSize = fd.Font.Size * 96.0 / 72.0; ;
                FontWeight fontWeight = fd.Font.Bold ? FontWeights.Bold : FontWeights.Regular;
                FontStyle fontStyle = fd.Font.Italic ? FontStyles.Italic : FontStyles.Normal;

                tbSourse.FontFamily = fontFamily;
                tbTranslated.FontFamily = fontFamily;
                tbSourse.FontSize = fontSize;
                tbTranslated.FontSize = fontSize;
                tbSourse.FontWeight = fontWeight;
                tbTranslated.FontWeight = fontWeight;
                tbSourse.FontStyle = fontStyle;
                tbTranslated.FontStyle = fontStyle;

                Properties.Settings.Default.FontFamily = fontFamily;
                Properties.Settings.Default.FontSize = fontSize;
                Properties.Settings.Default.FontWeight = fontWeight;
                Properties.Settings.Default.FontStyle = fontStyle;
                Properties.Settings.Default.Save();
            }
        }
Exemple #4
0
 private void mnuFont_Click(object sender, System.EventArgs e)
 {
     if (fontDialog1.ShowDialog() != DialogResult.Cancel)
     {
         txtEdit.Font = fontDialog1.Font;
     } // end if
 }     // end mnuFont
Exemple #5
0
 protected override void OnMouseUp(MouseEventArgs mevent)
 {
     IsDragMode = false;
     base.OnMouseUp(mevent);
     if (mevent.Button == MouseButtons.Right)
     {
         using (ColorDialog cd = new ColorDialog())
         {
             cd.FullOpen = true;
             if (cd.ShowDialog() == DialogResult.OK)
             {
                 this.ForeColor = cd.Color;
             }
         }
         using (FontDialog fd = new FontDialog())
         {
             try
             {
                 fd.AllowScriptChange = false;
                 fd.AllowSimulations = false;
                 if (fd.ShowDialog() == DialogResult.OK)
                 {
                     this.Font = fd.Font;
                 }
             }
             catch (Exception ex)
             {
                 //Not a truetype font
                 MessageBox.Show(this, ex.Message + Environment.NewLine + "Шрифт не изменен.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Exemple #6
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     this.value = value;
     if ((provider != null) && (((IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService))) != null))
     {
         FontDialog dialog = new FontDialog();
         dialog.ShowApply = false;
         dialog.ShowColor = false;
         dialog.AllowVerticalFonts = false;
         dialog.AllowScriptChange = false;
         dialog.FixedPitchOnly = true;
         dialog.ShowEffects = false;
         dialog.ShowHelp = false;
         Font font = value as Font;
         if (font != null)
         {
             dialog.Font = font;
         }
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             this.value = dialog.Font;
         }
         dialog.Dispose();
     }
     value = this.value;
     this.value = null;
     return value;
 }
Exemple #7
0
//<snippet1>

        private void button1_Click(object sender, System.EventArgs e)
        {
            // Sets the ShowApply property, then displays the dialog.

            fontDialog1.ShowApply = true;
            fontDialog1.ShowDialog();
        }
Exemple #8
0
        private void EditFont_Click(object sender, EventArgs e)
        {
            font_tracker f = (font_tracker)this.FontList.SelectedItem;

            //pickedFont = null;
            System.Windows.Forms.FontDialog fd = new System.Windows.Forms.FontDialog();
            fd.Font = f.f;

            DialogResult result = fd.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                f.f      = fd.Font;
                f.family = fd.Font.FontFamily.Name;
                f.size   = fd.Font.Size;
                f.style  = fd.Font.Style;
                f.unit   = fd.Font.Unit;
                f.InvokeChanged();
                foreach (Control c in f.Controls)
                {
                    c.Font = f.f;
                }
            }
            fd.Dispose();
        }
Exemple #9
0
 //字体
 private void Mfont_Click(object sender, System.EventArgs e)
 {
     if (fontDialog1.ShowDialog() == DialogResult.OK)
     {
         richtb.SelectionFont = fontDialog1.Font;
     }
 }
Exemple #10
0
        protected FontDialogBox()
        {
            execute =
                argument =>
            {
                Font font = null;
                if (font != null)
                {
                    font = new Font(fontDialog.Font.FontFamily, fontDialog.Font.Size, fontDialog.Font.Style);
                }
                else
                {
                    font = null;
                }

                FontDialogResult = fontDialog.ShowDialog();
                OnPropertyChanged("FontDialogResult");

                if (FontDialogResult.HasValue && (FontDialogResult.Value != null))
                {
                    Font = new Font(fontDialog.Font.FontFamily, fontDialog.Font.Size, fontDialog.Font.Style);
                    OnPropertyChanged("Font");
                    ExecuteCommand(CommandFontOK, CommandParameter);
                }
            };
        }
 private void fontMenuItem_Click(object sender, System.EventArgs e)
 {
     if (fontDialog.ShowDialog() != DialogResult.Cancel)
     {
         this.Font = fontDialog.Font;
     }
 }
 /// <summary>
 /// 选择(修改)字体
 /// </summary>
 /// <params name="sender"></params>
 /// <params name="e"></params>
 private void btnFont_Click(object sender, EventArgs e)
 {
     FontDialog pFontDialog = new FontDialog();
     pFontDialog.ShowDialog();
     if (pFontDialog.Font != null)
         m_pFont = pFontDialog.Font;
 }
        private void buttonChangeFont_Click( object sender, EventArgs e )
        {
            var dialog = new FontDialog()
                { AllowScriptChange  = true
                , AllowSimulations   = true
                , AllowVectorFonts   = true
                , AllowVerticalFonts = true
                , Font               = (LastGdiFont==null) ? Configuration.Main.GdiFont : LastGdiFont
                , FontMustExist      = true
                , ShowColor          = false
                };
            var result = dialog.ShowDialog(this);
            if ( result != DialogResult.OK ) return;
            var font = LastGdiFont = dialog.Font;

            Size touse = new Size(0,0);
            for ( char ch=(char)0 ; ch<(char)255 ; ++ch ) {
                if ( "\u0001 \t\n\r".Contains(ch) ) continue; // annoying outliers
                var m = TextRenderer.MeasureText( ch.ToString(), font, Size.Empty, TextFormatFlags.NoPadding );
                touse.Width  = Math.Max( touse.Width , m.Width  );
                touse.Height = Math.Max( touse.Height, m.Height );
            }

            var scf = ShinyConsole.Font.FromGdiFont( font, touse.Width, touse.Height );
            pictureBoxFontPreview.Image = scf.Bitmap;
        }
        public static DialogResult ShowFontDialog(WatermarkConfig Config)
        {
            DialogResult result = DialogResult.Cancel;
            try
            {
                var fDialog = new FontDialog
                {
                    ShowColor = true
                };
                try
                {
                    fDialog.Color = Config.WatermarkFontArgb;
                    fDialog.Font = Config.WatermarkFont;
                }
                catch (Exception err)
                {
                    DebugHelper.WriteException(err, "Error while initializing Font and Color");
                }

                result = fDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Config.WatermarkFont = fDialog.Font;
                    Config.WatermarkFontArgb = fDialog.Color;
                }
            }
            catch (Exception ex)
            {
                DebugHelper.WriteException(ex, "Error while setting Watermark Font");
            }
            return result;
        }
Exemple #15
0
        /// <summary>
        /// Edits the value
        /// </summary>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            this.value = value;
            if (provider != null)
            {
                IWindowsFormsEditorService service1 = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
                if (service1 != null)
                {
                    FontDialog fontDialog = new FontDialog();
                    fontDialog.ShowApply = false;
                    fontDialog.ShowColor = false;
                    fontDialog.AllowVerticalFonts = false;
                    fontDialog.AllowScriptChange = false;
                    fontDialog.FixedPitchOnly = true;
                    fontDialog.ShowEffects = false;
                    fontDialog.ShowHelp = false;

                    Font 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 btnFont_Click(object sender, System.EventArgs e)
 {
     if (fontDialog1.ShowDialog() == DialogResult.OK)
     {
         txtFont.Text = fontDialog1.Font.Name + ", " + fontDialog1.Font.Size.ToString() + "pt";
     }
 }
 private void btnFont_Click(object sender, System.EventArgs e)
 {
     if (fontDialog.ShowDialog() == DialogResult.OK)
     {
         this.txtBox.Font = fontDialog.Font;
     }
 }
Exemple #18
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     FontDialog dlg = new FontDialog();
     dlg.Font = UserFont;
     if (dlg.ShowDialog() == DialogResult.OK)
         UserFont = dlg.Font;
 }
Exemple #19
0
        private void fontBtn_Click(object sender, EventArgs e)
        {
            FontDialog fontDlg = new FontDialog();
            fontDlg.Font = textBox.Font;

            if (fontDlg.ShowDialog() == DialogResult.OK)
                textBox.Font = fontDlg.Font;
        }
Exemple #20
0
 private void ChangeFontButton_Click(object sender, EventArgs e)
 {
     var fd = new FontDialog { Font = LogMessageTextBox.Font };
     if (fd.ShowDialog() == DialogResult.OK)
     {
         LogMessageTextBox.Font = fd.Font;
     }
 }
Exemple #21
0
        private void tsButSetFont_Click(object sender, EventArgs e)
        {
            FontDialog fd = new FontDialog();
            fd.Font = this.txtSend.Font;
            if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                this.txtSend.Font = fd.Font;

        }
Exemple #22
0
 private void fontsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FontDialog FontSelect = new FontDialog(); //Font dialog
     if (FontSelect.ShowDialog() == DialogResult.OK)
     {
         rtfContent.Font = FontSelect.Font; //sets font
     }
 }
Exemple #23
0
 protected override void OnClick(EventArgs e)
 {
     var fod = new FontDialog();
     fod.Font = SelectedFont.CreateFont();
     if(fod.ShowDialog() == DialogResult.OK) {
         SelectedFont = FontDescription.FromFont(fod.Font);
     }
 }
Exemple #24
0
 private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (fontDlg.ShowDialog() != DialogResult.Cancel)
     {
         currFont = fontDlg.Font;
         Invalidate();
     }
 }
Exemple #25
0
 private void fontToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     FontDialog font = new FontDialog();
     font.Font = notepad_interface.SelectionFont;
     if (font.ShowDialog() == DialogResult.OK){
         notepad_interface.SelectionFont = font.Font;
     }
 }
Exemple #26
0
        private void changeFontToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FontDialog fd = new FontDialog();
            fd.Font = this.clockLabel.Font;
            fd.ShowDialog();

            this.clockLabel.Font = fd.Font;
        }
 private void button5_Click(object sender, EventArgs e)
 {
     FontDialog fd = new FontDialog();
     if (fd.ShowDialog() == DialogResult.OK)
     {
         this.Font = fd.Font;
     }
 }
Exemple #28
0
 private void changeFontMenuItem_Click(object sender, System.EventArgs e)
 {
     FontDialog dialog = new FontDialog();
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         this.Font = dialog.Font;
     }
 }
Exemple #29
0
 private void FontDisplay_DoubleClick(object sender, System.EventArgs e)
 {
     FontDialog.Font = FontDisplay.Font;
     if (FontDialog.ShowDialog() == DialogResult.OK)
     {
         FontDisplay.Font = FontDialog.Font;
     }
 }
 private void m_btFonte_Click(object sender, System.EventArgs e)
 {
     System.Windows.Forms.FontDialog dlgFonte = new System.Windows.Forms.FontDialog();
     try
     {
         dlgFonte.Font = m_fntFonte;
     }catch {
         dlgFonte.Font = new System.Drawing.Font("Arial", 12);
     }
     dlgFonte.Color     = m_clrTexto;
     dlgFonte.ShowColor = true;
     if (dlgFonte.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             m_fntFonte = dlgFonte.Font;
         }catch {
             dlgFonte.Font = new System.Drawing.Font("Arial", 12);
         }
         if (m_fntFonte.Size != System.Math.Ceiling(m_fntFonte.Size))
         {
             FontStyle fs = new FontStyle();
             if (m_fntFonte.Bold)
             {
                 fs = fs | FontStyle.Bold;
             }
             if (m_fntFonte.Italic)
             {
                 fs = fs | FontStyle.Italic;
             }
             if (m_fntFonte.Strikeout)
             {
                 fs = fs | FontStyle.Strikeout;
             }
             if (m_fntFonte.Underline)
             {
                 fs = fs | FontStyle.Underline;
             }
             try
             {
                 m_fntFonte = new System.Drawing.Font(m_fntFonte.FontFamily, (int)m_fntFonte.Size, fs);
             }catch {
                 m_fntFonte = new System.Drawing.Font("Arial", 12);
             }
         }
         m_clrTexto = dlgFonte.Color;
         try
         {
             m_lbFonte.Font = m_fntFonte;
         }catch {
             m_lbFonte.Font = new System.Drawing.Font("Arial", 12);
         }
         m_lbFonte.ForeColor       = m_clrTexto;
         m_lbTextoEdicao.Font      = m_fntFonte;
         m_lbTextoEdicao.ForeColor = m_clrTexto;
     }
     dlgFonte = null;
 }
 private void LabelGeneralFontVal_Click(object sender, EventArgs e)
 {
     FontDialog dialog = new FontDialog();
     dialog.Font = FrmSContainer.VirtualConfig.GenericFont;
     if (dialog.ShowDialog(this) == DialogResult.OK) {
         LabelGeneralFontVal.Font = FrmSContainer.VirtualConfig.GenericFont = dialog.Font;
         FrmSContainer.CompareConfig();
     }
 }
Exemple #32
0
        private void button3_Click(object sender, EventArgs e)
        {
            FontDialog fd = new FontDialog();
            if (fd.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.Font = fd.Font;

            }
        }
Exemple #33
0
 private void ChangeFont(Label label)
 {
     var dialog = new FontDialog();
     dialog.Font = label.Font;
     if (dialog.ShowDialog(this) == DialogResult.Cancel)
         return;
     label.Font = dialog.Font;
     label.Text = label.Font.FontFamily.Name;
 }
Exemple #34
0
 private void fontsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (fontDialog.ShowDialog() == DialogResult.Cancel)
     {
         return;
     }
     this.chart1.Series["Cars"].Font = fontDialog.Font;
     this.label1.Font = fontDialog.Font;
 }
 private void menuItem14_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.FontDialog f = new System.Windows.Forms.FontDialog();
     f.ShowEffects = true;
     f.ShowColor   = true;
     f.ShowDialog();
     txtmain.Font      = f.Font;
     txtmain.ForeColor = f.Color;
 }
Exemple #36
0
 public MyWinCtrl()
 {
     FontDialog dialog = new FontDialog();
       dialog.ShowDialog();
       Font = dialog.Font;
       ColorDialog colDialog = new ColorDialog();
       colDialog.ShowDialog();
       ForeColor = colDialog.Color;
 }
 private void comboBoxHeaderFont_Click(object sender, EventArgs e)
 {
     FontDialog fontDialog = new FontDialog();
     if (fontDialog.ShowDialog() == DialogResult.OK)
     {
         SetHeaderFontText(fontDialog.Font);
         pageSettings.HeaderFont = fontDialog.Font;
     }
 }
        private void fontButton_Click(object sender, EventArgs e)
        {
            FontDialog fontDialog = new FontDialog();

            if(fontDialog.ShowDialog()==DialogResult.OK)
            {
                displayLabel.Font = fontDialog.Font;
            }
        }
Exemple #39
0
        private void ButtonFontClick(object sender, EventArgs e)
        {
            FontDialog dlg = new FontDialog();
            dlg.Font = ColorSet.Font;
            if (dlg.ShowDialog(this) != DialogResult.OK)
                return;

            textBoxFont.Text = new FontConverter().ConvertToInvariantString(dlg.Font);
        }
Exemple #40
0
        private void changeFontToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FontDialog fo = new FontDialog();

            if (fo.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.Font = fo.Font;
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     FontDialog s = new FontDialog();
     if(s.ShowDialog()==DialogResult.OK)
     {
         this.button1.Text = s.Font.Name;
         global::AutoRender.Properties.Settings.Default.UserFont = this.Font = s.Font;
     }
 }
Exemple #42
0
 private void stmiFont_Click(object sender, EventArgs e)
 {
     FontDialog fDialog = new FontDialog();
     if (fDialog.ShowDialog()== DialogResult.OK)
     {
         Font font = fDialog.Font;
         DrawStr(font, "Строка выведена шрифтом " + font.Name);
     }
 }
 private void buttonFont_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.FontDialog dialog = new System.Windows.Forms.FontDialog();
     dialog.Font = labelDemo.Font;
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         labelDemo.Font = dialog.Font;
     }
 }
Exemple #44
0
 public static void SetFont()
 {
     FontDialog fd = new FontDialog();
     if(sysfont!=null)fd.Font = sysfont;
     if (fd.ShowDialog() == DialogResult.OK)
     {
         sysfont = fd.Font;
     }
 }
Exemple #45
0
 private void setFontMenuItem_Click(object sender, System.EventArgs e)
 {
     if (fontDialog.ShowDialog() == DialogResult.OK)
     {
         settings.Font = fontDialog.Font;
         SetFontInViews();
         SaveSettings();
     }
 }
Exemple #46
0
        private void btnFont_Click(object sender, System.EventArgs e)
        {
            if (fontDialog1.ShowDialog() != DialogResult.Cancel)
            {
                richTextBox1.SelectionColor = fontDialog1.Color;
                richTextBox1.SelectionFont  = fontDialog1.Font;

                updateFont();
            }
        }
        /// -----------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// -----------------------------------------------------------------------------------
        private void btnFont_Click(object sender, System.EventArgs e)
        {
            if (txtFont.Text != string.Empty)
            {
                fntDlg.Font = new Font(txtFont.Text.Trim(), 12);
            }

            if (fntDlg.ShowDialog(this) == DialogResult.OK)
            {
                txtFont.Text = fntDlg.Font.Name;
            }
        }
Exemple #48
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new WF.FontDialog()
            {
                Font = SelectedFont
            };

            if (WF.DialogResult.OK == dialog.ShowDialog())
            {
                SelectedFont = dialog.Font;
            }
        }
Exemple #49
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (fntdlg.ShowDialog() == DialogResult.OK)
     {
         this.Grid1.Font = fntdlg.Font;
         string       file = Application.StartupPath + "\\font.log";
         StreamWriter sw   = new StreamWriter(file, false, System.Text.Encoding.Unicode);
         sw.WriteLine(fntdlg.Font.Name);
         sw.WriteLine(fntdlg.Font.Size.ToString());
         sw.Close();
     }
 }
 private void bttnFont_Click(object sender, System.EventArgs e)
 {
     if (ctrlRtf.SelectionFont != null)
     {
         fontDialog1.Font = ctrlRtf.SelectionFont;
     }
     dlgResult = fontDialog1.ShowDialog();
     if (dlgResult == System.Windows.Forms.DialogResult.Cancel)
     {
         return;
     }
     ctrlRtf.SelectionFont = fontDialog1.Font;
 }
Exemple #51
0
        private void buttonFont_Click(object sender, System.EventArgs e)
        {
            Font fontText = new System.Drawing.Font(setFont, setSize, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            fontDialog1.Font = fontText;
            DialogResult ok = fontDialog1.ShowDialog();

            if (ok == DialogResult.OK)
            {
                setFont = fontDialog1.Font.FontFamily.Name;
                setSize = fontDialog1.Font.Size;
            }
        }
Exemple #52
0
        private void FontClick(object sender, RoutedEventArgs e)
        {
            var fd = new Forms.FontDialog();
            var dr = fd.ShowDialog();

            if (dr != Forms.DialogResult.Cancel)
            {
                this.TextBox.FontFamily = new System.Windows.Media.FontFamily(fd.Font.Name);
                this.TextBox.FontSize   = fd.Font.Size * 96.0 / 72.0;
                this.TextBox.FontWeight = fd.Font.Bold ? FontWeights.Bold : FontWeights.Regular;
                this.TextBox.FontStyle  = fd.Font.Italic ? FontStyles.Italic : FontStyles.Normal;
            }
        }
Exemple #53
0
 private void _TextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         var dialog = new WF.FontDialog()
         {
             Font = SelectedFont
         };
         if (WF.DialogResult.OK == dialog.ShowDialog())
         {
             SelectedFont = dialog.Font;
         }
     }
 }
Exemple #54
0
        public void ChangeFontSize(winForms.RichTextBox htmlTextBox, winForms.RichTextBox csstextBox, winForms.RichTextBox htmlTextBoxLine, winForms.RichTextBox csstextBoxLine)
        {
            System.Windows.Forms.FontDialog fDialog = new System.Windows.Forms.FontDialog();
            fDialog.MaxSize = 20;
            System.Windows.Forms.DialogResult res = fDialog.ShowDialog();
            if (res == System.Windows.Forms.DialogResult.OK)
            {
                htmlTextBox.Font     = fDialog.Font;
                htmlTextBoxLine.Font = fDialog.Font;

                csstextBox.Font     = fDialog.Font;
                csstextBoxLine.Font = fDialog.Font;
            }
        }
Exemple #55
0
        private void cmdChFont_Click(object sender, System.EventArgs e)
        {
            dlgFont.Font  = this.lblFont.Font;
            dlgFont.Color = this.lblFont.ForeColor;
            DialogResult result = dlgFont.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                return;
            }

            this.lblFont.Font     = dlgFont.Font;
            this.lblFont.Text     = dlgFont.Font.FontFamily.Name + ", " + dlgFont.Font.SizeInPoints.ToString() + "pt";
            this.he.HighlightFont = dlgFont.Font;
        }
Exemple #56
0
        private void btnKeypadFont_Click(object sender, System.EventArgs e)
        {
            fontDialog.Font = fontKeypad;
            DialogResult dr = fontDialog.ShowDialog(this);

            if (dr == DialogResult.OK)
            {
                try
                {
                    Font font = fontDialog.Font;
                    lblKeypadFont.Font = new Font(font.Name, 10f);
                    fontKeypad         = font;
                    lblKeypadFont.Text = font.Name + "; " + font.Size;
                }
                catch (ArgumentException xcp)
                {
                    string n = Environment.NewLine;
                    MessageBox.Show("Incompatible Font" + n
                                    + n + "Error details: " + n + xcp.Message
                                    , "Sorry for inconvenience"
                                    , MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #57
0
 /// <summary>
 /// 换字库
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnChgFont_Click(object sender, EventArgs e)
 {
     try
     {
         FontDialog fontDialog = new System.Windows.Forms.FontDialog();
         fontDialog.Font = this.txtCn.Font;
         if (fontDialog.ShowDialog() == DialogResult.OK)
         {
             this.txtCn.Font = fontDialog.Font;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #58
0
        /// <summary>
        /// フォントダイアログを開き、フォントの設定を行います。
        /// </summary>
        public static FontInfo ShowFontDialog(FontInfo defaultInfo)
        {
            var dialog = new System.Windows.Forms.FontDialog()
            {
                Font = ConvertFont(defaultInfo),
            };

            var result = dialog.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return(null);
            }

            return(ConvertFont(dialog.Font));
        }
        private void TextFontButton_Click(object sender, System.EventArgs e)
        {
            NLabel label = nChartControl1.Labels[0];

            TextDefaultFontDialog      = new FontDialog();
            TextDefaultFontDialog.Font = new Font(label.TextStyle.FontStyle.Name, label.TextStyle.FontStyle.EmSize.Value, label.TextStyle.FontStyle.Style);

            if (TextDefaultFontDialog.ShowDialog() == DialogResult.OK)
            {
                label.TextStyle.FontStyle.Name   = TextDefaultFontDialog.Font.Name;
                label.TextStyle.FontStyle.EmSize = new NLength(TextDefaultFontDialog.Font.SizeInPoints, NGraphicsUnit.Point);
                label.TextStyle.FontStyle.Style  = TextDefaultFontDialog.Font.Style;

                nChartControl1.Refresh();
            }
        }
Exemple #60
0
        private void btnWatermarkTextFontPicker_Click(object sender, RoutedEventArgs e)
        {
            FontDialog fd = new System.Windows.Forms.FontDialog();

            if (WatermarkTextFont != null)
            {
                fd.Font = WatermarkTextFont;
            }
            DialogResult dr = fd.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                //Apply your font name, size, styles, etc.
                WatermarkTextFont = fd.Font;
            }
        }