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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:19:48+00:00 2026-05-21T17:19:48+00:00

I want to select a UI control to be clicked and gray out the

  • 0

I want to select a UI control to be clicked and gray out the rest of the desktop screen semi-transparently. I was thinking bitmap painting the whole screen but it is very slow process. I guess someone out there know in WPF how to do that. I don’t have experiance in WPF. I wanted to do this on Windows 7.

  • 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-21T17:19:48+00:00Added an answer on May 21, 2026 at 5:19 pm

    Basically you want to show a top-level full screen transparent window which is not focusable and doesn’t respond to input. You can then use this window to draw the overlay manually. I think the easiest way would be to override OnRender on the Window and to draw a rectangle that fills the whole window but uses a clipping mask (via drawingContext.PushClip) to exclude the area you want to leave uncovered.

    EDIT:

    Here is an example:

    The Window should probably be set up like this:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            AllowsTransparency="True"
            WindowStyle="None"
            WindowState="Maximized"
            Topmost="False"
            Background="{x:Null}"
            IsHitTestVisible="False">
    </Window>
    

    The WindowStyle and WindowStatesettings will cause the window to be maximized and overlapping the task bar.
    Topmost set to true will cause the window to be on top of all other windows and IsHitTestVisible will cause the mouse clicks to ‘fall through’.

    Warning: If you set this you will be stuck with a topmost window that you can’t close since it doesn’t listen to keyboard commands. You will need to manually close the window somewhere in your code. Likely you want to create a global mouse hook to listen to mouse up and a keyboard hook to listen to ESC or something.

    To save people from themselves I have set TopMost to False in the above example. Only change it to true if you have figured out how/when to close the window in code somewhere.

    The Background is set to null so that you can use your custom drawing in code behind.

    the code behind similar to this:

    public MainWindow()
    {
        InitializeComponent();
    }
    
    protected override void OnRender(DrawingContext drawingContext)
    {
        base.OnRender(drawingContext);
        var screenGeometry = new RectangleGeometry(new Rect(0, 0, ActualWidth, ActualHeight));
        var excludeRectangle = new RectangleGeometry(new Rect(200, 200, 150, 150));
        drawingContext.PushClip(CombinedGeometry.Combine(screenGeometry,excludeRectangle, GeometryCombineMode.Exclude,null));
        drawingContext.PushOpacity(.8);
        drawingContext.DrawRectangle(Brushes.Black, null, new Rect(0, 0, ActualWidth, ActualHeight));
        drawingContext.Pop();
        drawingContext.Pop();
    }
    

    where you would use the proper location and size for the excludeRectangle.

    If you run this code you will see the screen grayed out except for a little rectangle in the top left.

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

Sidebar

Related Questions

So I like the custom multi select control that jquery-mobile has and want to
In my user control, there is a gridview. I want to select/unselect all checkboxs
I have a html select control. I want to have a item which is
I want to select the first option in a control so I write: $(#MySelect).val($(#MySelect
I made an accordion menu that replaces the select form control, and I want
i have users table and i have posts table i want select from users
i have this lists, and i want select li element from jquery when the
I want to select an element which was created by the CSS selector :before
I want to select the second <p> tag and style it within a itemize
I want to select the Resources that are used by the most users. The

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.