All pastes #612155 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-10 06:44 UTC
rendered paste body
The TileSet_Paint method will only draw the image if the if{Paint==true} condition is not used. Even when PaintTile
is eventually set to true when the user clicks left it still wont draw it. I debugged it and saw that PaintTile was set to true
when the user clicked, and it kept looping through draw image, but wouldn't draw it.

namespace FluxMapEditor
{   
     
    public partial class FluxMapEditor : Form
    {
       
       AddNewTileSet TileSetForm = new AddNewTileSet(); 
      

       static bool PaintTile;  
       static System.Drawing.Point MousePoint;
             

        private void TileMap_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) 
        {
            Point mouseDownLocation = new Point(e.X, e.Y);
            MousePoint = mouseDownLocation;                  

            
            string eventString = null;
            switch (e.Button)
            {
                case MouseButtons.Left:
                    label1.Text = "L"; 
                    PaintTile = true;
                    break;                           
              
                case MouseButtons.None:
                default:
                    break;
            }      
        }

        private void TileMap_Paint(object sender, PaintEventArgs e)
        {
            Image TestImage;

            if (PaintTile == true)
            {
                TestImage = Image.FromFile("C:\\Documents and Settings\\Mathius\\My Documents\\Visual Studio 2005\\Projects\\MapEditor\\MapEditor\\TileSets\\TileSet1.jpg");
                e.Graphics.DrawImage(TestImage, MousePoint);
                
            }

        }      

    }
}