Solved

General BitBlt question in VB

Posted on 2004-04-06
10
230 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 50

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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…

813 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