1.先设计自己喜欢的图形

代码

exp1.cpp

// exp1.cpp : Defines the class behaviors for the application.
//#include "stdafx.h"
#include "exp1.h"
#include "exp1Dlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/
// CExp1AppBEGIN_MESSAGE_MAP(CExp1App, CWinApp)//{{AFX_MSG_MAP(CExp1App)// NOTE - the ClassWizard will add and remove mapping macros here.//    DO NOT EDIT what you see in these blocks of generated code!//}}AFX_MSGON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()/
// CExp1App constructionCExp1App::CExp1App()
{// TODO: add construction code here,// Place all significant initialization in InitInstance
}/
// The one and only CExp1App objectCExp1App theApp;/
// CExp1App initializationBOOL CExp1App::InitInstance()
{AfxEnableControlContainer();// Standard initialization// If you are not using these features and wish to reduce the size//  of your final executable, you should remove from the following//  the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();           // Call this when using MFC in a shared DLL
#elseEnable3dControlsStatic();  // Call this when linking to MFC statically
#endifCExp1Dlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse == IDOK){// TODO: Place code here to handle when the dialog is//  dismissed with OK}else if (nResponse == IDCANCEL){// TODO: Place code here to handle when the dialog is//  dismissed with Cancel}// Since the dialog has been closed, return FALSE so that we exit the//  application, rather than start the application's message pump.return FALSE;
}

exp1Dlg.cpp

