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

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

?? gradientprogressctrl.cpp

?? ◆◆◆ 《FTP、HTTP 多線程斷點續(xù)傳下載文件》◆◆◆ FlashGet、網(wǎng)絡螞蟻想必大家都很熟悉
?? CPP
字號:

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

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

/*
Modified by 謝紅偉 2000.12
功能:漸變色進度條顯示效果
*/

/////////////////////////////////////////////////////////////////////////////
// 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(128, 0,128));
	m_clrEnd =	 COLORREF(RGB(0,128,0));
	//改變漸變色進度條背景色
	m_clrBkGround = ::GetSysColor(COLOR_3DFACE);
	m_clrText = COLORREF(RGB(0, 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;
		//重畫時漸變色進度條設(shè)為自定義顏色
		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 )
{
	if ( nLower == nUpper ) return;
	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
			if ( 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);
				if ( 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
			if ( 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);
				if ( 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;
}


BOOL CGradientProgressCtrl::Create(CStatusBar *parent, UINT id, DWORD style)
{
	CRect r;
	
	setup(parent, id, r);
	
	return CProgressCtrl::Create(style | WS_CHILD, r, parent, id);
}

/****************************************************************************
*                            CStatusControl::setup
* Inputs:
*	CStatusBar * parent: Parent window (status bar)
*	UINT id: ID of pane
*	CRect & r: Place to put rectangle
* Result: BOOL
*       TRUE if successful
*	FALSE if the area is off-window
* Effect: 
*       Computes the rectangle for the pane, given the status bar and id
****************************************************************************/
BOOL CGradientProgressCtrl::setup(CStatusBar *parent, UINT id, CRect &r)
{
	int i = parent->CommandToIndex(id);
	
	parent->GetItemRect(i, &r);
	parent->SetPaneText(i, "");
	
	// If the pane was not visible, GetItemRect has returned a
	// (0, 0, 0, 0) rectangle. Attempting to create the control
	// using this rectangle creates it, possibly of zero size,
	// at the left of the status bar. We correct this by
	// forcing it to be off the visible right end of the status
	// bar. If the programmer properly handles the parent frame's
	// OnSize method, when the control becomes visible it will
	// move to the correct location.
	if(r.IsRectEmpty())
	{ /* offscreen */
		CRect r1;
		parent->GetWindowRect(&r1); // get parent width
		r.left = r1.right + 1;
		r.top =  r1.top;
		r.right = r1.right + 2;
		r.bottom = r1.bottom;
		return FALSE;
	} /* offscreen */
	
	return TRUE;
}

void CGradientProgressCtrl::Reposition()
{
	if ( m_hWnd == NULL)
		return;
	UINT id = ::GetWindowLong(m_hWnd, GWL_ID);
	CRect r;
	
	// Note that because the control ID is the same as the
	// pane ID, this actually works well enough that
	// no special variable is required to obtain the
	// pane index.
	CStatusBar * parent = (CStatusBar *)GetParent();
	int i = parent->CommandToIndex(id);
	parent->GetItemRect(i, &r);
	SetWindowPos(&wndTop, r.left, r.top, r.Width(), r.Height(), 0);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区观看| 成人app在线| 日韩一区二区电影在线| 日韩不卡手机在线v区| 欧美精品色一区二区三区| 日韩和欧美一区二区| 欧美一二区视频| 国产精品伊人色| 国产精品视频一二三区| 色综合色综合色综合| 亚洲电影一级黄| 欧美电影免费观看高清完整版 | 欧美一二三区精品| 蜜乳av一区二区| 国产三区在线成人av| 91免费版在线看| 日本在线不卡视频一二三区| 欧美大片免费久久精品三p| 国产98色在线|日韩| 又紧又大又爽精品一区二区| 欧美一区二区免费| 成人精品在线视频观看| 亚洲综合另类小说| 精品国产不卡一区二区三区| 久久网站热最新地址| 99久久亚洲一区二区三区青草 | 欧洲av一区二区嗯嗯嗯啊| 日韩电影在线看| 国产精品嫩草影院com| 欧美日韩美少妇| 风间由美一区二区av101| 一区二区三区久久久| 欧美精品一区二区高清在线观看| 成人黄色小视频| 日本欧美一区二区在线观看| 亚洲欧美综合色| 日韩一级黄色大片| 日本韩国欧美一区| 国产精品一卡二| 午夜一区二区三区视频| 国产精品久久免费看| 日韩视频不卡中文| 欧洲av一区二区嗯嗯嗯啊| 国产主播一区二区三区| 五月激情丁香一区二区三区| 国产精品盗摄一区二区三区| 精品人在线二区三区| 欧美在线免费播放| av午夜一区麻豆| 国内成+人亚洲+欧美+综合在线| 亚洲一区二区欧美激情| 国产精品你懂的在线| 26uuu亚洲综合色欧美| 欧美久久一区二区| 色88888久久久久久影院野外| 国产精品一区二区视频| 美女脱光内衣内裤视频久久网站 | 夜夜亚洲天天久久| 亚洲国产精品成人综合| 久久综合色播五月| 欧美一区二区三区系列电影| 欧美午夜一区二区三区| 99综合影院在线| 国产99久久精品| 美女性感视频久久| 奇米777欧美一区二区| 亚洲福利视频一区二区| 亚洲精品va在线观看| 亚洲欧美自拍偷拍色图| 亚洲欧美自拍偷拍| 中文字幕一区二区在线播放| 欧美经典三级视频一区二区三区| 久久久99精品久久| 久久久亚洲高清| 久久久久国产一区二区三区四区| 欧美日韩国产精选| 欧美吻胸吃奶大尺度电影| 91久久人澡人人添人人爽欧美| 大胆亚洲人体视频| 成人精品亚洲人成在线| 成人爽a毛片一区二区免费| 国产精品原创巨作av| 国产成人精品网址| 成人精品电影在线观看| 99久久精品国产一区二区三区| 不卡av免费在线观看| 成人av在线影院| 色综合久久中文字幕| 色狠狠色狠狠综合| 欧美伦理电影网| 日韩欧美一区中文| 欧美tickle裸体挠脚心vk| 精品国产91洋老外米糕| 国产欧美一区二区精品性色| 国产精品视频一二三区| 一区二区三区精品久久久| 99久久亚洲一区二区三区青草 | 亚洲欧美中日韩| 亚洲一区二区三区四区在线| 亚洲成人av中文| 蜜桃视频一区二区| 国产精品一区二区免费不卡| 成人激情小说乱人伦| 91久久精品一区二区二区| 欧美亚日韩国产aⅴ精品中极品| 欧美精品一二三四| 国产视频一区二区在线观看| 亚洲久草在线视频| 日本欧美一区二区| 成人午夜精品一区二区三区| 91在线云播放| 欧美一区二区成人| 中文在线资源观看网站视频免费不卡| 亚洲激情欧美激情| 麻豆一区二区三| 99久久99久久综合| 欧美一区二区精品| 国产精品欧美久久久久无广告 | 日韩一区二区三区av| 国产午夜久久久久| 亚洲国产毛片aaaaa无费看| 精品一区二区三区久久| 91香蕉国产在线观看软件| 日韩女同互慰一区二区| 亚洲女子a中天字幕| 久久狠狠亚洲综合| 色婷婷国产精品久久包臀| 精品乱人伦一区二区三区| 亚洲欧美激情在线| 久久99精品久久久久久久久久久久| 99精品视频一区二区| 精品女同一区二区| 亚洲一区中文在线| 成人av先锋影音| 精品久久久网站| 天天影视色香欲综合网老头| 成人国产精品免费网站| 日韩欧美国产一区二区三区 | 日韩影院精彩在线| 成人深夜福利app| 精品国产免费人成在线观看| 亚洲在线观看免费视频| 成人av资源在线观看| 精品成人a区在线观看| 亚洲电影一级黄| 一本色道久久综合精品竹菊| 国产亚洲欧美激情| 久久91精品久久久久久秒播| 欧美日韩亚洲综合在线 | 在线亚洲精品福利网址导航| 国产午夜精品久久久久久久| 蜜桃视频一区二区| 51精品视频一区二区三区| 一区二区国产视频| 91色在线porny| 中文字幕亚洲电影| 福利电影一区二区| 欧美韩国日本综合| 国产乱子伦视频一区二区三区 | 日韩电影在线免费观看| 91在线无精精品入口| 国产精品区一区二区三区| 国产一区在线观看麻豆| wwwwxxxxx欧美| 精久久久久久久久久久| 精品国产免费视频| 激情六月婷婷久久| 久久久亚洲精品石原莉奈| 国产在线不卡一区| 久久久99免费| 国产**成人网毛片九色| 国产欧美精品在线观看| 豆国产96在线|亚洲| 日本一区二区三区四区在线视频 | 99久久久久久| 亚洲欧美在线视频观看| 91亚洲精品久久久蜜桃网站| 亚洲乱码国产乱码精品精98午夜 | 日本一区二区三区在线观看| 成人午夜伦理影院| 亚洲欧美日韩国产成人精品影院| 在线观看免费成人| 亚洲国产精品久久久久婷婷884| 欧美日韩免费不卡视频一区二区三区 | 蜜臀99久久精品久久久久久软件| 日韩欧美国产一区在线观看| 国产一区不卡在线| 国产精品嫩草影院av蜜臀| 欧洲国产伦久久久久久久| 偷拍自拍另类欧美| 2024国产精品| 99久久精品久久久久久清纯| 一区二区三区**美女毛片| 日韩欧美一级片| 丰满白嫩尤物一区二区| fc2成人免费人成在线观看播放| 最新成人av在线| 欧美剧情片在线观看| 国产乱人伦偷精品视频不卡| 亚洲男同性恋视频|