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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dynamicled.cpp

?? Silicon Laboratories C8051F320/1單片機(jī)例子
?? 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);	
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亲子伦对白| 国产欧美日韩久久| 欧美日韩一级二级三级| 日韩一本二本av| 国产欧美精品一区二区三区四区| 国产精品久久久久久久久久免费看| 久久久99精品免费观看不卡| 国产精品久久毛片a| 亚洲午夜激情av| 久久精品久久久精品美女| 极品美女销魂一区二区三区| 99久久国产综合精品麻豆| 欧美日韩在线观看一区二区 | 久久久精品免费免费| 国产精品久久久久一区| 亚洲综合图片区| 国产精品亚洲一区二区三区妖精| 99久久99久久免费精品蜜臀| 日韩一二三四区| 亚洲一卡二卡三卡四卡| 国产美女一区二区三区| 欧美一级片免费看| 亚洲精选在线视频| 成人av免费网站| 国产欧美一区二区精品性色| 日本亚洲天堂网| 欧美精品一二三| 亚洲与欧洲av电影| 在线观看亚洲一区| 最新久久zyz资源站| 国产传媒日韩欧美成人| 久久精品亚洲一区二区三区浴池 | 3d成人动漫网站| 国内偷窥港台综合视频在线播放| 色天天综合久久久久综合片| 国产精品久久久久aaaa樱花| 成人听书哪个软件好| 国产欧美精品一区二区三区四区| 国产一区二区不卡老阿姨| 精品国产免费人成电影在线观看四季 | 亚洲最大成人综合| 欧美午夜在线一二页| 偷拍亚洲欧洲综合| 欧美成人乱码一区二区三区| 国产一区二区三区免费| 久久久久国产成人精品亚洲午夜 | 日韩天堂在线观看| 国产精品一级二级三级| 亚洲欧美日韩中文播放| 精品视频在线视频| 国产在线乱码一区二区三区| 久久精品欧美一区二区三区麻豆| 国产成人午夜精品影院观看视频| 国产精品久久久久久久久免费桃花| 日本韩国欧美在线| 国产尤物一区二区| 丝袜美腿亚洲一区二区图片| xnxx国产精品| 欧美色综合网站| 成人av一区二区三区| 成人综合日日夜夜| 日本人妖一区二区| 亚洲人吸女人奶水| 日韩免费在线观看| 97精品国产露脸对白| 国产一区二区三区美女| 亚洲成a天堂v人片| 亚洲免费av在线| 国产精品无遮挡| 久久人人爽人人爽| 日韩欧美国产三级| 欧美一级免费大片| 欧美丰满少妇xxxbbb| 在线观看视频一区二区| 99国产精品久久久久久久久久久| 91丨porny丨在线| 激情综合一区二区三区| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲大尺度视频在线观看| 亚洲专区一二三| 日本亚洲天堂网| 午夜亚洲福利老司机| 性做久久久久久免费观看| 婷婷六月综合亚洲| 秋霞午夜av一区二区三区| 蜜臀99久久精品久久久久久软件| 亚州成人在线电影| 久久成人免费电影| aaa亚洲精品| 日韩高清一级片| 日韩精品中文字幕一区| 日韩免费看的电影| 久久久久久免费| 亚洲精品成人精品456| 亚洲第一搞黄网站| 国产一区二区在线免费观看| 高清shemale亚洲人妖| 色嗨嗨av一区二区三区| 91精品国模一区二区三区| 2023国产精品| 亚洲精品中文字幕在线观看| 六月丁香婷婷久久| 99re热这里只有精品免费视频| 欧美三级电影精品| 欧美国产日韩a欧美在线观看 | 韩国av一区二区三区在线观看| 成人免费观看视频| 欧美精品高清视频| 国产精品妹子av| 日本不卡不码高清免费观看| 99精品偷自拍| 亚洲精品一区二区三区蜜桃下载| 欧美国产日韩精品免费观看| 亚洲国产精品一区二区久久恐怖片| 美女一区二区久久| 欧洲色大大久久| 国产精品精品国产色婷婷| 久久精品国产精品亚洲综合| 欧美日韩黄视频| 亚洲黄色尤物视频| 国产一区二区三区久久悠悠色av | 视频一区视频二区中文| 欧美亚洲高清一区二区三区不卡| 中文文精品字幕一区二区| 国内精品在线播放| 日韩久久久久久| 蜜臀精品久久久久久蜜臀| 欧美午夜片在线看| 亚洲在线视频一区| 国产三级一区二区三区| 国产无一区二区| jiyouzz国产精品久久| 亚洲欧美在线另类| 欧洲另类一二三四区| 天天爽夜夜爽夜夜爽精品视频| 在线观看免费一区| 肉色丝袜一区二区| 精品成人一区二区三区四区| 精品亚洲成av人在线观看| 中文子幕无线码一区tr| 91成人免费网站| 国产精品99久久久久久久vr| 成人免费毛片嘿嘿连载视频| 国产精品女同一区二区三区| 色狠狠av一区二区三区| 日本午夜精品视频在线观看| 精品久久久影院| 欧美日韩一本到| 高潮精品一区videoshd| 五月婷婷激情综合网| 亚洲日本在线天堂| 国产视频一区不卡| 日韩西西人体444www| 91久久精品一区二区三区| 国产成人欧美日韩在线电影| 日韩综合小视频| 亚洲精品ww久久久久久p站| 久久久久久久久97黄色工厂| 欧美日韩极品在线观看一区| 成人国产精品免费观看| 国产一区二区在线电影| 奇米色一区二区| 天堂va蜜桃一区二区三区漫画版| 中文字幕中文字幕一区二区| 久久精品日韩一区二区三区| 欧美一级欧美三级| 欧美乱妇15p| 欧美精品久久一区| 欧美久久久久久久久久| 欧美色中文字幕| 9191国产精品| 4hu四虎永久在线影院成人| 日韩精品一区二区三区视频| 欧美丝袜丝交足nylons图片| 欧美在线不卡一区| 777久久久精品| 欧美成人一区二区三区 | 亚洲国产另类精品专区| 日韩国产精品久久久久久亚洲| 日日摸夜夜添夜夜添国产精品| 日韩专区中文字幕一区二区| 久久狠狠亚洲综合| 福利一区二区在线| 色婷婷久久久久swag精品| 精品1区2区3区| 久久久久久亚洲综合| 亚洲一区二区三区视频在线| 日本欧美肥老太交大片| 国产麻豆精品一区二区| av男人天堂一区| 欧美日韩一区久久| 久久综合色天天久久综合图片| 欧美国产乱子伦| 三级在线观看一区二区| 国产成人精品亚洲777人妖| 欧美日韩亚洲综合| 亚洲特黄一级片| 国产一区二区三区久久悠悠色av | 精品国产免费一区二区三区四区| 国产精品久久久久久久久免费桃花 |