www.pudn.com > 44757463.rar > GraphInfoDlg.cpp


// GraphInfoDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "graphsoft.h" 
#include "GraphInfoDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CGraphInfoDlg dialog 
 
 
CGraphInfoDlg::CGraphInfoDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CGraphInfoDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CGraphInfoDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	m_pWndParent=pParent; 
	m_nAngle=0; 
} 
 
 
void CGraphInfoDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CGraphInfoDlg) 
	DDX_Control(pDX, IDCANCEL, m_BtnCancel); 
	DDX_Control(pDX, IDOK, m_BtnOK); 
	DDX_Control(pDX, IDC_MAINTAB, m_ctrlMainTab); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CGraphInfoDlg, CDialog) 
	//{{AFX_MSG_MAP(CGraphInfoDlg) 
	ON_NOTIFY(TCN_SELCHANGING, IDC_MAINTAB, OnSelchangingMaintab) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CGraphInfoDlg message handlers 
 
BOOL CGraphInfoDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	TCITEM item; 
	item.mask = TCIF_TEXT; 
	CString str; 
	str.LoadString(IDS_BASIC_INFO); 
	item.pszText = str.GetBuffer(str.GetLength()); 
	m_ctrlMainTab.InsertItem (0,&item); 
	str.LoadString(IDS_OPERATION_INFO); 
	item.pszText = str.GetBuffer(str.GetLength()); 
	m_ctrlMainTab.InsertItem (1,&item); 
  
	m_sheetExtend.Create (IDD_GRAPHINFO_EXTEND,&m_ctrlMainTab);	 
	m_sheetBasic.Create (IDD_GRAPHINFO_BASIC,&m_ctrlMainTab); 
	 
	 
	 
	CRect r; 
	m_ctrlMainTab.GetClientRect (&r); 
 
	//????why???显示的结果不似想象的那样 
    m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW); 
	m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW  );   
     
    
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CGraphInfoDlg::OnSelchangingMaintab(NMHDR* pNMHDR, LRESULT* pResult)  
{ 
	// TODO: Add your control notification handler code here 
	CRect r; 
	m_ctrlMainTab.GetClientRect (&r); 
	 
	switch(m_ctrlMainTab.GetCurSel()) 
	{ 
	case 1: 
		m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW); 
		m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW );   
		break; 
	case 0: 
		m_sheetBasic.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_HIDEWINDOW); 
		m_sheetExtend.SetWindowPos (NULL,10,30,r.right -20,r.bottom -40,SWP_SHOWWINDOW );   
		break; 
	} 
	*pResult = 0; 
	 
} 
 
void CGraphInfoDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	if(m_sheetBasic.UpdateData(TRUE) && m_sheetExtend.UpdateData(TRUE)){ 
		//Extend Info 
		 
		//组成点 
		if(m_pWndParent && m_sheetExtend.m_nPointFlag>-1) 
			m_pWndParent->SendMessage(WM_SELGRAPH_POINT,WPARAM(m_sheetExtend.m_nPointFlag)); 
		 
		//旋转		 
		CString strText; 
		m_sheetExtend.m_CombAngle.GetWindowText(strText); 
		m_nAngle=atoi(strText);			 
		if(m_pWndParent && m_nAngle!=0) 
			m_pWndParent->SendMessage(WM_SELGRAPH_ROTATE,WPARAM(m_nAngle)); 
    
		//Basic Info 
 
		//线条颜色 
         if(m_pWndParent) 
             m_pWndParent->SendMessage(WM_SELGRAPH_COLOR,WPARAM(m_sheetBasic.m_btnColor.m_color)); 
 
		//填充颜色 
		 if(m_pWndParent && m_sheetBasic.m_CheckFill.GetCheck()){ 
             m_pWndParent->SendMessage(WM_SELGRAPH_FILLCOLOR,WPARAM(m_sheetBasic.m_btnFillclr.m_color)); 
		 } 
		 if(!(m_sheetBasic.m_CheckFill.GetCheck())){//解除填充 
             m_pWndParent->SendMessage(WM_SELGRAPH_FILLSTYLE,WPARAM(0)); 
		 } 
          
 
		//笔宽		  
		  
		 if(m_pWndParent && m_sheetBasic.m_cmboPenWidth.GetCurSel()>=0){ 
			 m_pWndParent->SendMessage(WM_SELGRAPH_PENWIDTH,WPARAM(m_sheetBasic.m_cmboPenWidth.GetCurLineWidth())); 
		 } 
		CDialog::OnOK(); 
	}	 
}