📄 rectset.cpp
字号:
// RectSet.cpp : implementation file
//
#include "stdafx.h"
#include "direction2.h"
#include "RectSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRectSet dialog
CRectSet::CRectSet(CWnd* pParent /*=NULL*/)
: CDialog(CRectSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CRectSet)
m_name = _T("");
m_high = 0;
m_width = 0;
m_zhi = 0;
//}}AFX_DATA_INIT
m_pParentWnd=pParent;
objectindex=-1;
m_incolor=RGB(0,0,0);
m_sidecolor=RGB(0,0,0);
m_textcolor=RGB(0,0,0);
//字体式样字体大小
m_text.lfHeight = 17;
m_text.lfWidth = 0;
m_text.lfEscapement=0;
m_text.lfOrientation =0;
m_text.lfWeight = FW_NORMAL;
m_text.lfItalic = FALSE;
m_text.lfUnderline = FALSE;
m_text.lfStrikeOut = FALSE;
m_text.lfCharSet= GB2312_CHARSET;
m_text.lfOutPrecision = OUT_STROKE_PRECIS;
m_text.lfClipPrecision = CLIP_STROKE_PRECIS;
m_text.lfQuality = DRAFT_QUALITY;
m_text.lfPitchAndFamily = VARIABLE_PITCH|FF_MODERN;
strcpy(m_text.lfFaceName,"仿宋_GB2312" );
}
void CRectSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRectSet)
DDX_Control(pDX, IDC_CHECK2, m_over);
DDX_Control(pDX, IDC_CHECK1, m_begin);
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT2, m_high);
DDX_Text(pDX, IDC_EDIT3, m_width);
DDX_Text(pDX, IDC_EDIT4, m_zhi);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRectSet, CDialog)
//{{AFX_MSG_MAP(CRectSet)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1incolor)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2sidecolor)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3font)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRectSet message handlers
void CRectSet::updaterectdata(COLORREF incolor,COLORREF sidecolor,COLORREF textcolor,LOGFONT text,long zhi,int high,int width,CString name)
{
m_incolor=incolor;
m_sidecolor=sidecolor;
m_text=text; //字体式样字体大小
m_name=name;
m_zhi=zhi;
m_high=high;
m_width=width;
m_textcolor =textcolor;
this->UpdateData(false); //更新窗口的数据显示
}
void CRectSet::OnButton1incolor()
{
// TODO: Add your control notification handler code here
//矩形填充颜色
CColorDialog Colordialog(m_incolor,CC_FULLOPEN,this);
if(Colordialog.DoModal()==IDOK)
{
m_incolor = Colordialog.GetColor();
}
}
void CRectSet::OnButton2sidecolor()
{
// TODO: Add your control notification handler code here
//矩形边框颜色
CColorDialog Colordialog(m_sidecolor,CC_FULLOPEN,this);
if(Colordialog.DoModal()==IDOK)
{
m_sidecolor = Colordialog.GetColor();
}
}
void CRectSet::OnButton3font()
{
// TODO: Add your control notification handler code here
//字体设计
CFontDialog dlg;
dlg.m_cf.lpLogFont =&m_text;
dlg.m_cf.rgbColors=m_textcolor;
dlg.m_cf.Flags|=CF_INITTOLOGFONTSTRUCT; //设置标志
if(dlg.DoModal() == IDOK)
{
dlg.GetCurrentFont(&m_text);
m_textcolor = dlg.GetColor();
}
}
void CRectSet::OnOK()
{
// TODO: Add extra validation here
this->UpdateData(true);
int i=objectindex;
m_pParentWnd->SendMessage(WM_CHANGE_RECTSHX,0,(LPARAM)i); //通过此消息告诉父窗口矩形的属性已经改变
CDialog::OnOK();
}
BOOL CRectSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CRectSet::SetIndex(int i)
{
objectindex=i;
}
int CRectSet::GetIndex()
{
return objectindex;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -