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

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

?? gradientprogressctrl.cpp

?? 一個功能挺多的
?? CPP
字號:
/*
Modified by 徐景周 2000.12
功能:漸變色進度條顯示效果
*/

#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	

	
	CMemDC 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一区二区三区免费野_久草精品视频
国产最新精品精品你懂的| 欧美疯狂性受xxxxx喷水图片| 亚洲黄色片在线观看| 日韩中文字幕一区二区三区| 成人毛片在线观看| 日韩欧美国产一二三区| 亚洲免费在线电影| 国产69精品久久777的优势| 欧美人xxxx| 亚洲欧美偷拍卡通变态| 国产不卡免费视频| 欧美成人r级一区二区三区| 亚洲国产综合人成综合网站| 成人一级视频在线观看| 精品国产乱码久久久久久久久| 26uuu欧美| 蜜桃av一区二区| 欧美日韩1234| 亚洲1区2区3区视频| 色妞www精品视频| 亚洲欧美自拍偷拍色图| 国产高清在线观看免费不卡| 日韩欧美国产综合| 免费高清视频精品| 日韩情涩欧美日韩视频| 日本伊人午夜精品| 日韩一级黄色大片| 麻豆精品精品国产自在97香蕉 | 亚洲第一av色| 91在线视频18| 亚洲精品久久7777| 色香色香欲天天天影视综合网 | 色香蕉久久蜜桃| 亚洲欧美一区二区视频| av激情亚洲男人天堂| 中文字幕一区在线观看| eeuss鲁片一区二区三区在线看| 欧美大黄免费观看| 久久精品免费看| www日韩大片| 国产成人av福利| 国产精品白丝在线| 色综合网色综合| 亚洲午夜视频在线观看| 欧美日韩不卡在线| 久久国产福利国产秒拍| 精品国产一区二区三区久久影院| 美洲天堂一区二卡三卡四卡视频 | 国产精品一二三区| 中国av一区二区三区| 9i在线看片成人免费| 亚洲一区影音先锋| 欧美一区二区三区公司| 激情亚洲综合在线| 国产精品久久久久久久久晋中| 国产91综合网| 亚洲v中文字幕| 精品剧情在线观看| 成人午夜在线免费| 亚洲国产成人porn| 日韩免费看的电影| av亚洲精华国产精华| 亚洲超丰满肉感bbw| 精品福利一二区| 日本精品视频一区二区| 秋霞成人午夜伦在线观看| 久久久久亚洲蜜桃| 在线观看日韩国产| 国产美女久久久久| 一区二区三区 在线观看视频| 色婷婷国产精品综合在线观看| 亚洲成人在线网站| 久久精品夜夜夜夜久久| 欧美日韩中文精品| 国产成人精品影视| 石原莉奈一区二区三区在线观看| 精品国产91乱码一区二区三区| 北岛玲一区二区三区四区 | 中文av一区二区| 51精品久久久久久久蜜臀| 成人一二三区视频| 日本少妇一区二区| 一区二区三区在线视频观看| 欧美www视频| 欧美群妇大交群中文字幕| eeuss鲁片一区二区三区在线看 | 久久久www免费人成精品| 欧洲另类一二三四区| 国产成人99久久亚洲综合精品| 亚洲免费在线看| 国产精品久久久久久亚洲毛片 | 国产一区二区三区| 日韩国产欧美在线视频| 亚洲一线二线三线视频| 亚洲国产精品99久久久久久久久| 欧美在线不卡一区| 99riav久久精品riav| 国产精品99久久久久| 日韩国产在线观看| 视频在线在亚洲| 亚洲美女在线一区| 国产亚洲自拍一区| 久久久久国产精品麻豆| 精品国产一区二区三区不卡 | 国产黄色精品视频| 蜜臀精品一区二区三区在线观看| 中文字幕一区视频| 中文字幕在线不卡一区 | 欧美激情综合在线| 久久久九九九九| 精品国产乱码久久久久久久| 日韩一级高清毛片| 欧美一级理论性理论a| 欧美一区二区三区成人| 日韩一区二区三区电影| 日韩美女视频在线| 日韩欧美精品三级| 久久精品一区二区| 国产精品久线观看视频| 国产精品乱码一区二三区小蝌蚪| 欧美精品一区二区高清在线观看| 欧美日韩视频第一区| 欧美日韩国产免费一区二区 | 日韩一区欧美一区| 亚洲免费观看在线观看| 一区二区三区在线看| 亚洲综合视频在线| 亚洲高清三级视频| 另类小说视频一区二区| 免费看日韩精品| 国产乱一区二区| 成人午夜私人影院| 色综合天天综合狠狠| 91久久免费观看| 日韩亚洲欧美在线| 久久久精品人体av艺术| 中文字幕在线不卡一区 | 欧美精品一区二区蜜臀亚洲| 久久在线观看免费| 国产精品传媒入口麻豆| 亚洲一区二区三区四区在线观看 | 欧美性一级生活| 日韩欧美国产一二三区| 国产农村妇女毛片精品久久麻豆| 国产精品久久久久久久久久免费看 | 久久99国内精品| 国产成人亚洲综合a∨婷婷| 99re这里只有精品6| 91福利国产成人精品照片| 在线播放中文字幕一区| 国产女主播视频一区二区| 一区二区三区四区激情| 久久国产综合精品| 91美女在线视频| 精品久久一二三区| 亚洲婷婷国产精品电影人久久| 亚洲欧洲国产日韩| 日本不卡一区二区三区高清视频| 国产精品一区二区91| 91久久一区二区| 久久伊人蜜桃av一区二区| 亚洲免费在线视频| 国产美女在线精品| 欧美日韩激情一区二区三区| 久久久夜色精品亚洲| 亚洲二区视频在线| 成人av午夜影院| 精品国一区二区三区| 亚洲国产精品一区二区久久恐怖片 | 91看片淫黄大片一级在线观看| 99精品视频中文字幕| 欧美一级在线免费| 一区二区三区鲁丝不卡| 国产精品资源在线观看| 欧美一级搡bbbb搡bbbb| 亚洲精品国产a久久久久久| 国产成人免费网站| 日韩精品中文字幕在线一区| 夜夜嗨av一区二区三区| 99精品久久99久久久久| 欧美精品一区二区三区视频| 午夜亚洲国产au精品一区二区| 国产高清无密码一区二区三区| 欧美日韩卡一卡二| 一二三区精品视频| 91蜜桃视频在线| 亚洲欧美日韩综合aⅴ视频| 成人一级黄色片| 欧美国产精品专区| 国产精品99久久不卡二区| 日韩免费高清av| 久久er精品视频| 欧美一区国产二区| 男女男精品网站| 91精品久久久久久蜜臀| 日本伊人午夜精品| 日韩一级完整毛片| 国产一区二区主播在线| 精品国产三级a在线观看| 久久99精品久久久久久国产越南|