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

📄 jxtdlg.cpp

📁 本项目是我工作时候应公司需求开发的 开发工具是EVC++4.0
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// JXTDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Wonder.h"
#include "JXTDlg.h"
#include "JXT.h"
#include "JXT34.h"
#include "DataStruct.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


extern CYjbkData YjbkData[];
extern int YjbkNum ;
extern int YjbkTotal ;
extern BYTE Data232[];
extern fdlx FDLH;
extern zslx ZXLH;
extern int Yjb_Num;
extern float a;
extern float b;
extern float c;


/////////////////////////////////////////////////////////////////////////////
// CJXTDlg dialog

CJXTDlg::CJXTDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CJXTDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CJXTDlg)
	//}}AFX_DATA_INIT
	
}


void CJXTDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJXTDlg)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CJXTDlg, CDialog)
	//{{AFX_MSG_MAP(CJXTDlg)
	ON_BN_CLICKED(IDC_JXTDLG_BTN_EXIT, OnJxtdlgBtnExit)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CJXTDlg message handlers

void CJXTDlg::OnJxtdlgBtnExit() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
}

void CJXTDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	
	// TODO: Add your message handler code here	   
/*
	  /*显示接线结果,如果有错误,文字显示,如果无错误显示接线图/
  if(jx_result_n!=0&&strcmp(jx_result[0].pt,"YES")==0&&strcmp(jx_result[0].ct,"YES")==0)
  { if(strcmp(jx_result[i].dblx,"P33")==0) draw3x3(320-5*14-56,30,mark_cx);
    else draw3x4(320-5*14-56,30,mark_cx);
    panduan_ground(i);
    if(strcmp(jx_result[i].dblx,"P33")==0) disp_jxt3x3(&jx_result[i]);
    else disp_jxt3x4(&jx_result[i]);
    show_jxttext(320-5*14-56+34,30,i);
    return 0;
  }
  else
  { disp_ptct(&jx_result[0].pt[0],&jx_result[0].ct[0]); /*显示PT\CT\相位判断结果/
    return 1;
  }
*/
	if(strcmp(YjbkData[YjbkNum].dblx,"")==0 || strcmp(YjbkData[YjbkNum].ct,"")==0
		|| strcmp(YjbkData[YjbkNum].pt,"")==0)
	{
		dc.SetTextColor(RGB(255,0,0));
		//dc.ExtTextOut (Text1x,Text1y,ETO_CLIPPED,NULL,_T("一元件 Ua"),NULL );
		dc.ExtTextOut(85,100,ETO_CLIPPED,NULL,_T("无相应接线图!"),NULL);
	}
	else
	{
	  if(strcmp(YjbkData[YjbkNum].pt,"YES")==0&&strcmp(YjbkData[YjbkNum].ct,"YES")==0)
	  {
	    if(strcmp(YjbkData[YjbkNum].dblx,"P33")==0){Draw33Static();Draw33DT();}
	    else if(strcmp(YjbkData[YjbkNum].dblx,"P34")==0){Draw34Static();Draw34DT();}
	    DrawText(1,1);
	  }
	  else
	  {
		/*
		 char pt[4];   /*=YES,PT接线正常;=AC,A或C元件1或2次断路;=B,1或2次B相断路;=BDC 不对称;=UER 电压幅值不对;
                    =AB,1次A或B或2次A断路;=BC,2次C或B或1次C断路;=ERR,数据错误;=DAT无测试数据
		char ct[4];   /*=YES,CT接线正常;=AC,1或2元件短路;=B,公共线开路?BDC 不对称?
                    =JC,首尾交叉接线;=ERR,数据错误;=DAT无测试数据;/
		*/
	  }
	}
	// Do not call CDialog::OnPaint() for painting messages
}

BOOL CJXTDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE

}

