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 7873551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:32:54+00:00 2026-06-03T02:32:54+00:00

When opening Dialog form using Form.ShowDialog() I want to dim the rest of application

  • 0

When opening Dialog form using Form.ShowDialog() I want to dim the rest of application with a shade of gray.

From my own research it seems that the way to do it is to open a borderless form with black background and opacity less than 100% but I haven’t put all the pieces together how it would work or if it’s the best way to do it.

Any suggestions would be helpful.
Thanks.

  • 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-06-03T02:32:55+00:00Added an answer on June 3, 2026 at 2:32 am

    This is best done by overlaying the open forms with another form that’s borderless and the same size. This allows you do make the entire form look disabled, including the controls and the title bar. Add a new class to your project and paste this code:

    using System;
    using System.Drawing;
    using System.Collections.Generic;
    using System.Windows.Forms;
    
    class DialogOverlay : IDisposable {
        public DialogOverlay() {
            var cnt = Application.OpenForms.Count;
            for (int ix = 0; ix < cnt; ++ix) {
                var form = Application.OpenForms[ix];
                var overlay = new Form { Location = form.Location, Size = form.Size, FormBorderStyle = FormBorderStyle.None,
                    ShowInTaskbar = false, StartPosition = FormStartPosition.Manual, AutoScaleMode = AutoScaleMode.None };
                overlay.Opacity = 0.3;
                overlay.BackColor = Color.Gray;
                overlay.Show(form);
                forms.Add(overlay);
            }
        }
        public void Dispose() {
            foreach (var form in forms) form.Close();
        }
        private List<Form> forms = new List<Form>();
    }
    

    And use it like this:

        private void DialogButton_Click(object sender, EventArgs e) {
            using (new DialogOverlay()) 
            using (var dlg = new Dialog()) {
                if (dlg.ShowDialog(this) == DialogResult.OK) {
                    // etc...
                }
            }
        }
    

    Tweak the Opacity and BackColor properties to adjust the effect. It will work with any kind of dialog, including the built-in ones like OpenFileDialog, and any set of open forms in your application. Beware that Application.OpenForms is a wee bit buggy.

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

Sidebar

Related Questions

I am using jQuery's modal dialog for opening a dialog containing a form. What
Im opening a form via ajax (using jquery) and i want to save it
I have a MVC, ASP.Net application and I want to create a dialog form.I
I have JQuery UI Dialog opening on pressing CTRL + Q using the following
I am wondering how I can go about stopping a dialog from opening if
I did a cocoa application in which the file dialog box is opening when
Opening an application( probably an .exe file) as an administrator in headless mode from
I have a CustomInstaller class (System.Configuration.Install.Installer) and basically I'm opening a dialog form at
Hi i have this form opening with window's dialog: <form method=GET id=formparam> <table><tbody><tr><td> <label>ID</label></td>
I want to show a popup screen on my page using JQuery UI Dialog

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.