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

  • SEARCH
  • Home
  • 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 9205843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:03:29+00:00 2026-06-18T00:03:29+00:00

i want to create a semi transparent form for overlay effect. the form should

  • 0

i want to create a semi transparent form for overlay effect. the form should be see through.
this is the way i try to do it but it is not getting semi-transparent form. so please help me.

    Form mMask = new Form();
    mMask.FormBorderStyle = FormBorderStyle.None;
    mMask.BackColor = Color.DarkGray;
    mMask.Opacity = 0.10;
    mMask.Height = this.ClientRectangle.Height;
    mMask.Width = this.ClientRectangle.Width;
    mMask.Top = 0;
    mMask.Left = 0;
    mMask.Text = this.Text;
    mMask.AllowTransparency = true;
    mMask.ShowInTaskbar = false;
    mMask.StartPosition = FormStartPosition.Manual;
    mMask.TopLevel = false;
    this.Controls.Add(mMask);
    mMask.Show();
    mMask.BringToFront();

please guide me thanks.

i modify this routine and now it is as follow

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace dialog
{
    public class MaskedDialog : Form
    {
        static MaskedDialog mask;
        static Form frmContainer;

        private Form dialog;
        private UserControl ucDialog;

        private MaskedDialog(Form parent, Form dialog)
        {
            this.dialog = dialog;
            this.FormBorderStyle = FormBorderStyle.None;
            this.BackColor = System.Drawing.Color.Black;
            this.Opacity = 0.50;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.Manual;
            this.Size = parent.ClientSize;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            parent.Move += AdjustPosition;
            parent.SizeChanged += AdjustPosition;
        }

        private MaskedDialog(Form parent, UserControl ucDialog)
        {
            this.ucDialog = ucDialog;
            this.FormBorderStyle = FormBorderStyle.None;
            this.BackColor = System.Drawing.Color.Black;
            this.Opacity = 0.50;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.Manual;
            this.Size = parent.ClientSize;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            parent.Move += AdjustPosition;
            parent.SizeChanged += AdjustPosition;
        }

        private void AdjustPosition(object sender, EventArgs e)
        {
            Form parent = sender as Form;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            this.ClientSize = parent.ClientSize;
        }

        public static DialogResult ShowDialog(Form parent, Form dialog)
        {
            mask = new MaskedDialog(parent, dialog);
            dialog.StartPosition = FormStartPosition.CenterParent;
            mask.Show();
            DialogResult result = dialog.ShowDialog(mask);
            mask.Close();
            return result;
        }

        public static DialogResult ShowDialog(Form parent, UserControl dialog)
        {
            mask = new MaskedDialog(parent, dialog);
            frmContainer = new Form();
            frmContainer.ShowInTaskbar = false;
            frmContainer.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            frmContainer.StartPosition = FormStartPosition.CenterParent;
            frmContainer.Height = dialog.Height;
            frmContainer.Width = dialog.Width;

            frmContainer.Controls.Add(dialog);
            mask.Show();
            DialogResult result = frmContainer.ShowDialog(mask);
            frmContainer.Close();
            mask.Close();
            return result;
        }

        public static void CloseDialog()
        {
            if (frmContainer != null)
            {
                frmContainer.Close();
            }
        }
    } 
}

calling technique 1 with form

Form d = new Form();
d.Width = 400;
d.Height = 300;
MaskedDialog.ShowDialog(this, d);

calling technique 2 with form

UserControl1 uc = new UserControl1();
uc.CloseClicked += new UserControl1.CloseComplete(OnCloseClicked);
MaskedDialog.ShowDialog(this, uc);

void OnCloseClicked()
{
    MaskedDialog.CloseDialog();
}
  • 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-18T00:03:30+00:00Added an answer on June 18, 2026 at 12:03 am

    enter image description here

    void Main()
    {
        var f = new Form 
        {
            Width = 800,
            Height = 600
        };
        var d = new Form
        {
            Width = 400,
            Height = 300
        };
        var tb = new TextBox 
        { 
            Width = 250, 
            Height = 250, 
            Multiline = true, 
            Text = "Hello World", 
            Dock = DockStyle.Top 
        };
        var b = new Button
        {
            Text = "Display Masked Dialog",
            Dock = DockStyle.Top
        };
        b.Click += (s, e) => 
        {
            MaskedDialog.ShowDialog(f, d);
        };
        f.Controls.AddRange(new Control[] { tb, b } );
        Application.Run(f);
    }
    
    public class MaskedDialog : Form
    {
        private Form dialog;
        private MaskedDialog(Form parent, Form dialog)
        {
            this.dialog = dialog;
            this.FormBorderStyle = FormBorderStyle.None;
            this.BackColor = System.Drawing.Color.Black;
            this.Opacity = 0.50;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.Manual;
            this.Size = parent.ClientSize;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            parent.Move += AdjustPosition;
            parent.SizeChanged += AdjustPosition;
        }
        private void AdjustPosition(object sender, EventArgs e)
        {
            Form parent = sender as Form;
            this.Location = parent.PointToScreen(System.Drawing.Point.Empty);
            this.ClientSize = parent.ClientSize;
        }
        public static DialogResult ShowDialog(Form parent, Form dialog)
        {
            var mask = new MaskedDialog(parent, dialog);
            dialog.StartPosition = FormStartPosition.CenterParent;
            mask.Show();
            var result = dialog.ShowDialog(mask);
            mask.Close();
            return result;
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want to do is create a semi-transparent overlay over another program's window
I want to create a button style like expression blend buttons in this way:
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want create module which update list of usb devices automatically (not only mass
is it possible to draw a line semi-transparent with image magick? i want to
I want create a DataSet class which is basically a list of samples. But
I'm trying to create a semi-transparent demo screen that is launched only when a
I am running Octave 3.4.0 and want to create a transparent surface plot. However,
I've created a semi-transparent form (60% opacity with black background color) that my app
In my mobile project, I want to fill a rectangle with semi transparent color.

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.