📄 setpos.cpp
字号:
// SetPos.cpp : implementation file
//
#include "stdafx.h"
#include "PPPClient.h"
#include "SetPos.h"
#include "pppclientdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern SYSTEM_PARAMETER m_system_para;
extern CString m_ini_pathname;
extern CPPPClientDlg *m_main_dlg;
extern bool m_show_demo_flag;
/////////////////////////////////////////////////////////////////////////////
// CSetPos dialog
CSetPos::CSetPos(CWnd* pParent /*=NULL*/)
: CDialog(CSetPos::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetPos)
m_startx = 0;
m_starty = 0;
//}}AFX_DATA_INIT
}
void CSetPos::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetPos)
DDX_Control(pDX, IDC_SET_BUTTON, m_setbutton);
DDX_Control(pDX, IDC_OK_BUTTON, m_okbutton);
DDX_Text(pDX, IDC_STARTX_EDIT, m_startx);
DDV_MinMaxLong(pDX, m_startx, 0, 1024);
DDX_Text(pDX, IDC_STARTY_EDIT, m_starty);
DDV_MinMaxLong(pDX, m_starty, 0, 768);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetPos, CDialog)
//{{AFX_MSG_MAP(CSetPos)
ON_BN_CLICKED(IDC_OK_BUTTON, OnOkButton)
ON_BN_CLICKED(IDC_SET_BUTTON, OnSetButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetPos message handlers
BOOL CSetPos::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//read parameter file
//...m_startx,m_starty
m_startx=m_system_para.m_show_startx;
m_starty=m_system_para.m_show_starty;
//POS X
CSpinButtonCtrl *pXSpin=(CSpinButtonCtrl *)GetDlgItem(IDC_STARTX_SPIN);
ASSERT(pXSpin!=NULL);
pXSpin->SetBuddy(GetDlgItem(IDC_STARTX_EDIT));
pXSpin->SetRange(0,1024);
pXSpin->SetPos(m_startx);
//POS Y
CSpinButtonCtrl *pYSpin=(CSpinButtonCtrl *)GetDlgItem(IDC_STARTY_SPIN);
ASSERT(pYSpin!=NULL);
pYSpin->SetBuddy(GetDlgItem(IDC_STARTY_EDIT));
pYSpin->SetRange(0,768);
pYSpin->SetPos(m_starty);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetPos::OnOkButton()
{
// TODO: Add your control notification handler code here
EndDialog(0);
}
void CSetPos::OnSetButton()
{
// TODO: Add your control notification handler code here
UpdateData();
m_system_para.m_show_startx=m_startx;
m_system_para.m_show_starty=m_starty;
//save
FILE *fp;
fp=fopen(m_ini_pathname,"wb");
if(fp)
{
fwrite((char*)&m_system_para,1,sizeof(SYSTEM_PARAMETER),fp);
fclose(fp);
}
//
//send set pos size message
m_main_dlg->m_demo_dlg.SetPosSize(m_system_para.m_show_startx,
m_system_para.m_show_starty,
m_system_para.m_show_width,
m_system_para.m_show_height,
m_show_demo_flag);
//设置SERVER的屏的位置
if(m_system_para.softmode)
{
m_main_dlg->SetServerScreenPosition( m_system_para.m_show_startx,m_system_para.m_show_starty);
}
//...
EndDialog(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -