⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eastdrawview.cpp

📁 完整的基本图形绘制系统 .rar
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	}

    m_CurrentDrawTool=Rectangle_Tool;
    m_LBDownTimes=0;
	m_CurrentDrawStatus=Draw_Status;
}

void CEastDrawView::OnBUTTON32778RoundRectangle() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);

	// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
     ResetSelectStatus();
	
  CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}	
  m_CurrentDrawTool=RoundRectangle_Tool;
  m_CurrentDrawStatus=Draw_Status;
  m_LBDownTimes=0;
}

void CEastDrawView::OnBUTTON32779Ellipse() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
 if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();

   CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	} 
	m_CurrentDrawTool=Ellipse_Tool;
    m_CurrentDrawStatus=Draw_Status;
    m_LBDownTimes=0;

}

void CEastDrawView::OnBUTTON32780Round() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 
  CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}
  m_CurrentDrawTool=Round_Tool;
  m_CurrentDrawStatus=Draw_Status;
  this->m_LBDownTimes=0;

}

void CEastDrawView::OnBUTTON32791Polygon() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
 if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 
 
 m_IsPolygonFirst=true;
 CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}

	m_CurrentDrawTool=Polygon_Tool;
    m_CurrentDrawStatus=Draw_Status;
	this->m_LBDownTimes=0;
}

void CEastDrawView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	  	
      CPoint Devpoint=point;
	  CClientDC dc(this);
	  this->OnPrepareDC(&dc);
      dc.SetWindowOrg(m_CenterPoint);
	  dc.DPtoLP(&point);
      dc.SetROP2(R2_NOTXORPEN);
	  this->ComputeMinandMaxPoint(point);
	  m_ChangeingPoint=point;
      this->SetMousePosText(point,Devpoint);

   if(m_CurrentDrawStatus==Draw_Status&&m_CurrentDrawTool==Polygon_Tool)
	{
	m_pCurrentUnit->DrawEnd(&dc,point);
	this->m_LBDownTimes=0;
	this->ExchangeSave();
	 if(m_IsMouseCap)
	::ReleaseCapture();
	}
 
	CScrollView::OnLButtonDblClk(nFlags, point);
}

void CEastDrawView::OnSetFocus(CWnd* pOldWnd) 
{
	CScrollView::OnSetFocus(pOldWnd);
	
	// TODO: Add your message handler code here
	
 
 
}



void CEastDrawView::OnMENUITEM32794SetRegin() 
{
	// TODO: Add your command handler code here
    CReginSet setReginDlg;
	CClientDC dc(this);
	setReginDlg.m_Length=this->GetTotalSize().cx;
   	setReginDlg.m_Width=this->GetTotalSize().cy;
    
	setReginDlg.m_X=m_CenterPoint.x;
	setReginDlg.m_Y=m_CenterPoint.y;
    setReginDlg.m_bIsViewReign=true;
   if(setReginDlg.DoModal()==IDOK)
	{
	CSize sizeTotal;
    sizeTotal.cx=setReginDlg.m_Length;
	sizeTotal.cy=setReginDlg.m_Width;
	SetScrollSizes(MM_TEXT, sizeTotal);
	OnPrepareDC(&dc);
	m_CenterPoint.x=setReginDlg.m_X;
	m_CenterPoint.y=setReginDlg.m_Y;
	dc.SetWindowOrg(m_CenterPoint);
	OnBUTTON32850ReDraw();
	
    CEastDrawDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDoc->m_CenterPoint=m_CenterPoint;
	pDoc->m_TotalSize=sizeTotal;
   }
   
   

}

void CEastDrawView::OnBUTTONLiEllipse() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
 if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();

 
CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}
	m_CurrentDrawTool=LiEllipse_Tool;
    m_CurrentDrawStatus=Draw_Status;
	this->m_LBDownTimes=0;
}

