private void ScanDisplay_MouseDown(object sender, MouseEventArgs e) { if (chkEditMode.Checked == true) { m_bLeftButtonDown = true; this.Cursor = Cursors.Cross; m_ClickPoint = new Point(e.X, e.Y); } //화면초기화 ScanDisplay.Refresh(); }
private void ScanDisplay_MouseMove(object sender, MouseEventArgs e) { if (chkEditMode.Checked == true) { if (m_bLeftButtonDown) { //X좌표 계산 if (e.X < m_ClickPoint.X) { m_CurrentTopLeft.X = e.X; m_CurrentBottomRight.X = m_ClickPoint.X; } else { m_CurrentTopLeft.X = m_ClickPoint.X; m_CurrentBottomRight.X = e.X; } //Y좌표계산 if (e.Y < m_ClickPoint.Y) { m_CurrentTopLeft.Y = e.Y; m_CurrentBottomRight.Y = m_ClickPoint.Y; } else { m_CurrentTopLeft.Y = m_ClickPoint.Y; m_CurrentBottomRight.Y = e.Y; } //화면초기화 ScanDisplay.Refresh(); //사각형 그리기 g.DrawRectangle(m_MyPen, m_CurrentTopLeft.X, m_CurrentTopLeft.Y, m_CurrentBottomRight.X - m_CurrentTopLeft.X, m_CurrentBottomRight.Y - m_CurrentTopLeft.Y); //Console.WriteLine("그리기 {0} {1} {2} {3} ", CurrentTopLeft.X, CurrentTopLeft.Y, CurrentBottomRight.X - CurrentTopLeft.X, CurrentBottomRight.Y - CurrentTopLeft.Y); } } }