Results 1 to 6 of 6

Thread: BitBlt from picturebox

  1. #1

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I want to BitBlt the graphic thats in the picture property of a picturebox to another dc. The problem that I have is that when I use the hDc property of the picturebox for this, the graphic is only blitted correctly when my app is in the foreground. If another window covers the picturebox, the other window is blitted (the part that covers the picturebox).

    Does anyone know a solution for this?

  2. #2
    Junior Member
    Join Date
    Dec 1999
    Posts
    25

    Cool image

    i might be able to help if i knew what u meant by blitted with an image.
    Jim.

    us_baldeagle@yahoo.com

  3. #3

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I use the BitBlt API to copy the graphic in a picturebox to a device context I created in memory. The purpose is that I want to save the graphic in memory, so the picturebox can be used to hold another graphic. When the user wants to see the graphic in memory again, I use BitBlt again to copy it back to the picturebox. Using the BitBlt (bitblock transfer) API is also known as blitting.
    Now back to the problem.
    BitBlt needs two DC's (device context's), one for the source, and one for the destination. For the source DC I used the picturebox's hDC property. This works great unless the picturebox is (partly) covered by another window. Instead of saving the graphic in the Picture property, I save the actual situation on the screen (partly covered).

    So if you can help me with this, i would be greatfull.

  4. #4

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Never mind, I figured it out.

  5. #5
    Junior Member
    Join Date
    Dec 1999
    Posts
    25

    Cool image problems

    as an alternative have u considered just adding another picturebox to the form exactly where the current one is. give them different names and make the needed one visible and the other one invisible. you can just switch between them like that. it will also give u the ablity to refresh the picture if need be. i wish i could help you more but i have not gone through the api tutorial yet. please tell me if this helps.
    Jim.

    us_baldeagle@yahoo.com

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Turn autoredraw on, on the source picturebox
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width