TextWriteDlg.cpp
资源名称:基本GIS系统开发.rar [点击查看]
上传用户:yklx818
上传日期:2013-04-13
资源大小:459k
文件大小:3k
源码类别:
GIS编程
开发平台:
Visual C++
- // TextWriteDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "Draw.h"
- #include "TextWriteDlg.h"
- #include "DrawView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // TextWriteDlg dialog
- TextWriteDlg::TextWriteDlg(CWnd* pParent /*=NULL*/)
- : CDialog(TextWriteDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(TextWriteDlg)
- m_Text = _T("");
- //}}AFX_DATA_INIT
- }
- TextWriteDlg::TextWriteDlg(CWnd* pParent,CString Text)
- : CDialog(TextWriteDlg::IDD, pParent)
- {
- m_pView=(CDrawView*)pParent;//记录传入的指针
- m_Text1=Text; //标注文本的内容
- }
- void TextWriteDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(TextWriteDlg)
- DDX_Text(pDX, IDC_TEXT_EDIT1, m_Text);
- DDV_MaxChars(pDX,m_Text,300);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(TextWriteDlg, CDialog)
- //{{AFX_MSG_MAP(TextWriteDlg)
- ON_EN_CHANGE(IDC_TEXT_EDIT1, OnChangeText)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // TextWriteDlg message handlers
- void TextWriteDlg::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- m_pView->SendMessage(WM_COMMAND,ID_TEXT_ONOK);
- m_Text=m_Text1;
- CDialog::OnOK();
- }
- void TextWriteDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- m_pView->SendMessage(WM_COMMAND,ID_TEXT_ONCANCEL);
- m_Text="";
- CDialog::OnCancel();
- }
- void TextWriteDlg::OnChangeText()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CDialog::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- // TODO: Add your control notification handler code here
- UpdateData(); //将控制中的内容传递到映射变量
- m_pView->SendMessage(WM_COMMAND,ID_TEXT_MESSAGE);
- }
- BOOL TextWriteDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- CEdit* pEdit=(CEdit*)GetDlgItem(IDC_TEXT_EDIT1);
- pEdit->SetFocus(); //进入对话框时,将输入焦点设置在编辑框内
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- BOOL TextWriteDlg::IsOpen()
- {
- return(m_hWnd?TRUE:FALSE);
- }
- BOOL TextWriteDlg::IsVisible()
- {
- if(!IsOpen())
- return FALSE;
- WINDOWPLACEMENT scrn;
- GetWindowPlacement(&scrn);
- if(scrn.showCmd==SW_SHOW)
- return TRUE;
- else
- return FALSE;
- }
- void TextWriteDlg::Init(CString Text)
- {
- m_Text=Text;
- }