Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 906149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:20:20+00:00 2026-05-15T16:20:20+00:00

Is it possible to display the WinForms font picker dialog non-modally? Or is there

  • 0

Is it possible to display the WinForms “font picker” dialog non-modally? Or is there another font picker other than the standard one that can be used non-modally?

Our application has many windows, and users who frequently need to interrupt what they are doing and switch to another window to look at something. If they use a taskbar button to switch windows, this tends to lead to “buried dialog” scenarios with modal dialogs, where the UI is unresponsive, but it isn’t immediately apparent why, because the modal dialog that has captured the focus is behind another window.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:20:21+00:00Added an answer on May 15, 2026 at 4:20 pm

    The key feature of the behavior of FontDialog here is not the parent (owner) relationship, but fact that you can only use it by calling ShowDialog, and there is no apparent way to do that without blocking the GUI thread.

    Fortunately, there is a way around that problem. I used a BackgroundWorker to shunt the call to ShowDialog onto a worker thread, allowing the GUI thread to proceed. The async FontDialog wrapper class looks like this:

    public class FontDialogAsync
    {
        public event EventHandler<NewFontChosenEventArgs> NewFontChosen;
    
        private readonly IWin32Window parentHandle;
        private readonly BackgroundWorker fontDialogWorker = new BackgroundWorker();
    
        private class WindowWrapper : IWin32Window
        {
            public WindowWrapper(IntPtr hWnd)
            {
                Handle = hWnd;
            }
    
            public IntPtr Handle { get; private set; }
        }
    
        public FontDialogAsync(IWin32Window parent)
        {
            parentHandle = new WindowWrapper(parent.Handle);
            fontDialogWorker.DoWork += FontDialogWorkerDoWork;
            fontDialogWorker.RunWorkerCompleted += FontDialogWorkerRunWorkerCompleted;
        }
    
        private class FontDialogAsyncArgs
        {
            public readonly IWin32Window ParentForm;
            public readonly Font InitialFont;
    
            public FontDialogAsyncArgs(IWin32Window parent, Font initFont)
            {
                ParentForm = parent;
                InitialFont = initFont;
            }
        }
    
        public void Show(Font font)
        {
            if (!fontDialogWorker.IsBusy) fontDialogWorker.RunWorkerAsync(new FontDialogAsyncArgs(parentHandle, font));
        }
    
        private static void FontDialogWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                var args = (FontDialogAsyncArgs)e.Argument;
                var fontDialog = new FontDialog { Font = args.InitialFont };
                var result = fontDialog.ShowDialog(args.ParentForm);
                e.Result = (result == DialogResult.Cancel) ? null : fontDialog.Font;
            }
            catch (Exception ex)
            {
                UtilitiesAndConstants.ReportExceptionToCommonLog(ex);
            }
        }
    
        private void FontDialogWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e1)
        {
            if (e1.Result == null) return;
            if (NewFontChosen != null) NewFontChosen(this, new NewFontChosenEventArgs((Font)e1.Result));
        }
    }
    

    [Note that you need to hide the parent window handle inside the WindowWrapper instance to keep the runtime from raising a cross-thread exception.]

    The EventArgs class looks like this:

    public class NewFontChosenEventArgs : EventArgs
    {
        public readonly Font FontChosen;
        public NewFontChosenEventArgs(Font newFont)
        {
            FontChosen = newFont;
        }
    }
    

    …and you use it like this:

        private FontDialogAsync nonBlockingFontDialog;
        public void SetFont() 
        {
            if (nonBlockingFontDialog == null) 
            {
                nonBlockingFontDialog = new FontDialogAsync(ParentForm);
                nonBlockingFontDialog.NewFontChosen += NonBlockingFontDialogNewFontChosen;
            }
            nonBlockingFontDialog.Show(Font);
        }
    

    Where ParentForm is the Windows.Form instance to which you want to tie the dialog. The resulting dialog will be modal with respect to the parent (i.e. you will not be able to do anything with the parent without first dismissing the dialog), but the rest of the appliation’s UI will work normally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to display something other than the definition name in the variables
Is it possible to display more than one image in a column in DataGridViewImageColumn?
Is it possible to display a view from another controller? Say for example I
Is it possible to display an html link inside a multi select box that
Is it possible to display errors and repopulate fields on a form that is
Is there a way to host/display a full WinForms form (not just a single
It's possible to display parametres as a folders (order counts). How to do that?
is it possible display a 'x' for an html checkbox when we click on
is it possible to display ⇓ entity in ie6? It is being display in
Is it possible to display superscripted characters (not only numbers) in the alert() ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.