Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

General BitBlt question in VB

Posted on 2004-04-06
10
Medium Priority
?
245 Views
Last Modified: 2012-06-21
I have been experimenting with the BitBlt command in VB and can't seem to get the results that I want. What I want to do is load a picture in one picturebox and copy it over to another picturebox utilizing stretch or transparent modes. I can get this to work ONLY if both pictureboxes are visible on the screen, which is not what I want. I want the source hidden either not visible or off the screen. How can I get this to work? As a side note, I am using eVB which has very limited picturebox commands. It does not support LoadPicture which I know is an alternate way of getting what I want in VB6.

Can someone explain why the source picturebox must be visible on the screen for BitBlt to work? I thought it was just copying a memory map from one object to another, so why does it have to be visible? Does anyone have a solution for what I want?
0
Comment
Question by:patricksd
10 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 10768149
Try set the target picturebox's AutoRedraw Property to True?

like:

Picture2.AutoRedraw = True
0
 
LVL 4

Expert Comment

by:AndyAmess
ID: 10768210
I had a few problems with eVB and picture box so I switched to this freeware control and find it much better. It also has ability to use other formats and is much more fun to use.

http://www.yetanotherhomepage.com/j7xx/j7xx.html?/j7xx/software/prog/s309pict.html

A. ;-)
0
 

Author Comment

by:patricksd
ID: 10768547
Regarding Autoredraw, eVB does not support that feature. I had already tried the S309 control but found it to be too slow for loading many transparent .gifs  at a large screen resolution. Somehow the transparency bogs it down. Using the API TransparentImage seems to work much faster, but the problem is the source picturebox must be visible on the screen for it to work. Plus it seems that when another event happens, the destination picturebox loses the changes. So either way, I am not happy with BitBlt that everyone recommends using, unless I am using it wrong. If anything, I want to understand what is going on.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:frankd
ID: 10768713
Just a suggestion, try setting the zorder such that both picture box's are visible but one is behind the other.

Frank
0
 

Author Comment

by:patricksd
ID: 10769301
Zorder doesn't help. It appears to rely on the screen image for data as opposed to the data stored in the picturebox. Perhaps they are one in the same?
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 10781097
Set Picture2.Picture = Picture1.Picture

Does eVB atleast support that? :-)

Concerning copying DCs of hidden windows..
http://www.fengyuan.com/article/wmprint.html
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 10781116
To comment on what I mentioned about (Set Picture2.Picture = Picture1.Picture)..

If the above works, you'll have the hidden picture in the visible PictureBox. Then you may be able to use that as a source and destination for BitBlt. If not, you can try creating a memory-dc, applying the stretch/transparency to that, then bitblt'ing it back to the visible portion.

Additionally, check out: http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20944169.html

You can possibly use the same method in the above to get the bits of the picture, modify them and then repaint them to the destination picturebox.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11441252
PAQed - no points refunded (of 500)

modulo
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question