📄 demodlg.cpp
字号:
// DemoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "initialposition.h"
#include "DemoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDemoDlg dialog
CDemoDlg::CDemoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDemoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDemoDlg)
m_nX = 0;
m_nY = 0;
m_nShape = -1;
//}}AFX_DATA_INIT
}
void CDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDemoDlg)
DDX_Control(pDX, IDC_SHAPE, m_cmbShape);
DDX_Control(pDX, IDC_Y, m_edtY);
DDX_Control(pDX, IDC_X, m_edtX);
DDX_Text(pDX, IDC_X, m_nX);
DDX_Text(pDX, IDC_Y, m_nY);
DDX_CBIndex(pDX, IDC_SHAPE, m_nShape);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDemoDlg, CDialog)
//{{AFX_MSG_MAP(CDemoDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////
// EkGetActiveView : function implementation
//
// Return the active view window or NULL
CView* EkGetActiveView()
{
CWnd* pMainWnd = AfxGetMainWnd();
ASSERT_VALID( pMainWnd );
if( !pMainWnd->IsKindOf( RUNTIME_CLASS( CFrameWnd ) ) )
{
return NULL;
}
return static_cast<CFrameWnd*>( pMainWnd )
->GetActiveFrame()->GetActiveView();
}
/////////////////////////////////////////////////////////////////////////////
// CDemoDlg message handlers
BOOL CDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Move dialog top-left corner to current point
// in active frame window
// 1 - Get active view window rectangle in
// screen coordinates
CWnd* pActiveView = EkGetActiveView();
ASSERT_VALID( pActiveView );
CRect rcActiveView;
pActiveView->GetWindowRect( &rcActiveView );
// 2 - Move the dialog to the desired position
SetWindowPos( NULL,
rcActiveView.left + m_nX,
rcActiveView.top + m_nY,
0, 0,
SWP_NOSIZE | SWP_NOZORDER );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -