📄 tsdlg.cpp
字号:
// TSDlg.cpp : implementation file
//
#include "stdafx.h"
#include "TS.h"
#include "TSDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTSDlg dialog
HINSTANCE hinst;
CTSDlg::CTSDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTSDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTSDlg)
m_show = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTSDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTSDlg)
DDX_Text(pDX, IDC_EDIT1, m_show);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTSDlg, CDialog)
//{{AFX_MSG_MAP(CTSDlg)
ON_BN_CLICKED(IDC_NO1, OnNo1)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTSDlg message handlers
BOOL CTSDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
hinst=AfxGetApp()->m_hInstance;
bmpBG=LoadBitmap(hinst,MAKEINTRESOURCE(IDB_BITMAP1));
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CTSDlg::OnNo1()
{
// TODO: Add your control notification handler code here
SYSTEMTIME showNowTime;
//获取系统时间类
GetLocalTime(&showNowTime);
//获取本地时间
CString TimeString,m_timeshow;
//转换
//CString temp,temp1,temp2,str1,str2;
TimeString.Format(_T("%4d-%2d-%2d %2d:%2d:%2d")
,showNowTime.wYear
,showNowTime.wMonth
,showNowTime.wDay
,showNowTime.wHour
,showNowTime.wMinute
,showNowTime.wSecond);
//定义时间格式
//当前系统时间准确时间_tandow_2007-10-10_by_MercuryXu
// other.....
//m_timeshow = TimeString;
// AfxMessageBox(TimeString);
UpdateData(TRUE);
m_show=TimeString;
//作用是实现数据的实时更新有效性
UpdateData(FALSE);
}
void CTSDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC dcMemory;
CPaintDC *pDC=&dc;
dcMemory.CreateCompatibleDC(NULL);
BITMAP bm;
memset(&bm,0,sizeof(bm));
GetObject(bmpBG,sizeof(bm),&bm);
HBITMAP oldbmp=(HBITMAP)dcMemory.SelectObject(bmpBG);
pDC->BitBlt(0,0,
bm.bmWidth,bm.bmHeight,&dcMemory,0,
0,SRCCOPY);
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -