2015-08-23 169 views
1
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) 
{ 
} 

如何在鼠標單擊時調用paint事件? 在點擊「點擊」事件時,它應該在MainImage上繪製圖像。鼠標點擊調用繪畫事件?

+1

'this.Invalidate()'? – Eser

+0

我試過了,但沒有工作.. –

+0

使用'this.Invalidate();'或'this.Update();'或'this.Refresh(); ' – mitli

回答

1

使用this.Invalidate();this.Update();this.Refresh();

而且試試這個:

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