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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:28:53+00:00 2026-05-28T06:28:53+00:00

I wish to off-screen render a Control to some bitmap so that I have

  • 0

I wish to off-screen render a Control to some bitmap so that I have quick access to it.

Unfortunately Control.DrawToBitmap seems to draw the entire control on which it is called including all it’s child controls. Internally it issues a WM_PRINT message with self-provided DC to a bitmap. This temporary bitmap is then blitted to the user-provided Bitmap. Unacceptable for me, I’d rather have this bitmap updated as needed so my performance hit when the bitmap is needed is minimized.

In the ideal scenario I’d want the form to behave as if it were visible on the screen (but it cannot be). That would mean that if, say, some Control has its Text property changed, the form would be partially invalidated. Catching the relevant messages/events would then allow me to either specify my own DC for the form to be drawn on, or to simply BitBlt the forms DC to my own.

Some directions I have looked in:

  • The PaintEventArgs parameter in OnPaint seems to hold a member savedGraphicsState, perhaps it could be used to figure out what doesn’t require invalidating
  • Having the form visible but outside the screen area. Controls then don’t get painted, though.
  • Manually calling RedrawWindow() on the window, same story
  • 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-28T06:28:53+00:00Added an answer on May 28, 2026 at 6:28 am

    I think there are two problems:

    1. finding out the invalid area of the control (without help from windows)
    2. rendering only the invalidated portion.

    For the first issue, I think you are largely on your own. You should keep track which controls change, and have bookkeeping which need updating.

    For the second issue, you can try to send the WM_PRINT message yourself, and provide a DC referring to only a small bitmap. The original DC API’s allowed you to offset and clip the valid drawing area of a HDC.
    If you are very lucky, windows will deduce the render region from the HDC, and if it does not, most of the render commands that fall entirely out of the bitmap should be quite cheap as there are no pixels that need to change.

    You should be able to verify this by printing to a 1×1 bitmap and test if it is faster, and/or verify if the clip region sent in WM_PAINT is reduced to the bitmap size.

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

Sidebar

Related Questions

I have a large database of XHTML that I wish to render as PDFs
I have two strings such as: sometext~somemoretext~extratext and sometext~otherextratext I wish to crop off
I have CPU bound application that I wish to speedup using multiprocessing+threading instead of
Let me start off by describing my situation. I have a main view that
I have a textfield in a grid in which I wish to turn off
I am basically completely thrown off and think I may have some conflicting JavaScript,
I wish Subversion had a better way of moving tags. The only way that
I wish to implement my software on a shareware basis, so that the user
I wish to test a function that will generate lorem ipsum text, but it
I wish to use a join across some tables but am having some difficulty

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.