码迷,mamicode.com
首页 > 其他好文 > 详细

wxTimer 定时器

时间:2016-12-22 20:45:21      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:ontimer wxtimerevent

说明

    OnIdle CPU空闲的情况下处理消息,如果需要定时功能,就需要使用定时器wxTimer 


例子

#include "wx/timer.h"


private:

wxTimer *m_timer;


#define TIMER_ID 1000


EVT_TIMER(TIMER_ID, CFlightInstrumentPanel::OnTimer)


m_timer = new wxTimer(this, TIMER_ID);

m_timer->Start(1000);


void CFlightInstrumentPanel::OnTimer( wxTimerEvent& event )

{

static int x = 0;

if (x<1000)

{

wxClientDC dc(this);

wxPen pen(*wxRED,1);

dc.SetPen(pen);

dc.DrawRectangle(x, 0, 200, 300);

dc.SetPen(wxNullPen);

x=x+100;

}

}


wxTimer 定时器

标签:ontimer wxtimerevent

原文地址:http://fengyuzaitu.blog.51cto.com/5218690/1885095

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!