?
Solved

Picture1.Picture = Picture2.image, which resources are used ?

Posted on 2004-10-06
3
Medium Priority
?
304 Views
Last Modified: 2012-05-05
Hi iam doing the above to illustrate a grid and a rectangle moving with the mouse over this, this means

I generate a picture and put it into Picture2 and picture1, on a mousemove on picture 1 i draw a hollow rectangle which corresponds to the position of the mouse over the image, next the user triggers yet another mouse move i do the command
Picture1.Picture = Picture2.image to restore the original image (deleting the rectangle) and then draw the new rectangle onto Picture1, is this the best method to visualize a rectangle moving with the mouse, the thing is that this solution lags on some computers.

Which resources are used when you perform a Picture1.Picture = Picture2.image, is it only processor or does the GFX card have alot to do with it ?

Does someone have another idea of how this could be done ?
0
Comment
Question by:mSchmidt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:redfordb
ID: 12237231
Instead of copying the image from picture2 to picture1, just use the cls method of the picturebox to remove the hollowbox
ie replace Picture1.Picture = Picture2.image with Picture1.cls

This should improve the speed at which this happens.
Please advise if it does help.
0
 
LVL 1

Expert Comment

by:souvey
ID: 12254934
I think it would be more efficiant to not draw a rectangle at all...
Have invisible picture boxes with an image in them that has the rectangle already on the image
Then just switch using them

It shouldn't use any resources to set the picture (not many at least)
I think you should try not using the drawing functions instead...
Please reply is this is what you meant
0
 
LVL 6

Accepted Solution

by:
SCDMETA earned 2000 total points
ID: 12256245
Picture boxes have two drawing surfaces: Picture and Image.  For example, you can set the Picture surface to a JPG.  Then draw lines, circles etc on top of it.  If you perform a Picture1.cls, it clears the drawing but not the JPG.

In your case, you could draw your grid.  Then, set the Picture1.Picture = Picture1.image.  This saves the grid.  Now when the mouse moves draw your rectangle.  To restore the clean grid before drawing the "moved" rectangle, perform a Picture1.cls.

See here for more details: http://www.vb-helper.com/howto_erase_picture_lines.html

On other option is to save and restore just the touched portion of the picture.  There is a windows API called BitBlt that can restore just a small rectangle of an image. Try this link: http://www.vbgamer.com/tutorial.asp?ndx=20

Good Luck

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 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…
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

800 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