Solved

General BitBlt question in VB

Posted on 2004-04-06
10
228 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 49

Expert Comment

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

like:

Picture2.AutoRedraw = True
0
 
LVL 4

Expert Comment

by:AndyAmess
Comment Utility
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
Comment Utility
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
 
LVL 4

Expert Comment

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

Frank
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:patricksd
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed - no points refunded (of 500)

modulo
Community Support Moderator
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now