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

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

?? dynamicled.cpp

?? F320單片機實現(xiàn)于上位機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();
	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一区二区三区免费野_久草精品视频
国产精品久久777777| 亚洲精品欧美综合四区| 成人欧美一区二区三区小说| 日本va欧美va欧美va精品| 国产91精品欧美| 91精品国产麻豆| 成人欧美一区二区三区1314| 国产在线国偷精品免费看| 精品视频1区2区3区| 国产精品第13页| 国产成人啪午夜精品网站男同| 欧美欧美欧美欧美首页| 日韩一区欧美一区| 国产成a人亚洲精| 精品入口麻豆88视频| 亚洲a一区二区| 欧美最新大片在线看| 国产精品九色蝌蚪自拍| 成人性生交大片免费看视频在线 | 青草国产精品久久久久久| 99精品1区2区| 国产精品久久久久久久岛一牛影视 | 国产精品亚洲综合一区在线观看| 欧美日本在线观看| 亚洲自拍都市欧美小说| 欧美性做爰猛烈叫床潮| 一区二区三区毛片| 欧美中文字幕不卡| 亚洲一二三专区| 欧美另类变人与禽xxxxx| 亚洲成人av资源| 制服丝袜中文字幕亚洲| 日韩电影在线一区二区三区| 欧美日韩1234| 久久99久久精品| 久久久久久免费毛片精品| 国产一区二区三区综合| 国产校园另类小说区| 丁香网亚洲国际| 综合分类小说区另类春色亚洲小说欧美| 东方aⅴ免费观看久久av| ●精品国产综合乱码久久久久| 91在线国内视频| 亚洲大片免费看| 欧美一区二区精美| 国产一区亚洲一区| 国产精品久久一级| 在线一区二区三区四区| 午夜欧美视频在线观看| 日韩色在线观看| 国产精品99久久久久久似苏梦涵 | 免费成人小视频| 久久色在线视频| 成人av免费网站| 亚洲资源中文字幕| 欧美精品一区二区三区四区| 东方aⅴ免费观看久久av| 一区二区三区中文在线观看| 在线不卡中文字幕| 国产成人精品aa毛片| 久久精品无码一区二区三区| 97精品久久久久中文字幕| 午夜久久久久久久久| 久久免费精品国产久精品久久久久| 国产suv精品一区二区三区| 一区二区三区在线看| 日韩免费视频线观看| jiyouzz国产精品久久| 日韩专区在线视频| 中文字幕成人网| 欧美丰满一区二区免费视频| 国产成人精品亚洲777人妖| 一卡二卡三卡日韩欧美| 精品av久久707| 欧美在线高清视频| 国产成人夜色高潮福利影视| 亚洲成a人片综合在线| 国产精品美女久久福利网站| 欧美日韩国产精品成人| 成人网在线免费视频| 日韩经典中文字幕一区| 专区另类欧美日韩| 久久网站最新地址| 日韩视频中午一区| 色老头久久综合| 成人夜色视频网站在线观看| 久久电影网站中文字幕| 亚洲午夜免费福利视频| 国产精品伦一区二区三级视频| 日韩精品一区二区在线观看| 欧美中文字幕亚洲一区二区va在线| 成人动漫一区二区| 国产美女视频91| 老司机午夜精品| 911精品产国品一二三产区| 韩国一区二区视频| 亚洲色图欧美激情| 国产欧美日韩另类一区| 欧美一级精品在线| 欧美日韩黄色一区二区| 91色.com| 成人黄色小视频在线观看| 激情文学综合网| 免费人成在线不卡| 性欧美疯狂xxxxbbbb| 亚洲影视在线播放| 亚洲婷婷综合色高清在线| 国产精品少妇自拍| 欧美日韩国产首页| 裸体健美xxxx欧美裸体表演| 亚洲五码中文字幕| 亚洲第一av色| 日韩精品91亚洲二区在线观看| 亚洲一区二区av在线| 亚洲福利国产精品| 午夜私人影院久久久久| 五月激情六月综合| 日韩精品成人一区二区三区| 日韩电影免费在线观看网站| 日本不卡1234视频| 美女mm1313爽爽久久久蜜臀| 蜜臀av性久久久久蜜臀aⅴ流畅| 日韩激情视频在线观看| 蜜桃av一区二区在线观看| 麻豆精品一区二区三区| 美女网站一区二区| 国产精品影视天天线| 成人国产亚洲欧美成人综合网| 99re热这里只有精品视频| 91成人在线观看喷潮| 欧美一区午夜视频在线观看| 日韩精品一区二区三区视频播放| 久久久精品免费观看| 亚洲v日本v欧美v久久精品| 亚洲精品免费看| 首页综合国产亚洲丝袜| 激情综合网激情| 99久久精品99国产精品| 欧美三级在线看| 日韩精品中文字幕在线不卡尤物 | 亚洲欧美经典视频| 天堂在线亚洲视频| 国产一区二区三区四区五区入口| 国产成人精品aa毛片| 欧美视频一区二区三区四区| 欧美mv日韩mv| 成人精品一区二区三区中文字幕| 一区二区欧美国产| 亚洲第一会所有码转帖| 经典三级视频一区| 91国产丝袜在线播放| 欧美一卡二卡在线| 91麻豆国产福利在线观看| 懂色av中文字幕一区二区三区| 欧美系列亚洲系列| 久久亚洲精华国产精华液| 一区二区成人在线| 国产伦精品一区二区三区免费迷| 色美美综合视频| 欧美国产丝袜视频| 奇米色一区二区| 99精品视频一区| 欧美精品一区二区三区在线播放| 亚洲一区二三区| 国产.欧美.日韩| 91精品国产91久久综合桃花| 亚洲日本va午夜在线电影| 激情综合一区二区三区| 欧美日韩一区二区在线观看视频| 国产亚洲成aⅴ人片在线观看 | www.av亚洲| 精品乱码亚洲一区二区不卡| 亚洲国产精品人人做人人爽| 成人激情电影免费在线观看| 精品国产伦理网| 免费看欧美女人艹b| 91麻豆文化传媒在线观看| 久久久久国产精品人| 久久99日本精品| 欧美精品一二三区| 亚洲激情欧美激情| 99久久精品免费看| 欧美国产精品v| 国产麻豆一精品一av一免费| 日韩一级免费一区| 婷婷中文字幕一区三区| 91激情在线视频| 亚洲丝袜美腿综合| 99精品热视频| 亚洲人妖av一区二区| 成人av电影在线网| 国产精品久久久久影院色老大 | 国产91丝袜在线18| 欧美tk—视频vk| 麻豆久久一区二区| 日韩一级黄色大片| 久久精品国产澳门| 精品福利视频一区二区三区| 久久国产精品99精品国产| 日韩女优电影在线观看|