Solved

Picturebox: repainting only a certain area

Posted on 2001-06-22
4
417 Views
Last Modified: 2008-03-17
Hi,

Can anyone tell me how i can redraw/repaint only a certain area of a picturebox? thanks.
0
Comment
Question by:3Mann
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Microsoft
ID: 6217388
0
 
LVL 2

Expert Comment

by:Microsoft
ID: 6217398
Syntax 1
public void repaint()
Description
Repaints this component.
This method causes a call to this component's update method as soon as possible.


See Also
update





Syntax 2
public void repaint( long tm )
Parameters
tm
maximum time in milliseconds before update
Description
Repaints the component. This will result in a call to update within tm milliseconds.

See Also
paint, update





Syntax 3
this explains how to use repaint
0
 
LVL 3

Accepted Solution

by:
RodStephens earned 50 total points
ID: 6218201
If you keep an image of the surface somewhere like a hidden PictureBox, you could use PaintPicture to refresh the area you want.

Or you could use the API to set a clipping region to include the area you want to refresh. Then if you redraw everything, only the part in the clipping area gets drawn. Depending on the picture, this may be slightly faster than redrawing everything. (PaintPicture will be much faster).

However, in any case you will need some way to know what area to refresh and VB doesn't normally provide that.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6219198
If you have a specific image that you want on a portion of the picture, you can simply place the image into a frameless ImageBox and it will appear to be in the PictureBox.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
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 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…

706 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

19 Experts available now in Live!

Get 1:1 Help Now