Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-06
3
Medium Priority
?
305 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 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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 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