|
-
Dec 20th, 2007, 07:15 PM
#1
Thread Starter
Frenzied Member
[2.0] Updating a specific part of my window (in the paint event)
Code:
private void Form1_Paint(object sender, PaintEventArgs e)
{
for (int i = 0; i < currentGrid.GetUpperBound(0); i++)
{
for (int k = 0; k < currentGrid.GetUpperBound(1); k++)
{
Bitmap bmp = new Bitmap(images[currentGrid[i, k]]);
e.Graphics.DrawImage(bmp, new Point(k * gridWidth, i * gridHeight));
bmp.Dispose();
bmp = null;
}
}
HighlightTile(e);
}
when I click, it updates the position that my highlighted tile is at, however I have to call this.Refresh();, and it lags because I am drawing the whole thing again, any way I can refresh 'only' a part of it?
-
Dec 20th, 2007, 07:32 PM
#2
Re: [2.0] Updating a specific part of my window (in the paint event)
tried something like this?
C# Code:
Me.Invalidate (New Rectangle(0,0,100,100));
Just specify a region to be repainted using either a Rectangle or a Region.
http://msdn2.microsoft.com/en-us/lib...te(VS.80).aspx
-
Dec 20th, 2007, 07:53 PM
#3
Thread Starter
Frenzied Member
Re: [2.0] Updating a specific part of my window (in the paint event)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|