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

Picturebox: repainting only a certain area

Posted on 2001-06-22
Last Modified: 2008-03-17

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

Expert Comment

ID: 6217388

Expert Comment

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

See Also

Syntax 2
public void repaint( long tm )
maximum time in milliseconds before update
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

Accepted Solution

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.
LVL 22

Expert Comment

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.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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.
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 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…

856 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