GraphInfoDlg.cpp
上传用户:lj3531212
上传日期:2007-06-18
资源大小:346k
文件大小:4k
源码类别:

绘图程序

开发平台:

Visual C++

  1. // GraphInfoDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "graphsoft.h"
  5. #include "GraphInfoDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CGraphInfoDlg dialog
  13. CGraphInfoDlg::CGraphInfoDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CGraphInfoDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CGraphInfoDlg)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. m_pWndParent=pParent;
  20. m_nAngle=0;
  21. }
  22. void CGraphInfoDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CGraphInfoDlg)
  26. DDX_Control(pDX, IDCANCEL, m_BtnCancel);
  27. DDX_Control(pDX, IDOK, m_BtnOK);
  28. DDX_Control(pDX, IDC_MAINTAB, m_ctrlMainTab);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CGraphInfoDlg, CDialog)
  32. //{{AFX_MSG_MAP(CGraphInfoDlg)
  33. ON_NOTIFY(TCN_SELCHANGING, IDC_MAINTAB, OnSelchangingMaintab)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CGraphInfoDlg message handlers
  38. BOOL CGraphInfoDlg::OnInitDialog() 
  39. {
  40. CDialog::OnInitDialog();
  41. // TODO: Add extra initialization here
  42. TCITEM item;
  43. item.mask = TCIF_TEXT;
  44. CString str;
  45. str.LoadString(IDS_BASIC_INFO);
  46. item.pszText = str.GetBuffer(str.GetLength());
  47. m_ctrlMainTab.InsertItem (0,&item);
  48. str.LoadString(IDS_OPERATION_INFO);
  49. item.pszText = str.GetBuffer(str.GetLength());
  50. m_ctrlMainTab.InsertItem (1,&item);
  51.  
  52. m_sheetExtend.Create (IDD_GRAPHINFO_EXTEND,&m_ctrlMainTab);
  53. m_sheetBasic.Create (IDD_GRAPHINFO_BASIC,&m_ctrlMainTab);
  54. CRect r;
  55. m_ctrlMainTab.GetClientRect (&r);
  56. //????why???显示的结果不似想象的那样
  57.     m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW);
  58. m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW  );  
  59.     
  60.    
  61. return TRUE;  // return TRUE unless you set the focus to a control
  62.               // EXCEPTION: OCX Property Pages should return FALSE
  63. }
  64. void CGraphInfoDlg::OnSelchangingMaintab(NMHDR* pNMHDR, LRESULT* pResult) 
  65. {
  66. // TODO: Add your control notification handler code here
  67. CRect r;
  68. m_ctrlMainTab.GetClientRect (&r);
  69. switch(m_ctrlMainTab.GetCurSel())
  70. {
  71. case 1:
  72. m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW);
  73. m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW );  
  74. break;
  75. case 0:
  76. m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW);
  77. m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW );  
  78. break;
  79. }
  80. *pResult = 0;
  81. }
  82. void CGraphInfoDlg::OnOK() 
  83. {
  84. // TODO: Add extra validation here
  85. if(m_sheetBasic.UpdateData(TRUE) && m_sheetExtend.UpdateData(TRUE)){
  86. //Extend Info
  87. //组成点
  88. if(m_pWndParent && m_sheetExtend.m_nPointFlag>-1)
  89. m_pWndParent->SendMessage(WM_SELGRAPH_POINT,WPARAM(m_sheetExtend.m_nPointFlag));
  90. //旋转
  91. CString strText;
  92. m_sheetExtend.m_CombAngle.GetWindowText(strText);
  93. m_nAngle=atoi(strText);
  94. if(m_pWndParent && m_nAngle!=0)
  95. m_pWndParent->SendMessage(WM_SELGRAPH_ROTATE,WPARAM(m_nAngle));
  96.    
  97. //Basic Info
  98. //线条颜色
  99.          if(m_pWndParent)
  100.              m_pWndParent->SendMessage(WM_SELGRAPH_COLOR,WPARAM(m_sheetBasic.m_btnColor.m_color));
  101. //填充颜色
  102.  if(m_pWndParent && m_sheetBasic.m_CheckFill.GetCheck()){
  103.              m_pWndParent->SendMessage(WM_SELGRAPH_FILLCOLOR,WPARAM(m_sheetBasic.m_btnFillclr.m_color));
  104.  }
  105.  if(!(m_sheetBasic.m_CheckFill.GetCheck())){//解除填充
  106.              m_pWndParent->SendMessage(WM_SELGRAPH_FILLSTYLE,WPARAM(0));
  107.  }
  108.          
  109. //笔宽  
  110.  
  111.  if(m_pWndParent && m_sheetBasic.m_cmboPenWidth.GetCurSel()>=0){
  112.  m_pWndParent->SendMessage(WM_SELGRAPH_PENWIDTH,WPARAM(m_sheetBasic.m_cmboPenWidth.GetCurLineWidth()));
  113.  }
  114. CDialog::OnOK();
  115. }
  116. }