// exp1Dlg.cpp : implementation file
//#include "stdafx.h"
#include "exp1.h"
#include "exp1Dlg.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/
// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog
{
public:CAboutDlg();// Dialog Data//{{AFX_DATA(CAboutDlg)enum { IDD = IDD_ABOUTBOX };//}}AFX_DATA// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support//}}AFX_VIRTUAL// Implementation
protected://{{AFX_MSG(CAboutDlg)//}}AFX_MSGDECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{//{{AFX_DATA_INIT(CAboutDlg)//}}AFX_DATA_INIT
}void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CAboutDlg)//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)//{{AFX_MSG_MAP(CAboutDlg)// No message handlers//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CExp1Dlg dialogCExp1Dlg::CExp1Dlg(CWnd* pParent /*=NULL*/): CDialog(CExp1Dlg::IDD, pParent)
{//{{AFX_DATA_INIT(CExp1Dlg)//}}AFX_DATA_INIT// Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void CExp1Dlg::DoDataExchange(CDataExchange* pDX)
{CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CExp1Dlg)DDX_Control(pDX, IDC_9, m_pic7);DDX_Control(pDX, IDC_STATICC, m_tt);DDX_Control(pDX, IDC_STATII, m_tm);DDX_Control(pDX, IDC_SSs, m_pic6);DDX_Control(pDX, IDC_STATI, m_pic5);DDX_Control(pDX, IDC_ST, m_picc);DDX_Control(pDX, IDC_S, m_pic);DDX_Control(pDX, IDC_STAT, m_pic4);DDX_Control(pDX, IDC_STA, m_pic3);DDX_Control(pDX, IDC_2, m_pic2);DDX_Control(pDX, IDC_1, m_pic1);//}}AFX_DATA_MAP
}BEGIN_MESSAGE_MAP(CExp1Dlg, CDialog)//{{AFX_MSG_MAP(CExp1Dlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON2, OnButton2)ON_WM_TIMER()ON_BN_CLICKED(IDC_STA, OnSta)ON_BN_CLICKED(IDC_S, OnS)ON_NOTIFY(DTN_CLOSEUP, IDC_DATETIMEPICKER1, OnCloseupDatetimepicker1)//}}AFX_MSG_MAP
END_MESSAGE_MAP()/
// CExp1Dlg message handlersBOOL CExp1Dlg::OnInitDialog()
{CDialog::OnInitDialog();// Add "About..." menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL){CString strAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// Set the icon for this dialog.  The framework does this automatically//  when the application's main window is not a dialogSetIcon(m_hIcon, TRUE);            // Set big iconSetIcon(m_hIcon, FALSE);     // Set small icont = 0;// TODO: Add extra initialization hereSetTimer(1,1000,NULL);return TRUE;  // return TRUE  unless you set the focus to a control
}void CExp1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{if ((nID & 0xFFF0) == IDM_ABOUTBOX){CAboutDlg dlgAbout;dlgAbout.DoModal();}else{CDialog::OnSysCommand(nID, lParam);}
}// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.void CExp1Dlg::OnPaint()
{/*if (IsIconic()){CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icondc.DrawIcon(x, y, m_hIcon);}else{CDialog::OnPaint();}*/CPaintDC dc(this);//用于画图的设备上下文  //加载背景位图  CBitmap bitmap;  bitmap.LoadBitmap(IDB_BITMAP16);  CBrush brush(&bitmap);//建立画刷  dc.SelectObject(brush);  CRect rect;  GetClientRect(rect);//获得客户区大小  dc.Rectangle(rect);//画矩形,并用图片的画刷填充
}// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CExp1Dlg::OnQueryDragIcon()
{return (HCURSOR) m_hIcon;
}void CExp1Dlg::OnOK()
{// TODO: Add extra validation heres=0;SetTimer(1,1000,NULL);//定义时钟1,时间间隔为1000ms   //CDialog::OnOK();
}void CExp1Dlg::OnButton1()
{// TODO: Add your control notification handler code hereKillTimer(1);    //关闭1号定时器
}void CExp1Dlg::OnButton2()
{// TODO: Add your control notification handler code hereCBitmap bitmap;  // CBitmap对象,用于加载位图   HBITMAP hBmp;    // 保存CBitmap加载的位图的句柄   bitmap.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1
}void CExp1Dlg::OnTimer(UINT nIDEvent)
{// TODO: Add your message handler code here and/or call defaultCTime m= CTime::GetCurrentTime(); //获取系统日期CString tt;s=s+1;tt.Format("计时:%d秒",s);m_tt.SetWindowText(tt);CString tm;tm.Format("%02d:%02d:%02d",m.GetHour(),m.GetMinute(),m.GetSecond());SetDlgItemText(IDC_STATII,tm);int ss=m.GetHour();int t5,t6;t5=ss%10;t6=ss/10;t5 = ss%10;t6=ss/10;CBitmap bitmap5;  // CBitmap对象,用于加载位图   HBITMAP hBmp5;    // 保存CBitmap加载的位图的句柄   if(t5 == 0){bitmap5.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 1){bitmap5.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1  }if(t5 == 2){bitmap5.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 3){bitmap5.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 4){bitmap5.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 5){bitmap5.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 6){bitmap5.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 7){bitmap5.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 8){bitmap5.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t5 == 9){bitmap5.LoadBitmap(IDB_BITMAP9);  // 将位图IDB_BITMAP1加载到bitmap   hBmp5 = (HBITMAP)bitmap5.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic5.SetBitmap(hBmp5);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1  }CBitmap bitmap6;  // CBitmap对象,用于加载位图   HBITMAP hBmp6;    // 保存CBitmap加载的位图的句柄   if(t6 == 0){bitmap6.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6 = (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 1){bitmap6.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6 = (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1  }if(t6 == 2){bitmap6.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 3){bitmap6.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1  }if(t6 == 4){bitmap6.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 5){bitmap6.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 6){bitmap6.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 7){bitmap6.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6= (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 8){bitmap6.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6 = (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t6 == 9){bitmap6.LoadBitmap(IDB_BITMAP9);  // 将位图IDB_BITMAP1加载到bitmap   hBmp6 = (HBITMAP)bitmap6.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic6.SetBitmap(hBmp6);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1  }int mm=m.GetMinute();int t3,t4;t3=mm%10;CBitmap bitmap3;  // CBitmap对象,用于加载位图   HBITMAP hBmp3;    // 保存CBitmap加载的位图的句柄   if(t3 == 0){bitmap3.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 1){bitmap3.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 2){bitmap3.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 3){bitmap3.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 4){bitmap3.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 5){bitmap3.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 6){bitmap3.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 7){bitmap3.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 8){bitmap3.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t3 == 9){bitmap3.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp3 = (HBITMAP)bitmap3.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic3.SetBitmap(hBmp3);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }CBitmap bitmap4;  // CBitmap对象,用于加载位图   HBITMAP hBmp4;    // 保存CBitmap加载的位图的句柄   t4=mm/10;if(t4 == 0){bitmap4.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t4 == 1){bitmap4.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t4 == 2){bitmap4.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t4 == 3){bitmap4.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 4){bitmap4.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 5){bitmap4.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 6){bitmap4.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 7){bitmap4.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 8){bitmap4.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }
if(t4 == 9){bitmap4.LoadBitmap(IDB_BITMAP9);  // 将位图IDB_BITMAP1加载到bitmap   hBmp4 = (HBITMAP)bitmap4.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic4.SetBitmap(hBmp4);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }int s=m.GetSecond(); //获取秒int t1, t2;t1 = s % 10;t2=s/10;CBitmap bitmap;  // CBitmap对象,用于加载位图   HBITMAP hBmp;    // 保存CBitmap加载的位图的句柄   if(t1 == 0){bitmap.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 1){bitmap.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 2){bitmap.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 3){bitmap.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 4){bitmap.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 5){bitmap.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 6){bitmap.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 7){bitmap.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 8){bitmap.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t1 == 9){bitmap.LoadBitmap(IDB_BITMAP9);  // 将位图IDB_BITMAP1加载到bitmap   hBmp = (HBITMAP)bitmap.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic1.SetBitmap(hBmp);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }CBitmap bitmap2;  // CBitmap对象,用于加载位图   HBITMAP hBmp2;    // 保存CBitmap加载的位图的句柄   if(t2 == 0){bitmap2.LoadBitmap(IDB_BITMAP0);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 1){bitmap2.LoadBitmap(IDB_BITMAP1);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 2){bitmap2.LoadBitmap(IDB_BITMAP2);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 3){bitmap2.LoadBitmap(IDB_BITMAP3);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 4){bitmap2.LoadBitmap(IDB_BITMAP4);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 5){bitmap2.LoadBitmap(IDB_BITMAP5);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 6){bitmap2.LoadBitmap(IDB_BITMAP6);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 7){bitmap2.LoadBitmap(IDB_BITMAP7);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 8){bitmap2.LoadBitmap(IDB_BITMAP8);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }if(t2 == 9){bitmap2.LoadBitmap(IDB_BITMAP9);  // 将位图IDB_BITMAP1加载到bitmap   hBmp2 = (HBITMAP)bitmap2.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic2.SetBitmap(hBmp2);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 }t = t + 1;CBitmap bitmap7;  // CBitmap对象,用于加载位图   HBITMAP hBmp7;    // 保存CBitmap加载的位图的句柄   bitmap7.LoadBitmap(IDB_BITMAP10);  // 将位图IDB_BITMAP1加载到bitmap   hBmp7 = (HBITMAP)bitmap7.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_pic.SetBitmap(hBmp7);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 CBitmap bitmap8;  // CBitmap对象,用于加载位图   HBITMAP hBmp8;    // 保存CBitmap加载的位图的句柄   bitmap8.LoadBitmap(IDB_BITMAP10);  // 将位图IDB_BITMAP1加载到bitmap   hBmp8 = (HBITMAP)bitmap8.GetSafeHandle();  // 获取bitmap加载位图的句柄   m_picc.SetBitmap(hBmp8);    // 设置图片控件m_jzmPicture的位图图片为IDB_BITMAP1 CDialog::OnTimer(nIDEvent);
}void CExp1Dlg::OnSta()
{// TODO: Add your control notification handler code here}void CExp1Dlg::OnS()
{// TODO: Add your control notification handler code here}void CExp1Dlg::OnCloseupDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{// TODO: Add your control notification handler code here*pResult = 0;
}

然后运行

最终成品展示

如果需要完整代码可以给我留言~

我是热爱学习热爱编程的呵呵哒!

更多原创文章尽情期待!

个人知乎链接:https://www.zhihu.com/people/heheda-84-17/posts

C语言 定时器和计时器相关推荐

  1. c语言定时器作用,Go语言定时器实现原理及作用

    对于任何一个正在运行的应用,如何获取准确的绝对时间都非常重要,但是在一个分布式系统中我们很难保证各个节点上绝对时间的一致性,哪怕通过 NTP 这种标准的对时协议也只能把时间的误差控制在毫秒级,所以相对 ...

  2. C语言模拟质点运动轨迹坐标,C语言定时器的使用 计算质点运动的移位

    C语言定时器的使用 计算质点运动的位移 用C语言编一个质点运动的程序,知道起始点坐标(x1,y1)和终止点坐标(x2,y2),速度v和加速度a也知道,现在就想通过计算每隔一个时间t(假设10毫秒)质点 ...

  3. c语言定时器实验程序,C语言定时器实验.doc

    C语言定时器实验 实验三 C语言定时器实验 一.实验目的 1.进一步熟悉DSP的中断机制 2.在掌握中断服务程序编写的基础上进一步熟悉定时器的运用 3.进一步掌握如何编写DSP中断服务子程序 二.实验 ...

  4. C++11实现高精度定时器、计时器

    C++11实现高精度定时器.计时器 直接上代码 #pragma once #ifndef _TIMER_H_ #define _TIMER_H_#include <functional> ...

  5. linux c语言定时器(附有源码)

    1.主要函数接口的,只说明一个函数接口,下面实例遇见的系统函数接口,自己查. 使用setitimer(2)设置定时器 系统计时器: 系统运行一个进程的时候,进程消耗的时间包括三部分: 用户时间 进程消 ...

  6. go定时器 每天重复_Go语言学习基础-定时器、计时器

    Timer计时器 如果希望在将来的某个时间点执行Go代码,或者在某个时间间隔重复执行Go代码,使用Go内置的timer和ticker功能. 先看定时器timer,然后再看计时器ticker.定时器代表 ...

  7. c语言 定时器作用,单片机定时器的作用及使用方法详解

    单片机定时器的作用及使用方法详解 单片机定时器在单片机的功能是很重要的,它一般被用作定时功能,来做定时检测.定时响应和定时控制,并且可以产生毫秒宽的脉冲信号来驱动步进电机.计时和计数的最终功能是通过计 ...

  8. 用看门狗定时器做计时器,计算程序耗时,超声波测距,FL2440

    开发板:FL2440 核心芯片:S3C2440(ARM9) 超声波模块:HC-SR04 超声波模块工作原理:共四个脚,VCC接5V,GND接地,Trig脚接芯片通过IO传出的高电平(持续时间不低于10 ...

  9. c语言定时器_分享10个值得关注的C语言开源项目

    十个最值得阅读学习的C开源项目代码 1.Webbench 2. Tinyhttpd 3. cJSON 4. CMockery 5. Libev 6. Memcached 7. Lua 8. SQLit ...

最新文章

  1. Python培训教程之Python基础知识点梳理
  2. MySQL数据类型之数字类型详细解析
  3. 企业管理做不好的根源!「管理智慧」
  4. python列表知识点_Python列表List基础知识点总结
  5. HTML-参考手册: HTML 颜色名
  6. Spark _12_每个网址的每个地区访问量 ,由大到小排序
  7. mail、sendEmail发送邮件命令
  8. TypeScript 元组(Tuple)
  9. 360系统修复过程中卡慢问题的解决方案
  10. java web 课程设计_javaweb期末课程设计
  11. Lrc2srt精灵,增加自定义输出编码
  12. route命令实现内外网切换
  13. 编译安装libmodbus库
  14. 最短路径BFS算法matlab,数据结构笔记——最短路径BFS算法
  15. c语言中位运算符及用法
  16. 关于语法节点Tree、类型Type和符号Symbol
  17. Live800:中小企业如何选择在线客服系统?
  18. [安全分享]斗鱼360补天沙龙分享-跨域资源那些事
  19. Android 自定义SeekBar 的thumb遮挡问题解决
  20. 计算机对哪种储存器访问最快,计算机中访问速度最快的存储器是

热门文章

  1. 迅雷链总工程师来鑫:在解决了区块链应用四大问题后,迅雷链今年将在密码领域为行业贡献...
  2. 服务器装系统都会有哪些坑,小白装机避坑——电脑装系统篇 二
  3. JAVA编程求单源最短路径_【算法】单源最短路径——dijkstra算法
  4. 玩端游吃鸡显示服务器,绝地求生:端游和手游的5个不同点,最后一个前者输得一败涂地!...
  5. js网页时钟(附素材抠图)
  6. 领扣问题1. 两数之和领python解决方案
  7. 【周鸿祎】给创业者的三个建议:融…
  8. 报错 java: 程序包javax.servlet.http不存在
  9. 树莓派的硬件解码播放神器——Omxplayer
  10. 如何用强化学习优化广告投放中的A/B Test