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

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

?? gradientprogressctrl.cpp

?? 內容包括VC++有關的各個方面的范例。包括界面的設計
?? CPP
字號:

#include "stdafx.h"
#include "GradientProgressCtrl.h"

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

/*
功能:漸變色進度條顯示效果
*/

/////////////////////////////////////////////////////////////////////////////
// CGradientProgressCtrl

CGradientProgressCtrl::CGradientProgressCtrl()
{
	// Defaults assigned by CProgressCtrl()
	m_nLower = 0;
	m_nUpper = 100;
	m_nCurrentPosition = 0;
	m_nStep = 10;	
	
	// Initial colors
	m_clrStart	= COLORREF(RGB(255, 0,0));
	m_clrEnd =	 COLORREF(RGB(0,0,255));
	//改變漸變色進度條背景色
	m_clrBkGround = ::GetSysColor(COLOR_3DFACE);
	m_clrText = COLORREF(RGB(255, 255, 255));

	// Initial show percent
	m_bShowPercent = true;
}

CGradientProgressCtrl::~CGradientProgressCtrl()
{
}


BEGIN_MESSAGE_MAP(CGradientProgressCtrl, CProgressCtrl)
	//{{AFX_MSG_MAP(CGradientProgressCtrl)
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGradientProgressCtrl message handlers

/////////////////////////////////////////////////////////////////////////////
/* 
	OnPaint

	The main drawing routine.  Consists of two parts
	(1) Call the DrawGradient routine to draw the visible part of the progress gradient
	(2) If needed, show the percentage text

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

	// TODO: Add your message handler code here
	CRect rectClient;
	GetClientRect(&rectClient);
	// If the current positionis  invalid then we should fade into the  background
	if (m_nCurrentPosition <= m_nLower || m_nCurrentPosition > m_nUpper)
	{
		CRect rect;
		GetClientRect(rect);
		CBrush brush;
		//重畫時漸變色進度條設為自定義顏色
		brush.CreateSolidBrush(m_clrBkGround);//::GetSysColor(COLOR_3DFACE));
		dc.FillRect(&rect, &brush);
		VERIFY(brush.DeleteObject());
		return;
	}
	
	// The actions to take depend on whether or not we are a vertical control
	DWORD dwStyles = GetStyle();
	BOOL bVertical = (BOOL)(dwStyles & PBS_VERTICAL);
	
	
	// Figure out what part should be visible so we can stop the gradient when needed
	float maxWidth;
	if (bVertical)
		maxWidth = ((float)m_nCurrentPosition/(float)m_nUpper * (float)rectClient.bottom);		
	else
		maxWidth = ((float)m_nCurrentPosition/(float)m_nUpper * (float)rectClient.right);
	
	
	// Draw the gradient
		DrawGradient(&dc, rectClient, (int)maxWidth, bVertical);

	// Show percent indicator if needed
	if (m_bShowPercent)
	{
		CString strPercent;
		float fp = 100.0f; 
		fp *= (float)(m_nCurrentPosition-m_nLower); 
		fp /= (float)(m_nUpper-m_nLower); 
		strPercent.Format(_T("%3.0f %%"), fp);
		
		dc.SetTextColor(m_clrText);
		dc.SetBkMode(TRANSPARENT);
		dc.DrawText(strPercent, &rectClient, DT_VCENTER |  DT_CENTER | DT_SINGLELINE);
	}

	// Do not call CProgressCtrl::OnPaint() for painting messages
}


/////////////////////////////////////////////////////////////////////////////
/*
	SetRange

	Overridden base class member to remember where the indicator thinks 
	it is and the boundary range of the control.

	Params
		nLower		lower bound
		nUpper		uppoer bound

*/
/////////////////////////////////////////////////////////////////////////////
void CGradientProgressCtrl:: SetRange(int nLower, int nUpper)
{
	m_nLower = nLower;
	m_nUpper = nUpper;
	m_nCurrentPosition = nLower;
	CProgressCtrl::SetRange(nLower, nUpper);
}

/////////////////////////////////////////////////////////////////////////////
/*

	SetRange32

	Overridden base class member to remember where the indicator thinks 
	it is and the boundary range of the control.

	Params
		nLower		lower bound
		nUpper		uppoer bound

*/
/////////////////////////////////////////////////////////////////////////////
void CGradientProgressCtrl:: SetRange32( int nLower, int nUpper )
{
	m_nLower = nLower;
	m_nUpper = nUpper;
	m_nCurrentPosition = nLower;
	CProgressCtrl::SetRange(nLower, nUpper);
}


