亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dynamicled.cpp

?? cp2102 官方usb開發包
?? CPP
字號:
// DynamicLED.cpp : implementation file
//

#include "stdafx.h"
#include "DynLED.h"
#include "DynamicLED.h"

#define ID_TIMER_START 1001

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

/////////////////////////////////////////////////////////////////////////////
// CDynamicLED

CDynamicLED::CDynamicLED()
{
	// Initialize the variables
	m_bBlink = TRUE;
	m_bBright = FALSE;
	m_nTimerInterval = 0;
	m_nPrevTimerInterval = 0;
}

CDynamicLED::~CDynamicLED()
{
}

BEGIN_MESSAGE_MAP(CDynamicLED, CStatic)
	//{{AFX_MSG_MAP(CDynamicLED)
	ON_WM_PAINT()
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDynamicLED message handlers

void CDynamicLED::SetLED(CWnd *pWnd, UINT nIDColor, UINT nIDShape, int nTimerInterval)
{
	this->m_hWnd = pWnd->m_hWnd;

	// Save the color,shape and the timer interval of the control as it 
	// will be used later when resetting the LED to its previous state.
	m_nID = nIDColor;
	m_nShape = nIDShape;
	
	m_nTimerInterval = nTimerInterval;
	m_nPrevTimerInterval = nTimerInterval;

	// Kickoff the timer
	SetTimer(ID_TIMER_START,m_nTimerInterval,NULL);
}

void CDynamicLED::ResetLED(UINT nIDColor, UINT nIDShape, int nTimerInterval)
{
	// This function is used internally by the class to get the previously
	// stored values and reset the LED. Please dont use this function directly
	// from your class as it would throw a compilation error as this has been
	// declared as a private function.

	m_nID = nIDColor;
	m_nShape = nIDShape;
	m_nTimerInterval = nTimerInterval;
	SetTimer(ID_TIMER_START,m_nTimerInterval,NULL);
}

void CDynamicLED::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	// I'm doing nothing here. If you want to do something here,feel free to do so
}

