Solved

Picturebox: repainting only a certain area

Posted on 2001-06-22
4
441 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

785 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