void CJXTDlg::Draw33Static()
{	
	CPen pen;
	CPaintDC dc(this);
	pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
	CPen *pOldPen = dc.SelectObject(&pen);

    //外框
   // dc.Rectangle(2,2,237,200);

	//2个大圆
	dc.Ellipse(135,10,160,35);
	//dc.Ellipse(168,10,193,35);
	dc.Ellipse(185,10,210,35);

	//7个小圆
	dc.Ellipse(127,44,130,47);
	dc.Ellipse(145,44,148,47);	
	dc.Ellipse(163,44,166,47);	

	dc.Ellipse(171,44,174,47);	
	dc.Ellipse(179,44,182,47);	
	dc.Ellipse(197,44,200,47);
	dc.Ellipse(215,44,218,47);
	
	dc.MoveTo (Point1x,Point1y);
	dc.LineTo (Point1x,C1Cy);
	dc.LineTo (Point3x,C1Cy);
	dc.LineTo (Point3x,Point3y);
	dc.MoveTo (Point2x,Point2y);
	dc.LineTo (Point2x,5);
	dc.LineTo (Point6x,5);
	dc.LineTo (Point6x,Point6y);
	dc.MoveTo (Point5x,Point5y);
	dc.LineTo (Point5x,C2Cy);
	dc.LineTo (Point7x,C2Cy);
	dc.LineTo (Point7x,Point7y);
	dc.MoveTo (Point4x,Point4y);
	dc.LineTo (Point4x,5);

	dc.MoveTo (Point1x,Point1y+YPer);
	dc.LineTo (Point8x,Point8y);
	dc.MoveTo (Point5x,Point5y+YPer);
	dc.LineTo (Point9x,Point9y);
	dc.MoveTo (Point7x,Point7y+YPer);
	dc.LineTo (Point10x,Point10y);

	dc.MoveTo (Point8x,Point8y+YPer2);
	dc.LineTo (Point11x,Point11y);
	dc.MoveTo (Point9x,Point9y+YPer2);
	dc.LineTo (Point13x,Point13y+2);
	dc.MoveTo (Point10x,Point10y+YPer2);
	dc.LineTo (Point14x,Point14y+2);
	
	dc.MoveTo (Point11x,Point11y+YPer2);
	dc.LineTo (Point11x,Line1y);
	dc.MoveTo (Point12x,Point12y+YPer2);
	dc.LineTo (Point12x,Line1y);
	dc.MoveTo (Point13x,Point13y+YPer2);
	dc.LineTo (Point13x,Line3y);
	dc.MoveTo (Point14x,Point14y+YPer2);
	dc.LineTo (Point14x,Line3y);
	
	dc.MoveTo (Line1x,Line1y);
	dc.LineTo (230,Line1y);
	dc.MoveTo (Line2x,Line2y);
	dc.LineTo (230,Line2y);
	dc.MoveTo (Line3x,Line3y);
	dc.LineTo (230,Line3y);
	
	dc.MoveTo (Point11x,Line1y);


	
	DrawHalfCir(Point11x,Line1y,Point11x+13,Line1y,1);
	DrawHalfCir(Point11x+12,Line1y,Point11x+26,Line1y,1);
	DrawHalfCir(Point11x+25,Line1y,Point11x+38,Line1y,1);
	
	DrawHalfCir(Point13x,Line3y,Point13x+13,Line3y,1);
	DrawHalfCir(Point13x+12,Line3y,Point13x+26,Line3y,1);
	DrawHalfCir(Point13x+25,Line3y,Point13x+38,Line3y,1);	

   
	dc.MoveTo (Point6x,Point6y);
	dc.LineTo (Point6x,Point6y+YPer+10);
	dc.LineTo (Point17x,Point6y+YPer+10);
	dc.LineTo (Point17x,Point17y);

	dc.MoveTo(Point4x,Point4y);
	dc.LineTo (Point4x,Point4y+YPer+6);
	dc.LineTo (Point16x,Point4y+YPer+6);
	dc.LineTo (Point16x,Point16y);

	dc.MoveTo (Point2x,Point2y);
	dc.LineTo (Point2x,Point2y+YPer+2);
	dc.LineTo (Point15x,Point2y+YPer+2);
	dc.LineTo (Point15x,Point15y);
	
	dc.MoveTo (Point15x,Point15y+YPer);
	dc.LineTo (Point18x,Point18y);
	dc.MoveTo (Point16x,Point16y+YPer);
	dc.LineTo (Point16x,Point16y+YPer+4);
	dc.LineTo (Point19x,Point19y-4);
	dc.LineTo (Point19x,Point19y);
	dc.MoveTo (Point16x,Point16y+YPer+4);
	dc.LineTo (Point20x,Point20y-4);
	dc.LineTo (Point20x,Point20y);
	dc.MoveTo (Point17x,Point17y+YPer);
	dc.LineTo (Point21x,Point21y);

	dc.MoveTo (Point18x,Point18y+YPer);

	DrawHalfCir(Point18x,Point18y+YPer,Point18x+13,Point18y+YPer,1);
	DrawHalfCir(Point18x+12,Point18y+YPer,Point18x+26,Point18y+YPer,1);
	
	DrawHalfCir(Point20x,Point20y+YPer,Point20x+13,Point20y+YPer,1);
	DrawHalfCir(Point20x+12,Point20y+YPer,Point20x+26,Point20y+YPer,1);
   
   dc.MoveTo (Point18x,Point18y+YPer+10);
   dc.LineTo (Point19x,Point19y+YPer+10);
   
   dc.MoveTo (Point20x,Point20y+YPer+10);
   dc.LineTo (Point21x,Point21y+YPer+10);

   DrawHalfCir(Point25x,Point25y,Point25x+13,Point25y,-1);
   DrawHalfCir(Point25x+12,Point25y,Point25x+26,Point25y,-1);
	
   DrawHalfCir(Point27x,Point27y,Point27x+13,Point27y,-1);
   DrawHalfCir(Point27x+12,Point27y,Point27x+26,Point27y,-1);
 
   
   dc.MoveTo (Point25x,Point25y);
   dc.LineTo (Point25x,Line1y);
   dc.MoveTo (Point26x,Point26y);
   dc.LineTo (Point26x,Point26y+4);
   dc.LineTo (Point16x,Point26y+4);
   dc.LineTo (Point16x,Line2y);
   dc.MoveTo (Point27x,Point27y);
   dc.LineTo (Point27x,Point27y+4);
   dc.LineTo (Point16x,Point27y+4);
   dc.MoveTo (Point28x,Point28y);
   dc.LineTo (Point28x,Line3y);
   if(strcmp(YjbkData[YjbkNum].jxzs,"三线制")==0)
   {
    dc.MoveTo (Point12x,Point12y);
	dc.LineTo(Point14x,Point12y);
	dc.MoveTo (Point3x,Point3y+YPer);
	dc.LineTo (Point7x,Point7y+YPer);
   }
   else
   {
	   dc.MoveTo (Point3x,Point3y+YPer);
	   dc.LineTo(Point30x,Point30y);
	   dc.MoveTo (Point30x,Point30y+YPer2);
	   dc.LineTo (Point12x,Point12y);
   }
	DrawPoint(Point2x,5);
	DrawPoint(Point4x,5);
	DrawPoint(Point6x,5);
	
    DrawPoint(Point22x,Line1y);
	DrawPoint(Point23x,Line2y);
	DrawPoint(Point24x,Line3y);
	
	DrawAdd(C1Cx-R-5,C1Cy-5);
	DrawAdd(C1Cx-5,C1Cy+R+5);
	DrawAdd(C2Cx-R-5,C2Cy-5);
	DrawAdd(C2Cx-5,C2Cy+R+5);

	DrawAdd(Point11x-5,Line1y-5);
	DrawAdd(Point11x+5,Line1y-5);
	DrawAdd(Point13x-5,Line3y-5);
	DrawAdd(Point13x+5,Line3y-5);

	DrawAdd(Point18x-5,Point18y+YPer);
	DrawAdd(Point25x-5,Point25y);
	DrawAdd(Point20x-4,Point20y+YPer);
	DrawAdd(Point27x-4,Point27y);
	
	CPen linepenY,linepenB,linepenR;
	linepenY.CreatePen (PS_SOLID,1,RGB(255,255,0));
	dc.SelectObject (&linepenY);
	dc.MoveTo (5,Line1y);
	dc.LineTo (Point14x+15,Line1y);

	linepenB.CreatePen (PS_SOLID,1,RGB(0,255,0));	
	dc.SelectObject (&linepenB);	
	dc.MoveTo (5,Line2y);
	dc.LineTo (Point14x+15,Line2y);

	linepenR.CreatePen (PS_SOLID,1,RGB(255,0,0));	
	dc.SelectObject (&linepenR);	
	dc.MoveTo (5,Line3y);
	dc.LineTo (Point14x+15,Line3y);	

	dc.SelectObject(pOldPen);		
    dc.MoveTo (C1Cx-R,C1Cy-1);
	dc.LineTo (C1Cx+R,C1Cy-1);
	dc.MoveTo (C2Cx-R,C2Cy-1);
	dc.LineTo (C2Cx+R,C2Cy-1);	
	////////////////////////////////////////////
	dc.SelectObject(pOldPen);
	pen.DeleteObject();
	dc.DeleteDC();
	
	
}

