第七章6.txt

来自「本书在复习C++基础知识后」· 文本 代码 · 共 42 行

TXT
42
字号
void CEx_A7View::OnMouseMove(UINT nFlags, CPoint point) 
{
		CDC* pDC		= this->GetDC();
		CString		strPos;
	if (m_bLineStart )
	{
		// 计算长度和角度
		int dx = point.x - m_ptPrevPos.x;
		int dy = point.y - m_ptPrevPos.y;
		double length	= sqrt( dx * dx + dy * dy );
		double angle;
		if (dx == 0 )		angle = 90.0;
		else if ( dy == 0 ) angle = 0.0;
		else				angle = 180.0 * atan( (double)dy / (double)dx ) / 3.14159265;
		strPos.Format( "%.1f<%.1f", length, angle );
	} else
			strPos.Format( "%d, %d", point.x, point.y );
		if ( m_bCursorFirst )
		{
			m_bCursorFirst	= FALSE;
			m_ptCurPos		= point;
			DrawCursor( pDC, m_ptCurPos );
			DrawInfoWnd( pDC, m_ptCurPos, strPos );
		} else
		{
			DrawCursor( pDC, m_ptCurPos );
		if (m_bLineStart )				// 绘制XOR直线 
			DrawXORLine( pDC, m_ptPrevPos, m_ptCurPos );
			if ( m_dcMem.m_hDC )
			{
				pDC->BitBlt( m_ptCurPos.x, m_ptCurPos.y - 15, 80, 15, 
					&m_dcMem, m_ptCurPos.x, m_ptCurPos.y - 15, SRCCOPY );
			}
			m_ptCurPos		= point;
		if (m_bLineStart )				// 绘制XOR直线 
			DrawXORLine( pDC, m_ptPrevPos, m_ptCurPos );
			DrawCursor( pDC, m_ptCurPos );
			DrawInfoWnd( pDC, m_ptCurPos, strPos );
		}
		CView::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?