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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:58:17+00:00 2026-06-13T19:58:17+00:00

The Layout: I’m using third party controls to scan documents. I have an event

  • 0

The Layout:

I’m using third party controls to scan documents. I have an event that occurs when I scan an image (mostly used to add annotations the image). The event provides me with only one property named .PAhDC. This property is a handle to the DC that stores the image before it is written to a file. Thus I can make changes to the image before it gets written to a file.

The Expected Results:

I would like to simply add a 1/4 inch (lets say 100 pixels) of white space line on the very top of the image. If my original image is 200×200 (WxH) then my new final image would need to be 200×300.

Question And Other Thoughts:

How can I alter an existing image with only knowing it’s DC handle? I was thinking of doing something like the following…

  1. Create a new DC.
  2. Create a new Bitmap 100 pixels taller than the original image.
  3. Use that new bitmap in the new DC.
  4. Copy the original image to the new bitmap (100 pixels from the top as a start point).
  5. Then use something like SelectObject to replace the old bitmap in the original hDC with the new one and then destroy the old bitmap object.

Note: I would like to do this with MANAGED CODE as much as possible. Using SelectObject() was the only way I could think of but it’s of course unmanaged code… :/

  • 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-13T19:58:18+00:00Added an answer on June 13, 2026 at 7:58 pm

    You can’t without cooperation with the owner of the bitmap and DC.

    The DeviceContext is purely a viewport onto an underlying DIB/bitmap and has no concept of size or dimensions (beyond the clipping region) While you can create a new bitmap and select it into the DC, it’s highly likely that the application will just ignore what you’ve done and use the DIB that it has created.
    The end result of this will be GDI object leaks and no change to the underlying image.

    To do what you you ask, you will need full cooperation with the other code and them adding a method that allows you to replace the underlying data.

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

Sidebar

Related Questions

The layout... I have a UIToolbar that loads a view with several buttons. One
We layout dialogs using the resource editor. So say I have a RichEditCtrl called
What java GUI layout manager does everyone use? Lately, I have been using MigLayout
Most layout managers have no-argument constructors (that is, you can create a FlowLayout with
In layout xml file, I set properties using @string like this: <com.hardpass.MyCustomComponent android:layout_width=fill_parent android:layout_height=wrap_content
I have a card layout set in my app.js. here's the code; ... launch:
My layout have ImageView(iv) and TextView(tv). I want to let the tv right of
The layout I'm trying to achieve is shown in this image: The HTML below
I've got this layout that i want to cut into html/css, but i'm struggling
My layout.xml consists of a FrameLayout with a few TextViews and Buttons, that I

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.