void CJXTDlg::Draw34Static()
{
		
	CPen pen;
	CPaintDC dc(this);
	pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
	CPen *pOldPen = dc.SelectObject(&pen);

    //外框
    //dc.Rectangle(2,2,237,210);

	//3个大圆
	dc.Ellipse(85,10,110,35);
	dc.Ellipse(135,10,160,35);
	dc.Ellipse(185,10,210,35);	

	//9个小圆
	dc.Ellipse(77,44,80,47);
	dc.Ellipse(95,44,98,47);	
	dc.Ellipse(113,44,116,47);	
	
	dc.Ellipse(127,44,130,47);
	dc.Ellipse(145,44,148,47);	
	dc.Ellipse(163,44,166,47);	
	
	dc.Ellipse(179,44,182,47);	
	dc.Ellipse(197,44,200,47);
	dc.Ellipse(215,44,218,47);

    dc.MoveTo(Point1x34,Point1y34);
	dc.LineTo(Point1x34,C1Cy34);
	dc.LineTo(Point3x34,C1Cy34);
	dc.LineTo(Point3x34,Point3y34);
	dc.MoveTo(Point2x34,Point2y34);
	dc.LineTo(Point2x34,5);
	DrawPoint(Point2x34,5);

	dc.MoveTo(Point4x34,Point4y34);
	dc.LineTo(Point4x34,C2Cy34);
	dc.LineTo(Point6x34,C2Cy34);
	dc.LineTo(Point6x34,Point6y34);
	dc.MoveTo(Point5x34,Point5y34);
	dc.LineTo(Point5x34,5);
	DrawPoint(Point5x34,5);

	dc.MoveTo(Point7x34,Point7y34);
	dc.LineTo(Point7x34,C3Cy34);
	dc.LineTo(Point9x34,C3Cy34);
	dc.LineTo(Point9x34,Point9y34);
	dc.MoveTo(Point8x34,Point8y34);
	dc.LineTo(Point8x34,5);
	DrawPoint(Point8x34,5);

	dc.MoveTo(Point12x34,Point12y34);
	dc.LineTo(Point21x34,Point21y34);
	dc.LineTo(Point20x34,Point20y34);
	dc.LineTo(Point26x34,Point26y34);
	dc.MoveTo(Point22x34,Point22y34);
	dc.LineTo(Point27x34,Point27y34);
	dc.MoveTo(Point22x34,Point22y34);
	dc.LineTo(Point23x34,Point23y34);
	dc.LineTo(Point15x34,Point15y34);
	dc.MoveTo(Point18x34,Point18y34);
	dc.LineTo(Point25x34,Point25y34);
	dc.LineTo(Point24x34,Point24y34);
	dc.LineTo(Point28x34,Point28y34);	

	dc.MoveTo (Point11x34,Point11y34);
	dc.LineTo (Point29x34,Point29y34);
	
	dc.MoveTo (Point14x34,Point14y34);
	dc.LineTo (Point31x34,Point31y34);
	dc.MoveTo (Point17x34,Point17y34);
	dc.LineTo (Point33x34,Point33y34);
	dc.MoveTo (Point19x34,Point19y34);
	dc.LineTo (Point34x34,Point34y34);
	
	dc.MoveTo (Point38x34,Point38y34);
	dc.LineTo (Point47x34,Point47y34);
	dc.MoveTo (Point40x34,Point40y34);
	dc.LineTo (Point49x34,Point49y34);
	dc.MoveTo (Point42x34,Point42y34);
	dc.LineTo (Point51x34,Point51y34);
	dc.MoveTo (Point43x34,Point43y34);
	dc.LineTo (Point52x34,Point52y34);
	
	dc.MoveTo (Point35x34,Point35y34);
	dc.LineTo (Point44x34,Point44y34);
	dc.MoveTo (Point36x34,Point36y34);
	dc.LineTo (Point45x34,Point45y34);
	dc.MoveTo (Point37x34,Point37y34);
	dc.LineTo (Point46x34,Point46y34);

	dc.MoveTo (Point55x34,Point55y34);
	dc.LineTo (Point55x34,Point45y34);
	dc.MoveTo (Point56x34,Point56y34);
	dc.LineTo (Point56x34,Point45y34);

⌨️ 快捷键说明

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