QDlgTextSet.cpp
资源名称:QGIS.rar [点击查看]
上传用户:oybseng
上传日期:2015-04-27
资源大小:7831k
文件大小:3k
源码类别:
GDI/图象编程
开发平台:
Visual C++
- // E:祁强资料集合QGISQDlgQDlgTextSet.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "..QGIS.h"
- #include "QDlgTextSet.h"
- #include "..QObjectsincludeQTextObj.h"
- // QDlgTextSet 对话框
- IMPLEMENT_DYNAMIC(QDlgTextSet, CDialog)
- QDlgTextSet::QDlgTextSet(CWnd* pParent /*=NULL*/)
- : CDialog(QDlgTextSet::IDD, pParent)
- , m_szText(_T(""))
- , m_fXPos(0.0)
- , m_fYPos(0)
- , m_fTextHeight(0)
- , m_fTextWidth(0)
- , m_fOffWide(0)
- , m_fFontAngle(0)
- , m_fTextAngle(0)
- , m_pTextObj(NULL)
- {
- }
- QDlgTextSet::QDlgTextSet(CQTextObj * pTextObj,CWnd* pParent /* = NULL */)
- : CDialog(QDlgTextSet::IDD, pParent)
- , m_szText(_T(""))
- , m_fXPos(0.0)
- , m_fYPos(0)
- , m_fTextHeight(0)
- , m_fTextWidth(0)
- , m_fOffWide(0)
- , m_fFontAngle(0)
- , m_fTextAngle(0)
- , m_pTextObj(pTextObj)
- {
- memcpy(&m_lFont,const_cast<LOGFONT *>(&m_pTextObj->GetFont()),sizeof(LOGFONT));
- }
- QDlgTextSet::~QDlgTextSet()
- {
- }
- void QDlgTextSet::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Text(pDX, IDC_EDIT_TEXT_QTEXT_DLG, m_szText);
- DDX_Text(pDX, IDC_EDIT_X_TEXT_TEXTDLG, m_fXPos);
- DDX_Text(pDX, IDC_EDIT_Y_TEXT_TEXTDLG, m_fYPos);
- DDX_Text(pDX, IDC_EDIT_HEIGHT_TEXT_DLG, m_fTextHeight);
- DDX_Text(pDX, IDC_EDIT_WIDTH_TEXT_DLG, m_fTextWidth);
- DDX_Text(pDX, IDC_EDIT_OFFWIDE_TEXT_DLG, m_fOffWide);
- DDX_Text(pDX, IDC_EDIT_FONTROTATE_TEXT_DLG, m_fFontAngle);
- DDX_Text(pDX, IDC_EDIT_TEXTROTATE_TEXT_DLG, m_fTextAngle);
- }
- BEGIN_MESSAGE_MAP(QDlgTextSet, CDialog)
- ON_BN_CLICKED(IDC_BUTTON_FONT_SET_TEXT_DLG, &QDlgTextSet::OnBnClickedButtonFontSetTextDlg)
- END_MESSAGE_MAP()
- // QDlgTextSet 消息处理程序
- BOOL QDlgTextSet::OnInitDialog()
- {
- CDialog::OnInitDialog();
- if(m_pTextObj == NULL)
- return FALSE;
- m_szText = m_pTextObj->GetText(); //获取标注内容
- m_fXPos = m_pTextObj->GetPos().GetX();
- m_fYPos = m_pTextObj->GetPos().GetY();
- m_fTextHeight = m_pTextObj->GetHeight();
- m_fTextWidth = m_pTextObj->GetWidth();
- m_fOffWide = m_pTextObj->GetOffWidth();
- m_fFontAngle = m_pTextObj->GetFontAngle();
- m_fTextAngle = m_pTextObj->GetTextAngle();
- UpdateData(FALSE);
- return TRUE;
- }
- void QDlgTextSet::OnOK()
- {
- UpdateData(TRUE);
- if(m_pTextObj == NULL)
- return;
- m_pTextObj->SetText(m_szText);
- m_pTextObj->SetHeight(m_fTextHeight);
- m_pTextObj->SetWidth(m_fTextWidth);
- m_pTextObj->SetOffWidth(m_fOffWide);
- m_pTextObj->SetFontAngle(m_fFontAngle);
- m_pTextObj->SetTextAngle(m_fTextAngle);
- m_pTextObj->SetFont(m_lFont);
- CDialog::OnOK();
- UpdateData(FALSE);
- }
- // 字体设置
- void QDlgTextSet::OnBnClickedButtonFontSetTextDlg()
- {
- if(m_pTextObj == NULL)
- return;
- CFontDialog dlg;
- LOGFONT lf = m_pTextObj->GetFont();
- memcpy(dlg.m_cf.lpLogFont,const_cast<LOGFONT *>(&lf),sizeof(LOGFONT));
- if(dlg.DoModal() == IDOK)
- {
- memcpy(&lf,dlg.m_cf.lpLogFont,sizeof(LOGFONT));
- memcpy(&m_lFont,const_cast<LOGFONT *>(&lf),sizeof(LOGFONT));
- }
- }