?
Solved

Problem with bitblt

Posted on 1999-11-13
7
Medium Priority
?
276 Views
Last Modified: 2008-03-04
I have a form with PicBoxA in side FrameA and PicBoxB in PicBoxC and i am trying to copy PicBoxB to PicBoxA. but when i try vb gives me the error.
Can't create autoredraw image.
if i turn autoredraw off on PicBoxA and PicBoxB it works but i want autoredraw on.

Form setup
//===================================\\
||                         Main Form                              ||
||  /-------------------------\            //===========\\   ||
||  |    FrameA          |            || PicBoxC         ||   ||
||  |   ****************  |            || ****************  ||   ||
||  |  * PicBoxA     *  |            || * PicBoxB    * ||   ||
||  |  *****************  |            || **************** ||   ||
||  \-------------------------/            \\===========//  ||
\\==================================//
This probly wont look right but i hope you see what i mean.
I am trying to copy PicBoxB to PicBoxA

0
Comment
Question by:centaurs
  • 3
  • 3
7 Comments
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2205631
What if you set AutoRedraw to false just before the BitBlt line? and then set AutoRedraw back to true when done..
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2205638
If PicBoxB is contained in PicBoxC, try making PicBoxB's container the form, then position it over PicBoxC.

The only reference to this error (480) that I could find from MS relates only to VB3 and VB4.
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2205656
This error may also be the result of low system memory.  By setting the autoredraw property true, the system makes a memory image of the object's surface. If you have large images, or a lot of images, your memory resources will be depleted.

Try closing unneeded applications before you run the program.  Also try compiling into an EXE and run the program with VB closed.

This is a trappable error, so you can use On Error to trap it before the program crashes.  This way, the user knows there is not enough memory. (If this is really the problem).
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:centaurs
ID: 2206014
Thanks every one ill try some of these ideas shortly.
Erick37
both images are very big so there is a good chance that that is the problem.
and i cant just put it over it because it needs to be scrolable because both Pic A & B about 16000 pixels wide and high. I guess i just make it smaller and  hopefuly it will work other wise ill try VBMasters idea.
0
 

Author Comment

by:centaurs
ID: 2206046
Erick 37 it worked now if you want your points just answer the question.
Thanx's
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 1600 total points
ID: 2206095
OK
If you have preloaded a picture into the PictureBox's .Picture property, you can clear the image when you are done with blitting by calling
Picture1.Picture = LoadPicture("").
This will also free some memory resources.

Also, if you turn off the Autoredraw property, you can use the PictureBox's Paint event to keep the image refreshed.  This will prevent the second image from having to be stored in memory:

e.g.

Private Sub Picture1_Paint()
    BitBlt Picture1.hDC, 0, 0, 300, 300, _
           Picture2.hDC, 0, 0, vbSrcCopy
End Sub
0
 

Author Comment

by:centaurs
ID: 2207310
Thanx's
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

599 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