user5257984
user5257984

Reputation:

Call paint event on mouse click?

 private void MainImage_Paint(object sender, PaintEventArgs e)
 {

     Point[] destinationPoints = {
                new Point(200, 20),   
                new Point(110, 100),  
                new Point(250, 30)};
     Bitmap image = new Bitmap(MainImage.Image);

     e.Graphics.DrawImage(image, 0, 0);

     e.Graphics.DrawImage(image, destinationPoints);
}


private void button7_Click(object sender, EventArgs e)
{
}

How would I call the paint event on mouse click? Upon firing the "on click" event, it should draw a image over the MainImage.

Upvotes: 1

Views: 1051

Answers (1)

Mehmed
Mehmed

Reputation: 132

Use this.Invalidate(); or this.Update(); or this.Refresh();

And try this:

        Graphics.FromImage(MainImage);
        GraphicsUnit units = GraphicsUnit.Point;
        MainImage_Paint(MainImage,new PaintEventArgs ( Graphics.FromImage(MainImage),Rectangle.Round(MainImage.GetBounds(ref units)));

Upvotes: 1

Related Questions