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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:10:43+00:00 2026-05-25T06:10:43+00:00

Hi I was trying to get a transparent form like a glass which could

  • 0

Hi I was trying to get a transparent form like a glass which could enable clickthrough and every mouse event to pass to the windows or items behind the glass.

So this is the code I wrote with WindowForms:

namespace ClickThroughMe
{
public partial class ClickThroughForm : Form

{
    private int currentWindowStyle;

    public ClickThroughForm()

    {
        InitializeComponent();
    }

    private void ClickThroughForm_Load(object sender, EventArgs e)

    {
        // Grab the Extended Style information for this window and store it.

        currentWindowStyle = WindowLibrary.User32Wrappers.GetWindowLong(this.Handle, User32Wrappers.GWL.ExStyle);

        // Set our window to "transparent", or invisible to the mouse.

        SetFormToTransparent();

        // Make our window the top-most form.

        this.TopMost = true;       
    }

    private void SetFormToTransparent()

    {
        // This creates a new extended style for our window, making it transparent to the mouse.

        User32Wrappers.SetWindowLong(this.Handle, User32Wrappers.GWL.ExStyle,

                                    (User32Wrappers.WS_EX) currentWindowStyle | 

                                     User32Wrappers.WS_EX.Layered |

                                     User32Wrappers.WS_EX.Transparent);
    }
  }
}

The problem with this code is that whole window get transparent through opacity but controls such buttons or sliders do not retain clickability.

So I need help to make it better.

1)Retain controls Full Opacity (Not needed but important)

2)Retain controls Clickability and Operativity (MUST)

I accept any solution, even changing the project to WPF if this can help getting the result.

Thanks for you time.

  • 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-25T06:10:44+00:00Added an answer on May 25, 2026 at 6:10 am

    Try setting the Form.TransparencyKey Property of the ClickThroughForm to match the forms BackColor.

    I tested this when the ClickThroughForm was set to TopMost over another Form and I could fire Button events and the TrackBar control seemed to function correctly.

    Note: Using this method no mouse events can be captured by the ClickThroughForm due to its transparency, if this is a requirement then you can disregard this answer.

    ClickThroughForm Class

    public class ClickThroughForm : Form
    {
        private System.ComponentModel.IContainer components = null;
    
        public ClickThroughForm()
        {
            InitializeComponent();
        }
    
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // ClickThroughForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(300, 300);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "ClickThroughForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "ClickThroughForm";
    
            //Set the TransparencyKey to match the default BackColor of the Form
            this.TransparencyKey = System.Drawing.SystemColors.Control;
    
            this.ResumeLayout(false);
    
        }
    
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
    }
    

    Hope this helps you.

    I notice you are a new user, If this or any other questions you ask on the site provide the answers you are looking for, remember to accept the answers.

    See the following for more information: How does accepting an answer work?

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

Sidebar

Related Questions

So i am trying get 2 div-containers which both should contain centered text (Both
I'm trying to get a transparent png frame image to hover over an img
I'm trying to get the background of my splash screen to be opaque/transparent. I
Im trying to get two alpha-24 transparent .png files to crossfade into each other.
I am trying to get a transparent window with GTK+ 3.x. AFAIK the following
I wanted to make my windows form transparent so removed the borders, controls and
I'm trying to get the chart's gridlines to be transparent but it doesn't seem
I've been trying to get transparency to work with my application (which dynamically resizes
I am trying to get this transparent background to work. When the nav drops
I'm trying to do a custom button to my form (which has FormBorderStyle =

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.