📄 lineset.cpp
字号:
// LineSet.cpp : implementation file
//
#include "stdafx.h"
#include "direction2.h"
#include "LineSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLineSet dialog
CLineSet::CLineSet(CWnd* pParent /*=NULL*/)
: CDialog(CLineSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CLineSet)
m_linewidth = 0;
m_name = _T("");
m_zhi = 0;
//}}AFX_DATA_INIT
objectindex=-1;
m_textcolor=RGB(0,0,0);
m_linecolor=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" );
m_pParentWnd=pParent;
}
void CLineSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLineSet)
DDX_Control(pDX, IDC_COMBO1, m_linestyle);
DDX_Text(pDX, IDC_EDIT1, m_linewidth);
DDX_Text(pDX, IDC_EDIT4, m_name);
DDX_Text(pDX, IDC_EDIT3, m_zhi);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLineSet, CDialog)
//{{AFX_MSG_MAP(CLineSet)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1font)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2color)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLineSet message handlers
void CLineSet::Updatelinedata(COLORREF linecolor,COLORREF textcolor,LOGFONT text,int linewidth,long zhi,CString name,int index)
{
m_linecolor=linecolor;
m_text=text;
m_textcolor=textcolor;
m_linewidth=linewidth;
m_zhi=zhi;
m_name=name;
m_linestyle.SetCurSel(index);
this->UpdateData(false);
}
void CLineSet::OnButton1font()
{
// 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 CLineSet::OnButton2color()
{
// TODO: Add your control notification handler code here
//直线颜色设计
CColorDialog Colordialog(m_linecolor,CC_FULLOPEN,this);
if(Colordialog.DoModal()==IDOK)
{
m_linecolor = Colordialog.GetColor();
}
}
void CLineSet::OnOK()
{
// TODO: Add extra validation here
this->UpdateData(true);
int i=objectindex;
m_pParentWnd->SendMessage(WM_CHANGE_LINE,0,(LPARAM)i);//改变直线属性的消息
CDialog::OnOK();
}
BOOL CLineSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString str1[5]={"实 线 --------- ","虚 线 - - - - - ","点 线 . . . . . ","点划线 _._._._._","双点划线 _.._.._.._"};
for(int i=0;i<5;i++)
{
m_linestyle.InsertString(i,str1[i]);
}
m_linestyle.SetCurSel(0);//去掉后则什么也不显示,为什么?谢谢
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CLineSet::GetIndex()
{
return objectindex;
}
void CLineSet::SetIndex(int i)
{
objectindex=i;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -