public int GetCurrentHandle(Point point) //Get current handle kind according the current point { for (int i = 0; i < 8; ++i) { Rectangle temp = new Rectangle(m_rtHandles[i].Left - 8, m_rtHandles[i].Top - 8, 16, 16); //Expand the selection area if (temp.Contains(point)) { m_nCurrentHandle = (CurrentHandle)(i + 1); return(i + 1); } } Rectangle temp2 = new Rectangle(m_ptRotationCenter.X - 8, m_ptRotationCenter.Y - 8, 16, 16); if (temp2.Contains(point)) { m_nCurrentHandle = (CurrentHandle)9; return(9); } if (m_rtAdjustingRect.Contains(point)) { m_nCurrentHandle = 0; return(0); } else if (point.X < virticalCenter && point.Y < horizonCenter) { m_nCurrentHandle = (CurrentHandle)10; return(10); } else if (point.X < virticalCenter && point.Y > horizonCenter) { m_nCurrentHandle = (CurrentHandle)11; return(11); } else if (point.X > virticalCenter && point.Y > horizonCenter) { m_nCurrentHandle = (CurrentHandle)12; return(12); } else { m_nCurrentHandle = (CurrentHandle)13; return(13); } }
//Get current handle kind according the current point public int GetCurrentHandle(Point point) { for (int i = 0; i < 8; ++i) { Rectangle temp = new Rectangle(m_rtHandles[i].Left - 8, m_rtHandles[i].Top - 8, 16, 16); //Expand the selection area if (temp.Contains(point)) { m_nCurrentHandle = (CurrentHandle)(i + 1); return i+1; } } Rectangle temp2 = new Rectangle(m_ptRotationCenter.X - 8, m_ptRotationCenter.Y - 8, 16, 16); if(temp2.Contains(point)) { m_nCurrentHandle=(CurrentHandle)9; return 9; } if (m_rtAdjustingRect.Contains(point)) { m_nCurrentHandle = 0; return 0; } else if (point.X < virticalCenter && point.Y < horizonCenter) { m_nCurrentHandle = (CurrentHandle)10; return 10; } else if (point.X < virticalCenter && point.Y > horizonCenter) { m_nCurrentHandle = (CurrentHandle)11; return 11; } else if (point.X > virticalCenter && point.Y > horizonCenter) { m_nCurrentHandle = (CurrentHandle)12; return 12; } else { m_nCurrentHandle = (CurrentHandle)13; return 13; } }