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

📄 dlglen.cpp

📁 此为地球物理中的
💻 CPP
字号:
// DLgLen.cpp : implementation file
//

#include "stdafx.h"
#include "p_r.h"
#include "DLgLen.h"

#include"MainFrm.h"
//#include"globalExt.h"
//#include"global.h"
#include"globalExt.h"

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

//using namespace std;
/////////////////////////////////////////////////////////////////////////////
// CDLgLen dialog
//extern ACTION NOWACTION;
//extern HCURSOR m_hMouseCursor;	//鼠标样式

CDLgLen::CDLgLen(CWnd* pParent /*=NULL*/)
	: CDialog(CDLgLen::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDLgLen)
	m_Distance = 0.0f;
	//}}AFX_DATA_INIT
	m_ClikLen=false;
}


void CDLgLen::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDLgLen)
	DDX_Control(pDX, IDC_EDIT1, m_Len);
	DDX_Text(pDX, IDC_EDIT1, m_Distance);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDLgLen, CDialog)
	//{{AFX_MSG_MAP(CDLgLen)
	ON_WM_KEYDOWN()
	ON_WM_DESTROY()
	ON_WM_CREATE()
	ON_WM_CLOSE()
	ON_BN_CLICKED(IDC_BUTTON_CLk, OnBUTTONCLk)
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDLgLen message handlers

void CDLgLen::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	
	CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

void CDLgLen::OnDestroy() 
{
	CDialog::OnDestroy();
	
	delete this;
}

int CDLgLen::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	
	return 0;
}

void CDLgLen::OnClose() 
{
	
	CDialog::OnClose();
    DestroyWindow(); 
}

void CDLgLen::OnOK() 
{   

	NOWACTION = NULLACTION;
    m_hMouseCursor=LoadCursor(NULL,IDC_ARROW);//恢复系统鼠标指针

    ::SetCursor(m_hMouseCursor);

    UpdateData(TRUE);
    /*
	g_Array.SetSize(g_TotleP,2);
	for(int i=0;i<g_TotleP;i++)
	{
        g_Array.pValue[i][0]=g_Point[i].x;
        g_Array.pValue[i][1]=g_Point[i].y;
	}
	*/
	g_Array.Kjunzhi(m_Distance);
    
	//::
	//CDocument* doc=GetActiveDocument(1);
	//doc->SetActiveView();
    //Invalidate();
	UpdateWindow();
	//::UpdateWindow(AfxGetMainWnd()); 
	 //GetActiveWindow();
    //InvalidateRect(AfxGetMainWnd(),NULL, TRUE);
     InvalidateRect(NULL, TRUE);
//    InvalidateRect(NULL, CRect(0, 0, 1024,768), TRUE);
	 //theApp.UpdateAllView();

	 CMainFrame*   pMain   =   (CMainFrame   *)AfxGetApp()->m_pMainWnd;
     CDocument*   pCurrentDoc = pMain->GetActiveDocument();
    
//     pCurrentDoc->UpdateAllViews();

    CDialog::OnOK();

	DestroyWindow(); 


}

void CDLgLen::OnCancel() 
{
    NOWACTION = NULLACTION;

	m_hMouseCursor=LoadCursor(NULL,IDC_ARROW);//恢复系统鼠标指针

    ::SetCursor(m_hMouseCursor);

	CDialog::OnCancel();
	DestroyWindow();
}

void CDLgLen::OnBUTTONCLk() 
{
	//
	m_ClikLen=true;
    this->ShowWindow(SW_HIDE);
	NOWACTION=ClIKLEN;
	m_hMouseCursor=AfxGetApp()->LoadCursor(IDC_CURSOR_UP);
    ::SetCursor(m_hMouseCursor);
	//return CDialog::DefWindowProc(message, wParam, lParam);
}

void CDLgLen::OnShowWindow(BOOL bShow, UINT nStatus) 
{   
	
	m_Len.SetFocus(); 
	//m_Len.SetSel(0,sizeof(m_Distance)/6,false);
	m_Len.SetSel(0,1,false);
	UpdateData(false);
	if(g_Array.GetRowSize())
	{
      double MaxDis=0,MinDis=100;
	  int i,j;
	  for(i=0;i<g_Array.GetRowSize();i++)
	 	for(j=0;j<g_Array.GetRowSize();j++)
		{  
			if(j!=i)
			{
			   double gh=sqrt((g_Array.pValue[i][0]-g_Array.pValue[j][0])*(g_Array.pValue[i][0]-g_Array.pValue[j][0])+
				        (g_Array.pValue[i][1]-g_Array.pValue[j][1])*(g_Array.pValue[i][1]-g_Array.pValue[j][1]));
			   if(MaxDis<gh) MaxDis=gh;
			   if(MinDis>gh) MinDis=gh;
			}
		}
	
	  CString str;
      str.Format("最好%.3f---%.3f",MinDis/37.8,MaxDis/37.8);
	  GetDlgItem(IDC_STATIC1)->SetWindowText(str);
	}
	CDialog::OnShowWindow(bShow, nStatus);	

}

⌨️ 快捷键说明

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