TextpropDlg.cpp
上传用户:ywlong9188
上传日期:2022-05-31
资源大小:2656k
文件大小:2k
- // TextpropDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "TextpropDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CTextpropDlg dialog
- CTextpropDlg::CTextpropDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CTextpropDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CTextpropDlg)
- m_sFontName = _T("");
- m_sPointSize = _T("");
- m_sText = _T("");
- m_nAttr = -1;
- m_name = _T("");
- //}}AFX_DATA_INIT
- m_nSize = 20;
- }
- void CTextpropDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CTextpropDlg)
- DDX_Control(pDX, IDC_TEXT_POINTSIZE, m_cPointSize);
- DDX_Control(pDX, IDC_TEXT_FONTNAME, m_cFontName);
- DDX_Text(pDX, IDC_TEXT_FONTNAME, m_sFontName);
- DDX_Text(pDX, IDC_TEXT_POINTSIZE, m_sPointSize);
- DDX_Text(pDX, IDC_TEXT_TEXT, m_sText);
- DDX_Radio(pDX, IDC_TEXT_NORMAL, m_nAttr);
- DDX_Text(pDX, IDC_TEXT_NAME, m_name);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CTextpropDlg, CDialog)
- //{{AFX_MSG_MAP(CTextpropDlg)
- ON_BN_CLICKED(IDC_TEXT_SET, OnTextSet)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CTextpropDlg message handlers
- void CTextpropDlg::OnTextSet()
- {
- CFontDialog fDlg( &m_logFont);
- fDlg.m_cf.rgbColors = m_cColor;
- if( fDlg.DoModal() == IDOK)
- {
- CString str;
-
- m_nSize = fDlg.GetSize()/10;
- if(!fDlg.GetFaceName().IsEmpty())
- m_sFaceName = fDlg.GetFaceName();
- m_cColor = fDlg.GetColor();
- fDlg.GetCurrentFont( &m_logFont );
- str.Format("%d",m_nSize);
- m_cPointSize.SetWindowText(str);
- m_cFontName.SetWindowText(m_sFaceName);
-
- }
- }
- int CTextpropDlg::GetSize()
- {
- return m_nSize;
- }
- CString CTextpropDlg::GetFaceName()
- {
- return m_sFaceName;
- }
- void CTextpropDlg::SetColor(COLORREF& color)
- {
- m_cColor = color;
- }
- void CTextpropDlg::GetColor(COLORREF& color)
- {
- color = m_cColor;
- }
- void CTextpropDlg::SetText(CString& str)
- {
- m_sText = str;
- }
- void CTextpropDlg::GetText(CString& str)
- {
- str = m_sText;
- }