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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:08:25+00:00 2026-05-11T11:08:25+00:00

Using C# and .Net 2.0, I’m using an irregularly shaped form (TransparencyKey, FormBorderStyle =

  • 0

Using C# and .Net 2.0, I’m using an irregularly shaped form (TransparencyKey, FormBorderStyle = None, etc…) and want to allow ‘normal’ bordered mode.

I change the back colour to default from Lime I change FormBorderStyle to FixedSingle I change the TransparencyKey to Colour.None

Unfortuanately this looks a complete mess on screen with the image jumping a few pixels down and to the side and Lime green form.

I think this is caused by the form being redrawn after each line of code, is it possible to suspend drawing the form until I have made my changes and then just redraw the form once?

G

  • 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. 2026-05-11T11:08:25+00:00Added an answer on May 11, 2026 at 11:08 am

    NEW answer: Override the WndProc and block the WM_PAINT message while you apply the new Window properties.

    OLD answer: Override the WndProc, and block the WM_ERASEBKGND message.

    Explanation of what the code below does:

    When a window’s region is invalidated, Windows sends a series of messages to the control that result in a freshly-painted widget. An early message in this series is WM_ERASEBKGND. Normally, in response to this message, the control paints itself a solid color. Later, in response to the WM_PAINT message (which is usually consumed by us in the OnPaint event) the actual drawing is done. If this drawing is non-trivial there will be a delay before the widget is updated and you’ll get an annoying flicker.

    Looking at your code again I was clearly solving a different problem. Try this new example. It will block the painting of the form/control if the bAllowPaint flag is unset.

    The NEW example:

        private const int WM_PAINT = 0x000F;      protected override void WndProc(ref Message m)     {         if ((m.Msg != WM_PAINT) ||             (bAllowPaint && m.Msg == WM_PAINT))         {             base.WndProc(ref m);         }     } 

    The OLD example:

        private const int WM_ERASEBKGND = 0x0014;      protected override void WndProc(ref Message m)     {         if (m.Msg != WM_ERASEBKGND) // ignore WM_ERASEBKGND         {             base.WndProc(ref m);         }     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I see SessionGUID and SessionVisitId, why have both a uniqueidentifier… May 11, 2026 at 8:30 pm
  • Editorial Team
    Editorial Team added an answer See Lazy Error Handling in Java for an overview of… May 11, 2026 at 8:30 pm
  • Editorial Team
    Editorial Team added an answer I'd create A and B as views over a single… May 11, 2026 at 8:30 pm

Related Questions

Using C# and .Net 2.0, I'm using an irregularly shaped form (TransparencyKey, FormBorderStyle =
We have a fairly complicated GUI in windows forms using C# and .Net 2.0.
In a C# windows forms application. I have a splash screen with some multi-threaded
I currently have a class and I'm trying to create an easy GUI to
I have a web page that is being displaying in a winform app using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.