void CDynamicLED::OnTimer(UINT nIDEvent) 
{
	// If the timer value is zero, we dont want to do anything
	// It means that the LED is in a switched off state. So just return
	if(m_nTimerInterval==0)
		return;

	UpdateLED();
/*	// Get the Device Context
	CClientDC dc(this);
	
	// Get the rectangle of the window where we are going to draw
	CRect rcClient;
	GetClientRect(&rcClient);

	// If the pen has been selected already, then we have to delete it
	// so that it doesnt throw an assertion

	if(m_PenBright.m_hObject!=NULL)
		m_PenBright.DeleteObject();

	if(m_BrushBright.m_hObject!=NULL)
		m_BrushBright.DeleteObject();

	if(m_PenDark.m_hObject!=NULL)
		m_PenDark.DeleteObject();

	if(m_BrushDark.m_hObject!=NULL)
		m_BrushDark.DeleteObject();	

	// If the user has selected RED as the color of the LED
	if(m_nID==ID_LED_RED)
	{
		// I'm creating a light shade of red here for displaying the bright
		// LED. You can change the values to any colour that you want
		m_PenBright.CreatePen(0,1,RGB(250,0,0));
		m_BrushBright.CreateSolidBrush(RGB(250,0,0));

		// Here i'm creating a dark shade of red. You can play with the values to
		// see the effect on the LED control

		m_PenDark.CreatePen(0,1,RGB(150,0,0));
		m_BrushDark.CreateSolidBrush(RGB(150,0,0));
	}
	else if(m_nID==ID_LED_GREEN)
	{
		// If the user has selected GREEN as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(0,250,0));
		m_BrushBright.CreateSolidBrush(RGB(0,250,0));

		m_PenDark.CreatePen(0,1,RGB(0,150,0));
		m_BrushDark.CreateSolidBrush(RGB(0,150,0));
	}
	else if(m_nID==ID_LED_BLUE)
	{
		// If the user has selected BLUE as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(0,0,250));
		m_BrushBright.CreateSolidBrush(RGB(0,0,250));

		m_PenDark.CreatePen(0,1,RGB(0,0,150));
		m_BrushDark.CreateSolidBrush(RGB(0,0,150));
	}
	else if(m_nID==ID_LED_YELLOW)
	{
		// If the user has selected YELLOW as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(200,200 ,0));
		m_BrushBright.CreateSolidBrush(RGB(200,200,0));

		m_PenDark.CreatePen(0,1,RGB(150,150,0));
		m_BrushDark.CreateSolidBrush(RGB(150,150,0));
	}


	if(m_bBright==TRUE)
	{
		// If we have to switch on the LED to display the bright colour select
		// the bright pen and brush that we have created above

		dc.SelectObject(&m_PenBright);
		dc.SelectObject(&m_BrushBright);

		m_BrushCurrent.m_hObject = m_BrushBright.m_hObject;

		m_bBright = FALSE;
	}
	else
	{
		// If we have to switch off the LED to display the dark colour select
		// the bright pen and brush that we have created above

		dc.SelectObject(&m_PenDark);
		dc.SelectObject(&m_BrushDark);

		m_BrushCurrent.m_hObject = m_BrushDark.m_hObject;

		m_bBright = TRUE;
	}

	// If the round shape has been selected for the control 
	if(m_nShape==ID_SHAPE_ROUND)
	{
		// Draw the actual colour of the LED
		dc.Ellipse(rcClient);

		// Draw a thick dark gray coloured circle
		CPen Pen;
		Pen.CreatePen(0,2,RGB(128,128,128));
		dc.SelectObject(&Pen);
		
		dc.Ellipse(rcClient);

		// Draw a thin light gray coloured circle
		Pen.DeleteObject();
		Pen.CreatePen(0,1,RGB(192,192,192));
		dc.SelectObject(&Pen);
		dc.Ellipse(rcClient);

		// Draw a white arc at the bottom
		Pen.DeleteObject();
		Pen.CreatePen(0,1,RGB(255,255,255));
		dc.SelectObject(&Pen);

		// The arc function is just to add a 3D effect for the control
		CPoint ptStart,ptEnd;
		ptStart = CPoint(rcClient.Width()/2,rcClient.bottom);
		ptEnd	= CPoint(rcClient.right,rcClient.top);

		dc.MoveTo(ptStart);
		dc.Arc(rcClient,ptStart,ptEnd);

		CBrush Brush;
		Brush.CreateSolidBrush(RGB(255,255,255));
		dc.SelectObject(&Brush);

		// Draw the actual ellipse
		dc.Ellipse(rcClient.left+4,rcClient.top+4,rcClient.left+6,rcClient.top+6);
	}
	else if(m_nShape==ID_SHAPE_SQUARE)
	{
		// If you have decided that your LED is going to look square in shape, then

		// Draw the actual rectangle
		dc.FillRect(rcClient,&m_BrushCurrent);

		// The  code below gives a 3D look to the control. It does nothing more

		// Draw the dark gray lines
		CPen Pen;
		Pen.CreatePen(0,1,RGB(128,128,128));
		dc.SelectObject(&Pen);

		dc.MoveTo(rcClient.left,rcClient.bottom);
		dc.LineTo(rcClient.left,rcClient.top);
		dc.LineTo(rcClient.right,rcClient.top);
		
		Pen.DeleteObject();

		// Draw the light gray lines
		Pen.CreatePen(0,1,RGB(192,192,192));
		dc.SelectObject(&Pen);

		dc.MoveTo(rcClient.right,rcClient.top);
		dc.LineTo(rcClient.right,rcClient.bottom);
		dc.LineTo(rcClient.left,rcClient.bottom);	
	}
*/
	CStatic::OnTimer(nIDEvent);
}

void CDynamicLED::SwitchOn()
{
	// To switch on the LED, we have to get the previously set timer interval

	m_nTimerInterval = m_nPrevTimerInterval;

	// and then reset the LED
	ResetLED(m_nID,m_nShape,m_nTimerInterval);
}

void CDynamicLED::SwitchOff()
{
	// Before switching it off, store the timer interval set by the user so that
	// we can use it later when we have to switch on the LED again

	m_nPrevTimerInterval = m_nTimerInterval;
	m_nTimerInterval = 0;
}

void CDynamicLED::LedOn()
{
	m_bBlink = FALSE;
	m_bBright = TRUE;
}

