newDialog.cpp
上传用户:xmsintoyu
上传日期:2022-05-05
资源大小:9731k
文件大小:1k
源码类别:

绘图程序

开发平台:

Visual C++

  1. // newDialog.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "DDALineDoc.h"
  5. #include "DDALineView.h"
  6. #include "DDALine.h"
  7. #include "newDialog.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // newDialog dialog
  15. newDialog::newDialog(CWnd* pParent /*=NULL*/)
  16. : CDialog(newDialog::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(newDialog)
  19. m_x0 = 0;
  20. m_x1 = 0;
  21. m_y0 = 0;
  22. m_y1 = 0;
  23. //}}AFX_DATA_INIT
  24. }
  25. void newDialog::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CDialog::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(newDialog)
  29. DDX_Text(pDX, IDC_X0, m_x0);
  30. DDX_Text(pDX, IDC_X1, m_x1);
  31. DDX_Text(pDX, IDC_Y0, m_y0);
  32. DDX_Text(pDX, IDC_Y1, m_y1);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(newDialog, CDialog)
  36. //{{AFX_MSG_MAP(newDialog)
  37. ON_BN_CLICKED(IDC_CLEAR, OnClear)
  38. //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // newDialog message handlers
  42. void newDialog::OnClear() 
  43. {
  44. m_x0=m_x1=m_y0=m_y1=0;
  45. UpdateData(false);
  46. }
  47. void newDialog::OnOK() 
  48. {
  49. UpdateData(true);
  50.   if(m_x0==m_x1 && m_y0==m_y1)
  51.   {
  52.   AfxMessageBox("两个顶点不能相同!");
  53.   m_x0=m_x1=m_y0=m_y1=0;
  54.   UpdateData(false);
  55. return;
  56.   }
  57. CDialog::OnOK();
  58. }