⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 center_dlg.cpp

📁 在屏幕上画出标尺
💻 CPP
字号:
// center_dlg.cpp : implementation file
//

#include "stdafx.h"
#include "标尺.h"
#include "center_dlg.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// center_dlg dialog


center_dlg::center_dlg(CWnd* pParent /*=NULL*/)
	: CDialog(center_dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(center_dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void center_dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(center_dlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(center_dlg, CDialog)
	//{{AFX_MSG_MAP(center_dlg)
	ON_WM_TIMER()
	ON_WM_MOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// center_dlg message handlers

void center_dlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	POINT c_point;
	::GetCursorPos(&c_point);
	CRect   rc;   
	GetWindowRect(&rc);
	int x,y;
	x=c_point.x-rc.Width()/2;
	y=c_point.y-rc.Height()/2;
	this->MoveWindow(x,y,rc.Width(),rc.Height());
	CDialog::OnTimer(nIDEvent);
}

void center_dlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	POINT c_point;
	::GetCursorPos(&c_point);
	center_x=c_point.x;
	center_y=c_point.y;
	CDialog::OnCancel();
}

BOOL center_dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	SetTimer(1,10,NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void center_dlg::OnMove(int x, int y) 
{
	CDialog::OnMove(x, y);
	
	// TODO: Add your message handler code here
//刷新整个屏幕
	ICONMETRICS   im;   
	im.cbSize=sizeof(ICONMETRICS);   
	SystemParametersInfo(SPI_GETICONMETRICS,sizeof(ICONMETRICS),(PVOID)&im,0);   
	SystemParametersInfo(SPI_SETICONMETRICS,sizeof(ICONMETRICS),(PVOID)&im,SPIF_SENDCHANGE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -