private void listView1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Cursor = System.Windows.Forms.Cursors.Default; FatherWindow temp = (FatherWindow)(this.ParentForm); temp.workRegion.pictureBox1.MouseUp -= new System.Windows.Forms.MouseEventHandler(temp.workRegion.pictureBox1_MouseUp); temp.workRegion.pictureBox1.MouseEnter -= new System.EventHandler(temp.workRegion.pictureBox1_MouseEnter); temp.workRegion.pictureBox1.MouseLeave -= new System.EventHandler(temp.workRegion.pictureBox1_MouseLeave); picLine = false; } }
private void listView1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { itemSelected = listView1.GetItemAt(e.X, e.Y); if (itemSelected != null && e.Button == MouseButtons.Left) { this.Cursor = CommonFunction.CreatCursor("draw"); picLine = true; FatherWindow temp = (FatherWindow)(this.ParentForm); temp.workRegion.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(temp.workRegion.pictureBox1_MouseUp); temp.workRegion.pictureBox1.MouseEnter += new System.EventHandler(temp.workRegion.pictureBox1_MouseEnter); temp.workRegion.pictureBox1.MouseLeave += new System.EventHandler(temp.workRegion.pictureBox1_MouseLeave); } } }