当前位置: 首页>>代码示例>>C#>>正文


C# FontDialog.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.FontDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# FontDialog.Dispose方法的具体用法?C# FontDialog.Dispose怎么用?C# FontDialog.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.FontDialog的用法示例。


在下文中一共展示了FontDialog.Dispose方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EditValue

        /// <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;
        }
开发者ID:normanzb,项目名称:mailtro,代码行数:38,代码来源:HexFontEditor.cs

示例2: EditValue

 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;
 }
开发者ID:JamesH001,项目名称:SX1231,代码行数:28,代码来源:HexFontEditor.cs

示例3: button_font_Click

        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();
        }
开发者ID:kikakubu-ksg,项目名称:N-layerJimaku,代码行数:39,代码来源:main.cs

示例4: btn_FontSelect_Click

 private void btn_FontSelect_Click(object sender, EventArgs e)
 {
     FontDialog fontdialog = new FontDialog();
     fontdialog.ShowColor = true;
     fontdialog.FontMustExist = true;
     fontdialog.Font = rtb_thread_main.Font;
     fontdialog.Color = rtb_thread_main.ForeColor;
     if (fontdialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
     {
         rtb_thread_main.Font = fontdialog.Font;
         rtb_thread_main.ForeColor = fontdialog.Color;
         if (!setFontDontSave)
         {
             FontSet.SaveUserFontStrig(fontdialog.Font.Name, fontdialog.Font.Size, FontSet.FontStyleString(fontdialog.Font), fontdialog.Color.Name);
         }
     }
     fontdialog.Dispose();
 }
开发者ID:MaiReo,项目名称:SimpleRobotDemo,代码行数:18,代码来源:frm_NewThread.cs

示例5: bFont_Click

        private void bFont_Click(object sender, System.EventArgs e)
        {
            FontDialog fd = new FontDialog();
            fd.ShowColor = true;

            // STYLE
            System.Drawing.FontStyle fs = 0;
            if (cbFontStyle.Text == "Italic")
                fs |= System.Drawing.FontStyle.Italic;

            if (cbTextDecoration.Text == "Underline")
                fs |= FontStyle.Underline;
            else if (cbTextDecoration.Text == "LineThrough")
                fs |= FontStyle.Strikeout;

            // WEIGHT
            switch (cbFontWeight.Text)
            {
                case "Bold":
                case "Bolder":
                case "500":
                case "600":
                case "700":
                case "800":
                case "900":
                    fs |= System.Drawing.FontStyle.Bold;
                    break;
                default:
                    break;
            }
            float size=10;
            size = DesignXmlDraw.GetSize(cbFontSize.Text);
            if (size <= 0)
            {
                size = DesignXmlDraw.GetSize(cbFontSize.Text+"pt");	// Try assuming pt
                if (size <= 0)	// still no good
                    size = 10;	// just set default value
            }
            Font drawFont = new Font(cbFontFamily.Text, size, fs);	// si.FontSize already in points

            fd.Font = drawFont;
            fd.Color =
                DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Black);
            try
            {
                DialogResult dr = fd.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    drawFont.Dispose();
                    return;
                }

                // Apply all the font info
                cbFontWeight.Text = fd.Font.Bold ? "Bold" : "Normal";
                cbFontStyle.Text = fd.Font.Italic ? "Italic" : "Normal";
                cbFontFamily.Text = fd.Font.FontFamily.Name;
                cbFontSize.Text = fd.Font.Size.ToString() + "pt";
                cbColor.Text = ColorTranslator.ToHtml(fd.Color);
                if (fd.Font.Underline)
                    this.cbTextDecoration.Text = "Underline";
                else if (fd.Font.Strikeout)
                    this.cbTextDecoration.Text = "LineThrough";
                else
                    this.cbTextDecoration.Text = "None";
                drawFont.Dispose();
            }
            finally
            {
                fd.Dispose();
            }
            return;
        }
开发者ID:bittercoder,项目名称:reportingcloud,代码行数:72,代码来源:FontCtl.cs

示例6: FontFormattingDialog

        /*
          Открывает диалоговое окно "Форматировани шрифта"
        */
        private DialogResult FontFormattingDialog()
        {
            FontDialog fontDialog = new FontDialog();
            fontDialog.AllowScriptChange = true;
            fontDialog.AllowSimulations = true;
            fontDialog.AllowVectorFonts = true;
            fontDialog.AllowVerticalFonts = true;
            fontDialog.FontMustExist = true;
            fontDialog.ShowEffects = true;
            fontDialog.ShowColor = true;

            if(!String.IsNullOrEmpty(this.richTextBox.SelectedRtf))
            {
                fontDialog.Font = this.richTextBox.SelectionFont;
                fontDialog.Color = this.richTextBox.SelectionColor;
            }
            else
            {
                fontDialog.Font = this.richTextBox.Font;
                fontDialog.Color = this.richTextBox.SelectionColor;
            }

            DialogResult dialogResult;
            dialogResult = fontDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK)
            {
                this.richTextBox.SelectionFont = fontDialog.Font;
                this.richTextBox.SelectionColor = fontDialog.Color;
            }

            fontDialog.Dispose();

            return dialogResult;
        }
开发者ID:CodeLookBook,项目名称:C-sharp,代码行数:37,代码来源:MainForm.cs

示例7: button1_Click

        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();
            */
        }
开发者ID:alannet,项目名称:example,代码行数:49,代码来源:Form1.cs

示例8: menuFont_Click

        private void menuFont_Click(object sender, EventArgs e)
        {
            FontDialog dialog = new FontDialog();
            dialog.Font = _fntCurrent;

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                _fntCurrent = dialog.Font;
                ArrangeWindow();
            }

            dialog.Dispose();
        }
开发者ID:LRih,项目名称:Auto-Type-EX,代码行数:13,代码来源:AutoTypeEX.cs

示例9: Pixiv_Button_Font_Click

        private void Pixiv_Button_Font_Click(object sender, EventArgs e)
        {
            // ダイアログを表示 //
            FontDialog fd = new FontDialog();

            fd.Font = nicoVideoFont;
            fd.MinSize = 5;
            fd.ShowEffects = false;

            if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                nicoVideoFont = fd.Font;
            }

            fd.Dispose();
        }
开发者ID:yuhki50,项目名称:MINTIA_Display,代码行数:16,代码来源:MainForm.cs

示例10: button1_Click

 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();
 }
开发者ID:nocmnt,项目名称:UVA-Arena,代码行数:15,代码来源:SettingsForm.cs

示例11: ChangeFonts

 private void ChangeFonts()
 {
     if (model == null){
         return;
     }
     FontDialog fontDialog = new FontDialog{ShowColor = true, Font = textFont, Color = textColor};
     if (fontDialog.ShowDialog() != DialogResult.Cancel){
         textFont = fontDialog.Font;
         textColor = fontDialog.Color;
         textBrush = new SolidBrush(textColor);
     }
     fontDialog.Dispose();
     Invalidate(true);
 }
开发者ID:neuhauser,项目名称:compbio-base,代码行数:14,代码来源:TableView.cs


注:本文中的System.Windows.Forms.FontDialog.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。