void CDynamicLED::LedOff()
{
	m_bBlink = FALSE;
	m_bBright = FALSE;
}


void CDynamicLED::UpdateLED() 
{

	// Get the Device Context
	CClientDC dc(this);
	
	// Get the rectangle of the window where we are going to draw
	CRect rcClient;
	GetClientRect(&rcClient);

	// If the pen has been selected already, then we have to delete it
	// so that it doesnt throw an assertion

	if(m_PenBright.m_hObject!=NULL)
		m_PenBright.DeleteObject();

	if(m_BrushBright.m_hObject!=NULL)
		m_BrushBright.DeleteObject();

	if(m_PenDark.m_hObject!=NULL)
		m_PenDark.DeleteObject();

	if(m_BrushDark.m_hObject!=NULL)
		m_BrushDark.DeleteObject();	

	// If the user has selected RED as the color of the LED
	if(m_nID==ID_LED_RED)
	{
		// I'm creating a light shade of red here for displaying the bright
		// LED. You can change the values to any colour that you want
		m_PenBright.CreatePen(0,1,RGB(250,0,0));
		m_BrushBright.CreateSolidBrush(RGB(250,0,0));

		// Here i'm creating a dark shade of red. You can play with the values to
		// see the effect on the LED control

		m_PenDark.CreatePen(0,1,RGB(150,0,0));
		m_BrushDark.CreateSolidBrush(RGB(150,0,0));
	}
	else if(m_nID==ID_LED_GREEN)
	{
		// If the user has selected GREEN as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(0,250,0));
		m_BrushBright.CreateSolidBrush(RGB(0,250,0));

		m_PenDark.CreatePen(0,1,RGB(0,150,0));
		m_BrushDark.CreateSolidBrush(RGB(0,150,0));
	}
	else if(m_nID==ID_LED_BLUE)
	{
		// If the user has selected BLUE as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(0,0,250));
		m_BrushBright.CreateSolidBrush(RGB(0,0,250));

		m_PenDark.CreatePen(0,1,RGB(0,0,150));
		m_BrushDark.CreateSolidBrush(RGB(0,0,150));
	}
	else if(m_nID==ID_LED_YELLOW)
	{
		// If the user has selected YELLOW as the color of the LED

		m_PenBright.CreatePen(0,1,RGB(200,200 ,0));
		m_BrushBright.CreateSolidBrush(RGB(200,200,0));

		m_PenDark.CreatePen(0,1,RGB(150,150,0));
		m_BrushDark.CreateSolidBrush(RGB(150,150,0));
	}

	if(m_bBright==TRUE)
	{
		// If we have to switch on the LED to display the bright colour select
		// the bright pen and brush that we have created above

		dc.SelectObject(&m_PenBright);
		dc.SelectObject(&m_BrushBright);

		m_BrushCurrent.m_hObject = m_BrushBright.m_hObject;

		if (m_bBlink)		// Check if toggle should occur
			m_bBright = FALSE;
	}
	else
	{
		// If we have to switch off the LED to display the dark colour select
		// the bright pen and brush that we have created above

		dc.SelectObject(&m_PenDark);
		dc.SelectObject(&m_BrushDark);

		m_BrushCurrent.m_hObject = m_BrushDark.m_hObject;

		if (m_bBlink)		// Check if toggle should occur
			m_bBright = TRUE;
	}

	// If the round shape has been selected for the control 
	if(m_nShape==ID_SHAPE_ROUND)
	{
		// Draw the actual colour of the LED
		dc.Ellipse(rcClient);

		// Draw a thick dark gray coloured circle
		CPen Pen;
		Pen.CreatePen(0,2,RGB(128,128,128));
		dc.SelectObject(&Pen);
		
		dc.Ellipse(rcClient);

		// Draw a thin light gray coloured circle
		Pen.DeleteObject();
		Pen.CreatePen(0,1,RGB(192,192,192));
		dc.SelectObject(&Pen);
		dc.Ellipse(rcClient);

		// Draw a white arc at the bottom
		Pen.DeleteObject();
		Pen.CreatePen(0,1,RGB(255,255,255));
		dc.SelectObject(&Pen);

		// The arc function is just to add a 3D effect for the control
		CPoint ptStart,ptEnd;
		ptStart = CPoint(rcClient.Width()/2,rcClient.bottom);
		ptEnd	= CPoint(rcClient.right,rcClient.top);

		dc.MoveTo(ptStart);
		dc.Arc(rcClient,ptStart,ptEnd);

		CBrush Brush;
		Brush.CreateSolidBrush(RGB(255,255,255));
		dc.SelectObject(&Brush);

		// Draw the actual ellipse
		dc.Ellipse(rcClient.left+4,rcClient.top+4,rcClient.left+6,rcClient.top+6);
	}
	else if(m_nShape==ID_SHAPE_SQUARE)
	{
		// If you have decided that your LED is going to look square in shape, then

		// Draw the actual rectangle
		dc.FillRect(rcClient,&m_BrushCurrent);

		// The  code below gives a 3D look to the control. It does nothing more

		// Draw the dark gray lines
		CPen Pen;
		Pen.CreatePen(0,1,RGB(128,128,128));
		dc.SelectObject(&Pen);

		dc.MoveTo(rcClient.left,rcClient.bottom);
		dc.LineTo(rcClient.left,rcClient.top);
		dc.LineTo(rcClient.right,rcClient.top);
		
		Pen.DeleteObject();

		// Draw the light gray lines
		Pen.CreatePen(0,1,RGB(192,192,192));
		dc.SelectObject(&Pen);

		dc.MoveTo(rcClient.right,rcClient.top);
		dc.LineTo(rcClient.right,rcClient.bottom);
		dc.LineTo(rcClient.left,rcClient.bottom);	
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费视频视频在线观看免费| 国产在线视频精品一区| 91精品国产综合久久久久久漫画 | 日韩高清不卡一区| 日韩三级高清在线| 成人精品视频一区二区三区尤物| 欧美激情一区二区三区不卡| 91在线观看一区二区| 亚洲自拍偷拍欧美| 精品久久久三级丝袜| 91网站在线观看视频| 日日摸夜夜添夜夜添精品视频| 久久精品网站免费观看| 欧美日韩一二区| 国产成人在线视频网址| 亚洲专区一二三| 精品国产第一区二区三区观看体验| 成人国产一区二区三区精品| 日本三级亚洲精品| 国产精品福利一区二区| 色婷婷综合激情| 看国产成人h片视频| 一二三区精品福利视频| 久久久久久久网| 欧美一区在线视频| 色狠狠av一区二区三区| 国产成人精品亚洲午夜麻豆| 亚洲国产cao| 国产精品久久久久久久久免费桃花 | 亚洲靠逼com| 五月天丁香久久| 国产亚洲精品福利| 欧美网站大全在线观看| 粉嫩欧美一区二区三区高清影视| 日韩av中文字幕一区二区| 国产精品乱人伦一区二区| 91精品中文字幕一区二区三区| 国产福利一区二区三区视频在线| 亚洲一区二区精品久久av| 国产婷婷一区二区| 日韩欧美一区在线观看| 国产综合色在线视频区| 日本 国产 欧美色综合| 亚洲综合精品久久| 中文字幕在线观看一区| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美无乱码久久久免费午夜一区 | 蓝色福利精品导航| 亚洲一区二区三区四区在线免费观看| 国产日韩欧美精品一区| 欧美一区二区视频在线观看| 在线亚洲精品福利网址导航| 91在线视频观看| 成人av在线一区二区三区| 国产一区二区三区av电影 | 日韩成人dvd| 亚洲成人在线网站| 日韩经典中文字幕一区| 日韩电影在线免费观看| 精品综合久久久久久8888| 国产一区二区三区黄视频| 成人午夜免费视频| 色综合天天综合在线视频| 99这里只有久久精品视频| 一道本成人在线| 欧美色窝79yyyycom| 欧美另类变人与禽xxxxx| 日韩精品中文字幕在线不卡尤物 | 一个色在线综合| 五月天网站亚洲| 精品在线免费视频| 国产成人精品三级| 日本高清免费不卡视频| 欧美精品一级二级| 久久久精品tv| 亚洲精品国产成人久久av盗摄 | 国产精品夜夜爽| 91蝌蚪porny九色| 欧美美女bb生活片| 精品国产免费人成电影在线观看四季| 久久九九久精品国产免费直播| 综合色中文字幕| 水野朝阳av一区二区三区| 久久精品99久久久| 91在线一区二区三区| 欧美日韩在线精品一区二区三区激情| 日韩精品在线一区二区| 中文字幕永久在线不卡| 日韩中文字幕不卡| 日韩一区二区三区在线视频| 国产亚洲精品超碰| 亚洲777理论| 风间由美一区二区三区在线观看| 91国偷自产一区二区使用方法| 日韩免费性生活视频播放| 亚洲三级电影全部在线观看高清| 日韩福利视频导航| 99久久久久久99| 欧美一区二区免费视频| 国产精品久久久久久久裸模| 丝袜美腿亚洲一区| 99久久777色| 久久亚洲捆绑美女| 亚洲国产wwwccc36天堂| jvid福利写真一区二区三区| 日韩精品一区在线观看| 一二三四区精品视频| 国产精品69毛片高清亚洲| 在线观看欧美日本| 国产午夜亚洲精品理论片色戒| 亚洲成人av一区二区三区| 成人av电影在线| 久久久久久久久久电影| 日本不卡一区二区| 色老汉av一区二区三区| 国产精品免费aⅴ片在线观看| 秋霞电影网一区二区| 91片黄在线观看| 国产欧美一区二区精品仙草咪| 午夜久久久久久久久久一区二区| 97久久超碰国产精品| 国产婷婷色一区二区三区四区| 肉肉av福利一精品导航| 在线观看亚洲精品视频| 亚洲欧美国产三级| 风间由美性色一区二区三区| 日韩精品一区二区三区视频播放 | 丰满少妇在线播放bd日韩电影| 日韩写真欧美这视频| 午夜在线成人av| 欧美日韩一区二区欧美激情| 日韩毛片一二三区| 风间由美性色一区二区三区| 精品久久人人做人人爽| 奇米精品一区二区三区在线观看| 欧美日韩精品一区二区三区四区| 亚洲精品国产高清久久伦理二区| 波多野结衣一区二区三区 | 蜜臀99久久精品久久久久久软件| 欧美三级一区二区| 亚洲一卡二卡三卡四卡无卡久久| 久久免费精品国产久精品久久久久| 免费在线欧美视频| 日韩三级电影网址| 精品一区二区av| 久久亚洲捆绑美女| 国产精品香蕉一区二区三区| 国产亚洲综合在线| 顶级嫩模精品视频在线看| 国产欧美视频一区二区三区| 国产99久久久国产精品潘金| 中文字幕成人网| 色综合色综合色综合色综合色综合 | 最新欧美精品一区二区三区| 色综合久久中文字幕| 亚洲精品视频一区| 欧美精品视频www在线观看| 久草精品在线观看| 国产精品亲子乱子伦xxxx裸| 欧美亚洲日本国产| 日本欧美在线看| 日本一区二区三区在线不卡| 色94色欧美sute亚洲线路一久 | 日韩精品国产精品| 337p日本欧洲亚洲大胆色噜噜| 成人免费视频一区| 亚洲欧美一区二区久久| 亚洲精品成人在线| 欧美日韩一卡二卡三卡| 国产乱子伦一区二区三区国色天香| 国产精品视频看| 欧美三区在线观看| 国产成人亚洲精品青草天美| 一区二区三区免费看视频| 欧美成人伊人久久综合网| 99久久久无码国产精品| 青青草国产成人av片免费| 国产日韩欧美激情| 欧美主播一区二区三区| 亚洲少妇屁股交4| 欧美日韩mp4| 五月天一区二区| 国产精品传媒在线| 欧美亚一区二区| 五月天一区二区| 国产精品久久久久一区| 欧美综合久久久| 手机精品视频在线观看| 亚洲欧洲日韩av| 欧美性xxxxxxxx| 精品伊人久久久久7777人| 久久久久久久综合日本| 色香蕉成人二区免费| 黄色小说综合网站| 亚洲欧美日韩人成在线播放| 欧美一级日韩一级| 国产黄人亚洲片| 亚洲午夜av在线| 久久精品一级爱片| 99re66热这里只有精品3直播 |