void CEastDrawView::ResetSelectStatus()
{
    CEastDrawDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CClientDC dc(this);
	CClientDC*pDC=&dc;
    OnPrepareDC(pDC);
	dc.SetWindowOrg(m_CenterPoint);

	for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
	{
	  CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
	  
	  if(pPolygon->m_HaveFindFirst)
	  {
		  pPolygon->ShowSelectPoint(pDC);
	      pPolygon->m_HaveFindFirst=false;
	  }
	}

	for(i=0;i<pDoc->m_TextArray.GetSize();i++)
	{
	  CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
	  if(pText->m_HaveFindFirst)
	  {	
		pText->ShowSelectPoint(pDC);
		
	    pText->m_HaveFindFirst=false;
	
	  }
	
	
	}
    for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
	{
	  CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
	  if(pEllipseArc->m_HaveFindFirst)
	  {
	   pEllipseArc->ShowSelectPoint(pDC);
	   pEllipseArc->m_HaveFindFirst=false;
	  }
	}

	for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
   {
	CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
	
    if(pDLine->m_HaveFindFirst)
	{	pDLine->m_HaveFindFirst=false;
		pDLine->ShowSelectPoint(pDC);
	}
	}
	for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
	{
	 CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
	 
	 if(pCurve->m_HaveFindFirst)
	 {   pCurve->m_HaveFindFirst=false;
		 pCurve->ShowSelectPoint(pDC);
     }
	}

	for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
	{
	CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
	
	if(pRectangle->m_HaveFindFirst)
	{
		pRectangle->m_HaveFindFirst=false;
		pRectangle->ShowSelectPoint(pDC);
	}
	}
    for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
	{
	CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
	
	if(pRoundRectangle->m_HaveFindFirst)
	{   pRoundRectangle->m_HaveFindFirst=false;
		pRoundRectangle->ShowSelectPoint(pDC);
	}
	}
    for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
	{
	CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
	
	if(pEllipse->m_HaveFindFirst)
	{
		pEllipse->m_HaveFindFirst=false;
		pEllipse->ShowSelectPoint(pDC);
	}
	}
    for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
	{
	CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
	
	if(pRound->m_HaveFindFirst)
	{   pRound->m_HaveFindFirst=false;
		pRound->ShowSelectPoint(pDC);
	}
	}
  for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
	{
	CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
	
	if(pLiEllipse->m_HaveFindFirst)
	{
		pLiEllipse->m_HaveFindFirst=false;
		pLiEllipse->ShowSelectPoint(pDC);
	}
	}
  for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
  {
    CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
	if(pRoundArc->m_HaveFindFirst)
	{
	  pRoundArc->m_HaveFindFirst=false;
	  pRoundArc->ShowSelectPoint(pDC);
	}
  }
 for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
 {
  CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
  if(pPolyBezier->m_HaveFindFirst)
  {
    pPolyBezier->m_HaveFindFirst=false;
	pPolyBezier->ShowSelectPoint(pDC);
  }
 }


}



void CEastDrawView::ComputeMinandMaxPoint(CPoint point)
{
m_MinPoint.x=min(m_MinPoint.x,point.x);
m_MinPoint.y=min(m_MinPoint.y,point.y);
m_MaxPoint.x=max(m_MaxPoint.x,point.x);
m_MaxPoint.y=max(m_MaxPoint.y,point.y);
m_InvalidRect.SetRect(m_MinPoint,m_MaxPoint);
}

void CEastDrawView::InvalidateMovingRect(CUnit *pMovingUnit)
{
/*pMovingUnit->GetBoundingRect(); 
m_InvalidRect.left=min(m_InvalidRect.left,pMovingUnit->m_BoundingRect.left);
m_InvalidRect.top=min(m_InvalidRect.top,pMovingUnit->m_BoundingRect.top);
m_InvalidRect.right=max(m_InvalidRect.right,pMovingUnit->m_BoundingRect.right);
m_InvalidRect.bottom=max(m_InvalidRect.bottom,pMovingUnit->m_BoundingRect.bottom);
m_InvalidRect.InflateRect(pMovingUnit->m_PenWidth,pMovingUnit->m_PenWidth);
//
CClientDC dc(this);
dc.Rectangle(m_InvalidRect);*/
//this->InvalidateRect(m_InvalidRect);
}

void CEastDrawView::OnBUTTON32800RoundArc() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here

if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 
 CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}
	m_CurrentDrawTool=RoundArc_Tool;
    m_CurrentDrawStatus=Draw_Status;
	this->m_LBDownTimes=0;
}



void CEastDrawView::OnBUTTON32805EllipseArc() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 
CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}
 m_CurrentDrawTool=EllipseArc_Tool;
 m_CurrentDrawStatus=Draw_Status;
 this->m_LBDownTimes=0;

}

void CEastDrawView::OnBUTTON32807PolyBezier() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 
 CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
	if(pMainFrame->m_wndStyleBar.IsWindowVisible())
    { 
	 pMainFrame->ShowFontBar(false);
     if(this->m_LBDownTimes==1)
	 {
	  this->m_LBDownTimes=2;
	  this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
	  
	 }
	}
m_CurrentDrawTool=PolyBezier_Tool;
 m_CurrentDrawStatus=Draw_Status;
 this->m_LBDownTimes=0;
}



void CEastDrawView::OnBUTTON32809Text() 
{
	CClientDC dc(this);
	OnPrepareDC(&dc);
	dc.SetWindowOrg(m_CenterPoint);
	// TODO: Add your command handler code here
if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
 ResetSelectStatus();
 

⌨️ 快捷键说明

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