/////////////////////////////////////////////////////////////////////////////
/*
	SetPos

	Overridden base class member to retain where the current progress indicator
	is located.

	Params
		nPos		Current position in range

*/
/////////////////////////////////////////////////////////////////////////////
int CGradientProgressCtrl:: SetPos(int nPos)
{
	m_nCurrentPosition = nPos;
	return (CProgressCtrl::SetPos(nPos));
}

/////////////////////////////////////////////////////////////////////////////
/*
	SetStep

	Overridden base class member to retain the step interval used when 
	filling the progress control

	Params
		nStep		step interval for filling progress control

*/
/////////////////////////////////////////////////////////////////////////////
int CGradientProgressCtrl:: SetStep(int nStep)
{
	m_nStep = nStep;
	return (CProgressCtrl::SetStep(nStep));
}

/////////////////////////////////////////////////////////////////////////////
/*
	StepIt

	Overridden base class member to increment the control according to the
	current position and the step interval

	Params
		nStep		step interval for filling progress control

*/
/////////////////////////////////////////////////////////////////////////////
int CGradientProgressCtrl:: StepIt(void)
{
	m_nCurrentPosition += m_nStep;
	return (CProgressCtrl::StepIt());
}


/////////////////////////////////////////////////////////////////////////////
/*
	DrawGradient

	Called from OnPaint, it does most of the work of filling in the client 
	rectangle with the appropriate colors.  The normal routine would fill
	the entire client rectangle, but we truncate the drawing to reflect
	the current position in the progress control

	Params
		pDC			pointer to CPaintDC for rendering
		rectClient	client rectangle where we should draw
		nMaxWidth	where we should stop drawing the gradient
*/
/////////////////////////////////////////////////////////////////////////////
void CGradientProgressCtrl::DrawGradient(CPaintDC *pDC, const RECT &rectClient, const int &nMaxWidth, const BOOL &bVertical)
{
	RECT rectFill;			   // Rectangle for filling band
	float fStep;              // How wide is each band?
	CBrush brush;			// Brush to fill in the bar	

	
	CMemDC1 memDC(pDC);

	// First find out the largest color distance between the start and end colors.  This distance
	// will determine how many steps we use to carve up the client region and the size of each
	// gradient rect.
	int r, g, b;					// First distance, then starting value
	float rStep, gStep, bStep;		// Step size for each color
		
	BOOL  bSameColor = FALSE;		// Handle case if start color == end color

	// Get the color differences
	r = (GetRValue(m_clrEnd) - GetRValue(m_clrStart));
	g = (GetGValue(m_clrEnd) - GetGValue(m_clrStart));
	b =  (GetBValue(m_clrEnd) - GetBValue(m_clrStart));

	// Check to see if colors are same
	if((r == 0) && (g == 0) && (b == 0))
	{
		bSameColor = TRUE;
		//Added the three lines below to fix the drawing 
		//problem which used to occur when both the start 
		//and end colors are same.
		r = GetRValue(m_clrStart);
		g = GetGValue(m_clrStart);
		b = GetBValue(m_clrStart);
	}

	int nSteps;
	//Select max. possible value for nSteps if the colors are equal
	if(bSameColor && m_clrStart == 0)
		nSteps = 255;
	else 	// Make the number of steps equal to the greatest distance
		nSteps = max(abs(r), max(abs(g), abs(b)));	
	
	// Determine how large each band should be in order to cover the
	// client with nSteps bands (one for every color intensity level)
	if (bVertical)
		fStep = (float)rectClient.bottom / (float)nSteps;	
	else
		fStep = (float)rectClient.right / (float)nSteps;

	// Calculate the step size for each color
	rStep = r/(float)nSteps;
	gStep = g/(float)nSteps;
	bStep = b/(float)nSteps;

	// Reset the colors to the starting position
	r = GetRValue(m_clrStart);
	g = GetGValue(m_clrStart);
	b = GetBValue(m_clrStart);
	
	// Start filling bands
	for (int iOnBand = 0; iOnBand < nSteps; iOnBand++) 
	{
		// Fill the vertical control
		if (bVertical)
		{
			::SetRect(&rectFill,
						0,							// Upper left X
						(int)(iOnBand * fStep),		// Upper left Y
						rectClient.right+1,		// Lower right X
						(int)((iOnBand+1) * fStep));// Lower right Y
		
			// CDC::FillSolidRect is faster, but it does not handle 8-bit color depth
			VERIFY(brush.CreateSolidBrush(RGB(r+rStep*iOnBand, g + gStep*iOnBand, b + bStep *iOnBand)));
			memDC.FillRect(&rectFill,&brush);
			VERIFY(brush.DeleteObject());


			// If we are past the maximum for the current position we need to get out of the loop.
			// Before we leave, we repaint the remainder of the client area with the background color.
			if (rectFill.bottom > nMaxWidth)
			{
				::SetRect(&rectFill, 0, rectFill.bottom, rectClient.right, rectClient.bottom);
				VERIFY(brush.CreateSolidBrush(m_clrBkGround));
				memDC.FillRect(&rectFill, &brush);
				VERIFY(brush.DeleteObject());
				return;
			}
		}

		else // Fill the horizontal control
		{
			::SetRect(&rectFill,
						(int)(iOnBand * fStep),     // Upper left X
						 0,							// Upper left Y
						(int)((iOnBand+1) * fStep), // Lower right X
						rectClient.bottom+1);		// Lower right Y
		
			// CDC::FillSolidRect is faster, but it does not handle 8-bit color depth
			VERIFY(brush.CreateSolidBrush(RGB(r+rStep*iOnBand, g + gStep*iOnBand, b + bStep *iOnBand)));
			memDC.FillRect(&rectFill,&brush);
			VERIFY(brush.DeleteObject());


			// If we are past the maximum for the current position we need to get out of the loop.
			// Before we leave, we repaint the remainder of the client area with the background color.
			if (rectFill.right > nMaxWidth)
			{
				::SetRect(&rectFill, rectFill.right, 0, rectClient.right, rectClient.bottom);
				VERIFY(brush.CreateSolidBrush(m_clrBkGround));
				memDC.FillRect(&rectFill, &brush);
				VERIFY(brush.DeleteObject());
				return;
			}
		}

	}
}



