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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:46:37+00:00 2026-05-22T18:46:37+00:00

In my project, I use the WS_EX_TRANSPARENT flag to define dynamically whether the translucent

  • 0

In my project, I use the WS_EX_TRANSPARENT flag to define dynamically whether the translucent form should recieve the users mouse events.

To make it more intuitive, I have added code to disable all the visible controls when WS_EX_TRANSPARENT is enabled, however, when this code is called, it appears to ‘lock out’ my OnMouseWheel override.

Below is my code. I should point out that this code works fine if I comment out the ‘EnableGUIControls’ method – in fact, if I comment out any line inside the ‘EnableGUIControls’ method it works perfectly – so its something to do with disabling all of the controls.

Removing focus from the form and reactivating it resolves the issue, but a manual call to Form.Activte() does not.

I am thinking along the lines of disabling all the visible controls disables the parent in some way? Does anyone have any idea what is happening?

        private void SetTransparentToMouse(bool should_be_transparent)
    {
        IntPtr flags = GetWindowLong(this.Handle, GWL_EXSTYLE);

        if (((flags.ToInt64() & WS_EX_TRANSPARENT.ToInt64()) > 0) == should_be_transparent)
        {
            return;
        }
        else
        {
            SwapTransparent();
            EnableGUIControls(!should_be_transparent);
        }
    }

    private void SwapTransparent()
    {
        IntPtr flags = new IntPtr(GetWindowLong(this.Handle, GWL_EXSTYLE).ToInt64() ^ WS_EX_TRANSPARENT.ToInt64());
        SetWindowLong(this.Handle, GWL_EXSTYLE, flags);
    }

            protected override void OnKeyUp(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            SetTransparentToMouse(default_mouse_transparency);
        }

        base.OnKeyUp(e);
    }

            protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
    {
        if (e.Alt)
        {
            SetTransparentToMouse(!default_mouse_transparency);
        }

        base.OnKeyDown(e);
    }

    //Commenting out the call to this, or any line within this resolves the problem!:
        void EnableGUIControls(bool enabled)
    {
        this.Button_Opacity.Enabled = enabled;
        this.Button_Close.Enabled = enabled;
        this.Button_Minimize.Enabled = enabled;
        this.Button_Open.Enabled = enabled;
        this.Button_Pan.Enabled = enabled;
        this.Button_Sizemode.Enabled = enabled;
        this.Button_Zoom.Enabled = enabled;
    }
  • 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-22T18:46:38+00:00Added an answer on May 22, 2026 at 6:46 pm

    When all controls are disabled, there is no focussed control left that catches and redirects the mouse messages to the Form. Try Form.Focus() instead of Form.Activate().

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

Sidebar

Related Questions

I'm still trying to decide whether my (home) project should use UTF-8 strings (implemented
I'm looking for a python project to use as example to copy the design
I have been looking into IKVMing Apache's FOP project to use with our .NET
I am writing my first project that will use autoconf and teaching it to
I have a handful of projects that all use one project for the data
I have a Visual Studio Setup Project that I use to install a fairly
I am working on an Actionscript 2 project - trying to use the XML
I've noticed that plenty of opensource project doesn't use BITWISE flags anymore, even if
I'm trying to build up a library of reusable code to use from project
I use svn for a project im working on with a couple of other

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.