Click here to Skip to main content
15,917,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to display the program code as output using C or C++ Pin
Karan_TN4-Oct-08 2:04
Karan_TN4-Oct-08 2:04 
GeneralRe: How to display the program code as output using C or C++ Pin
enhzflep4-Oct-08 2:39
enhzflep4-Oct-08 2:39 
GeneralRe: How to display the program code as output using C or C++ Pin
Karan_TN6-Oct-08 0:53
Karan_TN6-Oct-08 0:53 
AnswerRe: How to display the program code as output using C or C++ Pin
PravinSingh6-Oct-08 22:20
PravinSingh6-Oct-08 22:20 
QuestionVisual Studio Express Edition 2008 for Commercial Application Pin
Karmendra Suthar3-Oct-08 22:15
Karmendra Suthar3-Oct-08 22:15 
AnswerRe: Visual Studio Express Edition 2008 for Commercial Application Pin
CPallini4-Oct-08 0:47
mveCPallini4-Oct-08 0:47 
QuestionGradientFill in Moving Dialog.. Pin
gothic_coder3-Oct-08 21:27
gothic_coder3-Oct-08 21:27 
AnswerRe: GradientFill in Moving Dialog.. Pin
enhzflep3-Oct-08 21:58
enhzflep3-Oct-08 21:58 
My mind reader's on the blink today.

Try this on for size.
// frees you from using the GDI function, which requires a region
void GradientFillRect(HDC hdc, LPRECT rcGradient, COLORREF start, COLORREF end, BOOL isVertical)
{
	BYTE startRed = GetRValue(start);
	BYTE startGreen = GetGValue(start);
	BYTE startBlue = GetBValue(start);

	BYTE endRed = GetRValue(end);
	BYTE endGreen = GetGValue(end);
	BYTE endBlue = GetBValue(end);

	HBRUSH endColor = CreateSolidBrush(end);
	FillRect(hdc, rcGradient, endColor);
	DeleteObject(endColor);

	//Gradient line width/height
	int dy = 1;

	int length = (isVertical ? rcGradient->bottom - rcGradient->top : rcGradient->right - rcGradient->left) - dy;

	for (int dn = 0; dn <= length; dn += dy)
	{
		BYTE currentRed = (BYTE)MulDiv(endRed-startRed, dn, length) + startRed;
		BYTE currentGreen = (BYTE)MulDiv(endGreen-startGreen, dn, length) + startGreen;
		BYTE currentBlue = (BYTE)MulDiv(endBlue-startBlue, dn, length) + startBlue;

		RECT currentRect = {0};
		if (isVertical)
		{
			currentRect.left = rcGradient->left;
			currentRect.top = rcGradient->top + dn;
			currentRect.right = currentRect.left + rcGradient->right - rcGradient->left;
			currentRect.bottom = currentRect.top + dy;
		}
		else
		{
			currentRect.left = rcGradient->left + dn;
			currentRect.top = rcGradient->top;
			currentRect.right = currentRect.left + dy;
			currentRect.bottom = currentRect.top + rcGradient->bottom - rcGradient->top;
		}

		HBRUSH currentColor = CreateSolidBrush(RGB(currentRed, currentGreen, currentBlue));
		FillRect(hdc, ¤tRect, currentColor);
		DeleteObject(currentColor);
	}
}

GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder3-Oct-08 22:53
gothic_coder3-Oct-08 22:53 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder3-Oct-08 23:30
gothic_coder3-Oct-08 23:30 
GeneralRe: GradientFill in Moving Dialog.. Pin
enhzflep4-Oct-08 1:05
enhzflep4-Oct-08 1:05 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder4-Oct-08 1:21
gothic_coder4-Oct-08 1:21 
GeneralRe: GradientFill in Moving Dialog.. Pin
enhzflep4-Oct-08 1:57
enhzflep4-Oct-08 1:57 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder4-Oct-08 2:50
gothic_coder4-Oct-08 2:50 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder4-Oct-08 3:01
gothic_coder4-Oct-08 3:01 
GeneralRe: GradientFill in Moving Dialog.. Pin
enhzflep4-Oct-08 3:48
enhzflep4-Oct-08 3:48 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder4-Oct-08 4:39
gothic_coder4-Oct-08 4:39 
GeneralRe: GradientFill in Moving Dialog.. Pin
gothic_coder6-Oct-08 0:10
gothic_coder6-Oct-08 0:10 
QuestionNew Stand-alone application Pin
Karmendra Suthar3-Oct-08 21:05
Karmendra Suthar3-Oct-08 21:05 
AnswerRe: New Stand-alone application Pin
Saurabh.Garg3-Oct-08 21:11
Saurabh.Garg3-Oct-08 21:11 
GeneralRe: New Stand-alone application Pin
Karmendra Suthar3-Oct-08 21:59
Karmendra Suthar3-Oct-08 21:59 
GeneralRe: New Stand-alone application Pin
Saurabh.Garg3-Oct-08 22:02
Saurabh.Garg3-Oct-08 22:02 
GeneralRe: New Stand-alone application Pin
CPallini4-Oct-08 0:45
mveCPallini4-Oct-08 0:45 
QuestionHow to test ActiveX control in VC++ 2008? Pin
followait3-Oct-08 19:15
followait3-Oct-08 19:15 
AnswerRe: How to test ActiveX control in VC++ 2008? Pin
Jaime Olivares3-Oct-08 19:57
Jaime Olivares3-Oct-08 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.