/////////////////////////////////////////////////////////////////////////////
/*
	OnEraseBkgnd

	Overridden CWnd function so that all drawing is done in the OnPaint call.
	We return TRUE so that CWnd doesn't try to erase our background.

	Params
		pDC			pointer to CDC for rendering
*/
/////////////////////////////////////////////////////////////////////////////
BOOL CGradientProgressCtrl::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本vs亚洲vs韩国一区三区二区| 久久精品免费在线观看| 国产午夜精品理论片a级大结局| 日本不卡123| 欧美日韩激情一区二区| 水野朝阳av一区二区三区| 欧美日韩一级视频| 午夜电影一区二区| 日韩一区二区三区三四区视频在线观看| 夜色激情一区二区| 色婷婷综合久久久久中文一区二区 | 久久久久久久久久久久久夜| 极品少妇xxxx偷拍精品少妇| 国产日韩亚洲欧美综合| 成人免费高清在线| 久久99热这里只有精品| 久久久亚洲国产美女国产盗摄| 国产欧美1区2区3区| 日韩精品一区二区三区视频在线观看 | 欧美精品九九99久久| 水野朝阳av一区二区三区| 日韩一区国产二区欧美三区| 精品一区二区三区影院在线午夜 | 精品日韩一区二区| 成人性视频网站| 亚洲自拍偷拍网站| 久久国产三级精品| 成人午夜免费视频| 亚洲1区2区3区视频| 久久综合色婷婷| 色综合天天性综合| 久久精品免费看| 最好看的中文字幕久久| 欧美伦理电影网| 成人手机电影网| 麻豆久久久久久久| 一区二区三区精品在线| 91精品国产综合久久精品| 国产v综合v亚洲欧| 天天色综合天天| 亚洲视频资源在线| wwww国产精品欧美| 欧美日韩高清影院| 日韩欧美卡一卡二| proumb性欧美在线观看| 日本欧美一区二区| 一区二区三区四区视频精品免费 | 国产成人亚洲综合a∨婷婷图片 | 欧美日韩精品欧美日韩精品| 国产福利一区在线观看| 无码av免费一区二区三区试看| 久久网站热最新地址| 91.麻豆视频| 色噜噜狠狠一区二区三区果冻| 国产精品一区二区视频| 首页国产丝袜综合| 亚洲国产成人av| 亚洲精品免费一二三区| 国产精品欧美极品| 日本一区二区不卡视频| 久久九九99视频| 久久欧美一区二区| 久久人人97超碰com| 精品国产亚洲在线| 日韩欧美电影在线| 日韩一区二区三区在线| 日韩一区二区在线播放| 中文在线资源观看网站视频免费不卡| 色菇凉天天综合网| 日本vs亚洲vs韩国一区三区 | 国产在线精品国自产拍免费| 日本伊人色综合网| 日本中文字幕一区二区有限公司| 亚洲狠狠爱一区二区三区| 亚洲欧美日韩系列| 亚洲日本一区二区三区| 成人免费视频在线观看| 亚洲欧美色一区| 亚洲免费av在线| 一区二区三区国产豹纹内裤在线| 亚洲一区在线视频| 午夜精品久久一牛影视| 午夜精品一区二区三区免费视频| 欧美色偷偷大香| 色综合久久88色综合天天| 日本高清不卡aⅴ免费网站| 色美美综合视频| 欧美一区二区三区白人| 久久久久久久久久久黄色| 中文字幕不卡三区| 亚洲一线二线三线久久久| 日韩激情一二三区| 国内精品久久久久影院薰衣草 | 91影视在线播放| 欧美在线看片a免费观看| 91精品国产欧美日韩| 国产视频一区二区在线观看| 亚洲四区在线观看| 香蕉久久夜色精品国产使用方法| 久久狠狠亚洲综合| caoporn国产一区二区| 欧美日韩精品是欧美日韩精品| 日韩欧美国产三级| 亚洲乱码国产乱码精品精小说 | 激情久久久久久久久久久久久久久久| 国产精品一二三四| 欧美综合色免费| 久久精品视频一区二区三区| 日韩理论片网站| 秋霞电影一区二区| 91婷婷韩国欧美一区二区| 91精品国产综合久久福利软件 | 亚洲精品乱码久久久久久黑人 | 国模冰冰炮一区二区| 色综合久久九月婷婷色综合| 日韩美一区二区三区| 一区二区免费看| 国产精品91一区二区| 欧美日本一区二区| 亚洲免费三区一区二区| 国产一区二区三区| 91精品国产综合久久精品| 亚洲精品成a人| 成人黄动漫网站免费app| 日韩美女视频一区二区在线观看| 国产精品短视频| 国产老肥熟一区二区三区| 91精品午夜视频| 亚洲黄色片在线观看| 成人激情午夜影院| 久久久久久久久久电影| 麻豆freexxxx性91精品| 欧美日韩激情在线| 亚洲影院久久精品| 91国偷自产一区二区开放时间| 久久久www成人免费毛片麻豆| 日韩成人午夜精品| 欧美日韩中文字幕一区二区| 亚洲精选视频在线| 91婷婷韩国欧美一区二区| 国产精品久久久久毛片软件| 国产精品99久久久久久久vr| 亚洲精品一区二区三区99| 麻豆精品视频在线| 337p日本欧洲亚洲大胆色噜噜| 蜜桃视频在线观看一区二区| 欧美一区二区三区四区久久| 日欧美一区二区| 日韩一区二区三区观看| 美女视频一区在线观看| 欧美成人一级视频| 国产精品99久久久久久宅男| 中文字幕欧美日本乱码一线二线| 国产suv一区二区三区88区| 中文在线一区二区| 色美美综合视频| 三级久久三级久久| 日韩免费高清视频| 国产专区欧美精品| 国产精品久久免费看| 日本高清不卡视频| 天天av天天翘天天综合网| 日韩欧美国产精品| 风间由美一区二区三区在线观看| 中文字幕在线播放不卡一区| 91国产免费观看| 日日夜夜免费精品视频| 久久香蕉国产线看观看99| 成人免费看视频| 午夜伦理一区二区| 久久久99免费| 日本久久精品电影| 免费观看30秒视频久久| 国产精品视频一区二区三区不卡| 色综合天天综合色综合av| 日本网站在线观看一区二区三区| 久久久久成人黄色影片| 日本精品视频一区二区三区| 久久精品久久综合| 亚洲男同性视频| 久久免费精品国产久精品久久久久| 99久久亚洲一区二区三区青草| 五月天国产精品| 亚洲国产精华液网站w| 欧美日本精品一区二区三区| 国产99久久久国产精品免费看| 亚洲成人黄色影院| 国产精品免费视频一区| 欧美高清一级片在线| 成人av片在线观看| 看电视剧不卡顿的网站| 亚洲一级片在线观看| 久久精品人人爽人人爽| 91精品国产综合久久精品图片| 99在线精品免费| 韩国欧美一区二区| 亚洲成人免费视频| 亚洲男人电影天堂| 欧美韩国日本不卡| 精品国产免费视频|