Solved

Picturebox: repainting only a certain area

Posted on 2001-06-22
4
468 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

734 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