I am using this.Invalidate(new Rectangle(x, y, width, height));
If I have my paint event, how can I detect what is the area to be drawn into?
Code:
Any idea's?Code:private void Form1_Paint(object sender, PaintEventArgs e) { //the if is what I am trying to do to detect if I am drawing into the whole screen... (like just calling me.Refresh()) if (e.Graphics.ClipBounds.X == this.Bounds.Width && e.Graphics.ClipBounds.Y == this.Bounds.Height) { for (int i = 0; i < formTilesX; i++) { for (int k = 0; k < formTilesY; k++) { if ((k * gridWidth) < (((playerX + formTilesX) * gridWidth) + gridWidth) && (i * gridHeight) < (((playerY + formTilesY) * gridHeight)) + gridHeight) { Bitmap bmp = new Bitmap(images[currentGrid[i, k]]); e.Graphics.DrawImage(bmp, new Point(k * gridWidth, i * gridHeight)); bmp.Dispose(); bmp = null; } } } } Bitmap playerBmp = new Bitmap(Resources.fighter); e.Graphics.DrawImage(playerBmp, new Point(playerX * gridWidth, playerY * gridHeight)); playerBmp.Dispose(); playerBmp = null; //HighlightTile(e); }
Thanks




Reply With Quote