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

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

?? dynamicled.cpp

?? 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一区二区三区免费野_久草精品视频
国产精品麻豆久久久| 在线成人av网站| 久久精品免费在线观看| 国产一区二区按摩在线观看| 精品国产成人系列| 国产九九视频一区二区三区| 久久影音资源网| 久草中文综合在线| 欧美激情在线看| 91在线云播放| 亚洲国产成人av网| 精品国产123| 成人黄色软件下载| 亚洲成av人片在线| 欧美成人精品二区三区99精品| 国产麻豆精品在线| 亚洲人成网站色在线观看| 欧美亚州韩日在线看免费版国语版| 午夜欧美在线一二页| 欧美v日韩v国产v| 成人午夜视频福利| 亚洲成av人在线观看| 国产亚洲人成网站| 欧美亚洲一区二区三区四区| 蜜桃av一区二区三区电影| 久久久久久麻豆| 色噜噜狠狠一区二区三区果冻| 首页综合国产亚洲丝袜| 国产精品乱码一区二区三区软件 | 日韩国产精品大片| 久久亚洲综合色| 欧美色综合天天久久综合精品| 麻豆极品一区二区三区| 日韩毛片精品高清免费| 精品少妇一区二区三区视频免付费| 国产精品香蕉一区二区三区| 亚洲成人av电影| 国产精品青草综合久久久久99| 6080yy午夜一二三区久久| 国产99久久久国产精品免费看| 亚洲小说欧美激情另类| 中文av一区特黄| 精品少妇一区二区三区免费观看| 91影视在线播放| 极品少妇xxxx偷拍精品少妇| 亚洲综合小说图片| 国产精品久久网站| 欧美变态凌虐bdsm| 欧美天天综合网| 99精品视频在线观看免费| 蜜臀av性久久久久蜜臀av麻豆| 亚洲综合色在线| 国产精品国产三级国产三级人妇| 日韩一区二区三区四区| 欧美三区免费完整视频在线观看| 成人教育av在线| 国产一区二三区好的| 天天色图综合网| 亚洲一线二线三线久久久| 国产精品家庭影院| 久久久久99精品国产片| 精品国产一区二区三区久久久蜜月 | 国产呦精品一区二区三区网站 | 美脚の诱脚舐め脚责91 | 日韩欧美一级二级| 欧美日韩三级在线| 在线观看一区二区精品视频| 一本大道久久a久久精二百| 不卡一区二区在线| 成人小视频在线观看| 成人性视频免费网站| 国产精品77777竹菊影视小说| 激情成人综合网| 狠狠色丁香婷婷综合| 美女免费视频一区二区| 精品一区二区三区久久| 精品一区二区国语对白| 麻豆精品一区二区三区| 蜜臀av性久久久久av蜜臀妖精| 免费在线成人网| 久久国产综合精品| 国内成人免费视频| 国产成人精品一区二 | 色综合色狠狠综合色| 在线一区二区观看| 在线一区二区视频| 欧美另类z0zxhd电影| 欧美一区二区在线不卡| 日韩欧美在线1卡| 久久午夜国产精品| 欧美极品xxx| 一区二区三区四区亚洲| 亚洲国产欧美一区二区三区丁香婷| 亚洲国产精品一区二区尤物区| 亚洲一区成人在线| 秋霞午夜鲁丝一区二区老狼| 久久精品国产亚洲一区二区三区| 极品少妇一区二区三区精品视频| 国产99久久久国产精品| 91福利精品视频| 欧美一区二区日韩| 亚洲国产高清在线| 午夜精品在线视频一区| 九九热在线视频观看这里只有精品| 国产成人在线视频免费播放| 一本一本大道香蕉久在线精品| 欧美日本国产一区| 久久久久青草大香线综合精品| 国产精品乱人伦| 日韩电影在线看| 国产不卡视频在线播放| 欧美日韩中文精品| 久久久精品黄色| 亚洲自拍与偷拍| 国产一级精品在线| 91久久一区二区| 久久久久久久电影| 性做久久久久久久免费看| 国产精品 日产精品 欧美精品| 日本久久一区二区三区| 精品国产一二三| 亚洲影视在线播放| 国产福利91精品一区| 欧美日韩mp4| 国产精品盗摄一区二区三区| 免费观看久久久4p| 在线免费精品视频| 国产午夜精品久久久久久免费视 | 粉嫩av亚洲一区二区图片| 欧美日韩国产成人在线免费| 欧美国产日韩亚洲一区| 日本三级亚洲精品| 在线免费亚洲电影| 国产精品国产三级国产普通话99 | 日韩视频不卡中文| 亚洲欧美另类久久久精品2019| 精品一区二区三区久久| 欧美疯狂做受xxxx富婆| 亚洲男人的天堂av| 成人深夜福利app| 久久综合资源网| 久久精品国产久精国产爱| 欧美日韩高清影院| 亚洲欧美激情一区二区| 处破女av一区二区| 久久亚洲欧美国产精品乐播| 日韩中文字幕区一区有砖一区| 91在线码无精品| 国产精品成人免费在线| 国产成人午夜精品5599| 精品国产乱码久久久久久闺蜜| 天天色综合天天| 91.麻豆视频| 丝袜a∨在线一区二区三区不卡| 欧美在线视频你懂得| 亚洲欧洲精品一区二区精品久久久| 国产成人精品网址| 国产亚洲综合在线| 国产成人午夜视频| 国产欧美日韩视频在线观看| 国产最新精品精品你懂的| 久久综合九色综合欧美亚洲| 韩国精品一区二区| 精品国产乱码久久| 国产精品1024| 国产精品毛片a∨一区二区三区| 成人手机在线视频| 日韩毛片高清在线播放| 91污在线观看| 亚洲午夜精品在线| 91精品国产全国免费观看| 喷白浆一区二区| 精品卡一卡二卡三卡四在线| 国产精品综合一区二区三区| 色综合久久久久综合体| 风间由美一区二区av101| 国产精品卡一卡二| 色妞www精品视频| 亚洲精品日韩一| 欧美午夜视频网站| 日韩专区中文字幕一区二区| 欧美成人bangbros| 丁香天五香天堂综合| 欧美无砖专区一中文字| 日韩精品亚洲专区| 欧美v日韩v国产v| 不卡的av网站| 一区二区三区日韩精品| 欧美肥大bbwbbw高潮| 久久97超碰国产精品超碰| 国产精品女上位| 欧美日韩在线播放三区四区| 日本91福利区| 中文字幕不卡在线播放| 欧美日本国产视频| 国产一区 二区| 亚洲最大色网站| 精品国产乱码久久久久久蜜臀| www.欧美亚洲| 蜜臀av性久久久久蜜臀aⅴ |