我只是試圖在鼠標移動事件上繪製一個矩形。我剛剛在MouseDown事件中保存了起始點,而結束點來自Mouse Move。並稱爲paintImage函數。使用鼠標在c#中繪製矩形
Rectangle rec = new Rectangle (x1,y1,x2 - x1 , y2 - y1);
G.DrawRectangle(Pens.Blue,rec);
Starting Points = (x1,y1)
Ending Points = (x2,y2)
問題是當x2的值小於X1或Y2小於Y1矩形被繪製...任何人都幫我在這
看看這個帖子:http://stackoverflow.com/questions/4164864/what-is-the-proper-way-to-draw-a-line-with-mouse -in-c-sharp我想那裏很簡單 – eyossi 2012-07-10 07:05:06