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

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

?? gradientprogressctrl.cpp

?? visual c++ 實例編程
?? 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	

	
	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一区二区三区免费野_久草精品视频
日本一区二区三区四区在线视频 | 欧美综合天天夜夜久久| 欧美日韩精品系列| 国产欧美日韩不卡| 奇米精品一区二区三区四区| 丁香亚洲综合激情啪啪综合| 欧美一区二区三区小说| 亚洲欧美韩国综合色| 国产成人免费视频| 欧美电影免费观看高清完整版在| 一区二区三区四区国产精品| 国产乱码精品一区二区三 | 国产 欧美在线| 精品欧美久久久| 视频一区二区欧美| 色欧美片视频在线观看在线视频| 久久久久久毛片| 免费观看久久久4p| 91精品国产综合久久精品图片 | caoporn国产精品| 精品处破学生在线二十三| 日本不卡一区二区| 欧美精选一区二区| 亚洲r级在线视频| 欧美久久一二区| 亚洲无线码一区二区三区| 色综合色综合色综合色综合色综合| 日本一区二区动态图| 国产成人亚洲精品狼色在线| 精品999在线播放| 久久99国产精品久久99| 日韩欧美在线影院| 久久99日本精品| 精品乱人伦小说| 精品一区二区三区视频| 精品av久久707| 国产成人综合视频| 国产欧美一区二区三区沐欲| 国产成人在线视频网址| 国产精品视频免费看| 成人午夜激情视频| 亚洲视频狠狠干| 欧美色精品天天在线观看视频| 亚洲综合免费观看高清完整版 | 播五月开心婷婷综合| 中国色在线观看另类| av在线播放不卡| 亚洲精品美国一| 91精品黄色片免费大全| 精品一区二区三区在线播放| 日本一区二区综合亚洲| 99视频精品全部免费在线| 一区二区三区四区精品在线视频 | 亚洲乱码中文字幕综合| 欧洲精品一区二区| 日韩av在线免费观看不卡| 2020国产成人综合网| 成人18视频在线播放| 亚洲成人一区在线| 久久综合狠狠综合久久综合88| zzijzzij亚洲日本少妇熟睡| 亚洲3atv精品一区二区三区| 精品国产一区二区在线观看| 99re成人精品视频| 水野朝阳av一区二区三区| 久久这里只有精品首页| 99久久国产综合精品麻豆| 视频一区二区国产| 国产精品美女久久久久久2018| 色av成人天堂桃色av| 另类小说视频一区二区| 亚洲色图欧美偷拍| 精品sm在线观看| 91久久线看在观草草青青| 九色porny丨国产精品| 国产精品久久毛片| 日韩女优电影在线观看| 99久久精品免费看| 精品一区二区三区视频| 夜夜嗨av一区二区三区中文字幕| 久久你懂得1024| 欧美三级中文字| 国产伦精品一区二区三区视频青涩 | 亚洲色图丝袜美腿| 欧美电视剧免费全集观看 | 裸体在线国模精品偷拍| 亚洲色图第一区| 欧美一区二视频| 成人午夜精品一区二区三区| 青青草国产成人99久久| 亚洲激情图片小说视频| 久久免费国产精品| 欧美三级乱人伦电影| kk眼镜猥琐国模调教系列一区二区| 秋霞影院一区二区| 国产精品国产三级国产普通话三级| 欧美日韩1区2区| 色综合网站在线| a亚洲天堂av| 国产精品99久久久久久有的能看 | 日韩极品在线观看| 亚洲丝袜自拍清纯另类| 国产欧美中文在线| 久久精品一区二区三区av| 欧美大片一区二区三区| 欧美中文字幕不卡| 色偷偷88欧美精品久久久| 不卡一二三区首页| 成人精品gif动图一区| 成人综合在线网站| 国产iv一区二区三区| 国产精品影音先锋| 国产美女娇喘av呻吟久久| 国产伦精品一区二区三区视频青涩| 激情国产一区二区| 国产麻豆精品视频| 丁香婷婷深情五月亚洲| 成人午夜视频在线观看| eeuss鲁片一区二区三区在线看| 国产电影一区在线| 成人精品在线视频观看| 97精品超碰一区二区三区| 91网站最新网址| 欧美色网一区二区| 欧美一区二区网站| 欧美精品一区二区精品网| 久久精品亚洲麻豆av一区二区 | 亚洲h在线观看| 日本亚洲免费观看| 国内精品视频一区二区三区八戒| 国产精品亚洲第一| 91玉足脚交白嫩脚丫在线播放| 91精品福利视频| 欧美日韩aaa| 久久亚洲综合色| 中文字幕一区二区三区色视频| 亚洲女女做受ⅹxx高潮| 亚洲成人手机在线| 久久国产人妖系列| av在线不卡电影| 欧美电影一区二区三区| 久久久噜噜噜久久中文字幕色伊伊 | 亚洲成人一区二区| 久久国产精品无码网站| av中文字幕在线不卡| 精品视频在线视频| 久久综合久久鬼色中文字| 中文字幕中文字幕一区| 亚洲成人自拍偷拍| 国产盗摄一区二区三区| 欧美性大战xxxxx久久久| 精品精品国产高清a毛片牛牛 | 久久久精品天堂| 一区二区三区日韩精品| 国产麻豆精品一区二区| 在线观看日产精品| 久久久久久日产精品| 亚洲午夜在线视频| 粉嫩高潮美女一区二区三区 | 视频在线观看一区| 国产精品一区二区在线看| 欧美在线一二三| 久久精品一级爱片| 日韩一区精品视频| 成人精品免费视频| 欧美高清视频一二三区| 国产精品久久久久aaaa樱花 | 91麻豆精品久久久久蜜臀| 欧美激情资源网| 蜜桃av一区二区| 欧美系列日韩一区| 国产精品久久久久影视| 九九精品一区二区| 欧美精品自拍偷拍动漫精品| 亚洲私人黄色宅男| 福利电影一区二区三区| 欧美xfplay| 水野朝阳av一区二区三区| 色中色一区二区| 国产精品网曝门| 久久精品99国产精品| 欧美一级免费观看| 亚洲成精国产精品女| 一本久久综合亚洲鲁鲁五月天| 欧美国产一区视频在线观看| 免费看黄色91| 91麻豆精品国产自产在线| 一区二区三区在线免费观看 | 国产成人综合在线观看| 欧美成人性战久久| 蜜臀久久99精品久久久久久9| 欧美日韩第一区日日骚| 亚洲国产中文字幕在线视频综合| 99riav一区二区三区| 中文一区在线播放 | 国产乱人伦偷精品视频不卡| 日韩视频一区二区在线观看| 视频一区视频二区中文| 91精品国产色综合久久不卡电影| 亚洲国产美国国产综合一区二区|