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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:18:34+00:00 2026-06-17T18:18:34+00:00

Is it possible to create a big white rectangle on the screen, without using

  • 0

Is it possible to create a big white rectangle on the screen, without using a Forms Application?

It should cover the whole screen if possible.
I know I have to use the System.Drawing and tried several steps, but none have actually printed anything to my screen!

  • 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-17T18:18:36+00:00Added an answer on June 17, 2026 at 6:18 pm

    Method 1: Call the Windows API

    You need System.Drawing and System.Runtime.InteropServices. You may need to add project references to them.

    using System.Runtime.InteropServices;
    using System.Drawing;
    

    Add the methods to your class with P/Invoke

    [DllImport("User32.dll")]
    public static extern IntPtr GetDC(IntPtr hwnd);
    [DllImport("User32.dll")]
    public static extern void ReleaseDC(IntPtr hwnd, IntPtr dc);
    

    Get a Graphics object for the entire screen and draw a rectangle with it:

    IntPtr desktopPtr = GetDC(IntPtr.Zero);
    Graphics g = Graphics.FromHdc(desktopPtr);
    
    SolidBrush b = new SolidBrush(Color.White);
    g.FillRectangle(b, new Rectangle(0, 0, 1920, 1080));
    
    g.Dispose();
    ReleaseDC(IntPtr.Zero, desktopPtr);
    

    The problem with this method is that if the screen refreshes at all, the rectangle will be overwritten, making it useless for most practical applications.

    Method 2: Create a borderless form

    As before, you need a project reference. This time to System.Windows.Forms. You’ll also need System.Drawing again:

    using System.Drawing;
    using System.Windows.Forms;
    

    Make the new form, remove its borders, fill the screen with it, and put it on top of the taskbar:

    Form f = new Form();
    f.BackColor = Color.White;
    f.FormBorderStyle = FormBorderStyle.None;
    f.Bounds = Screen.PrimaryScreen.Bounds;
    f.TopMost = true;
    
    Application.EnableVisualStyles();
    Application.Run(f);
    

    A possible issue with this is that the user can just alt+tab away from the window. If you want to do any more complicated graphics, you’ll need to write some drawing code like this. To make the form background transparent, set its TransparentKey to the same as its Backolor.

    I’ve just tested both of these in .NET 4.5 and Windows 7, so it may be different for earlier versions. More information here and here.

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

Sidebar

Related Questions

Is it possible to create a big application (like 10 pages) as an extension?
Hi it'd like to know if it's at all possible create a parametric equalizer
Possible Duplicate: Create provisioning profile in iphone application i developed my iphone app and
Possible Duplicate: Create an Array of the Last 30 Days Using PHP I am
Possible Duplicate: Create an alert on any view controller after Facebook request:didFailWithError: I have
is it possible to create a custom NaN value in Python? I know a
I've got a big problem with encoding. The code I'm using should work but
Is it possible to create an .npy file without allocating the corresponding array in
Is possible create an extension for SQL Management Studio in Visual Studio 2010? Visual
Possible Duplicate: Create event handler for OnScroll for web browser control I would like

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.