Click here to Skip to main content
15,891,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDevice Context Pin
Pazzuzu7-Mar-05 5:07
Pazzuzu7-Mar-05 5:07 
GeneralRe: Device Context Pin
Blake Miller7-Mar-05 10:39
Blake Miller7-Mar-05 10:39 
GeneralRe: Device Context Pin
Pazzuzu7-Mar-05 19:49
Pazzuzu7-Mar-05 19:49 
GeneralRe: Device Context Pin
Blake Miller8-Mar-05 4:26
Blake Miller8-Mar-05 4:26 
GeneralRe: Device Context Pin
Pazzuzu8-Mar-05 4:53
Pazzuzu8-Mar-05 4:53 
GeneralRe: Device Context Pin
Blake Miller8-Mar-05 6:20
Blake Miller8-Mar-05 6:20 
GeneralRe: Device Context Pin
Pazzuzu8-Mar-05 20:28
Pazzuzu8-Mar-05 20:28 
GeneralRe: Device Context Pin
Blake Miller9-Mar-05 4:29
Blake Miller9-Mar-05 4:29 
Yes you can. You might need to change the pen color a couple times and draw more than one line next to each other, but BUMPED, ETCHED and RAISED are just combinations of shading using pens of different colors drawn next to each other.
Long before 'DrawEdge' existed (back in Windows 3.1 days) we used to do this all the time before '3-D controls' ever existed. Now MS has just added it in as part of the GDI to make it easier for people to achieve the same effect with a single function call. The DrawEdge will also use the current user's selected colors so it obtains the correct shading effect. Since you want to override the colors, you will have to provide the effects yourself.

As an example, here is some MFC source code:

void CDC::FillSolidRect(int x, int y, int cx, int cy, COLORREF clr)<br />
{<br />
	ASSERT_VALID(this);<br />
	ASSERT(m_hDC != NULL);<br />
<br />
	::SetBkColor(m_hDC, clr);<br />
	CRect rect(x, y, x + cx, y + cy);<br />
	::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);<br />
}<br />
<br />
void CDC::Draw3dRect(LPCRECT lpRect,<br />
	COLORREF clrTopLeft, COLORREF clrBottomRight)<br />
{<br />
	Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left,<br />
		lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);<br />
}<br />
<br />
void CDC::Draw3dRect(int x, int y, int cx, int cy,<br />
	COLORREF clrTopLeft, COLORREF clrBottomRight)<br />
{<br />
	FillSolidRect(x, y, cx - 1, 1, clrTopLeft);<br />
	FillSolidRect(x, y, 1, cy - 1, clrTopLeft);<br />
	FillSolidRect(x + cx, y, -1, cy, clrBottomRight);<br />
	FillSolidRect(x, y + cy, cx, -1, clrBottomRight);<br />
}


You could create something similar to get the other two effects this one does not draw.
GeneralRe: Device Context Pin
Pazzuzu9-Mar-05 5:01
Pazzuzu9-Mar-05 5:01 
GeneralScroll bar with ActiveX control Pin
Anand for every one7-Mar-05 4:48
Anand for every one7-Mar-05 4:48 
GeneralButton location Pin
Anand for every one7-Mar-05 4:38
Anand for every one7-Mar-05 4:38 
GeneralRe: Button location Pin
Maximilien7-Mar-05 6:15
Maximilien7-Mar-05 6:15 
GeneralDEstroyWindow and Focus question ( weird behaviour) Pin
Maximilien7-Mar-05 4:22
Maximilien7-Mar-05 4:22 
GeneralRe: DEstroyWindow and Focus question ( weird behaviour) Pin
Ryan Binns7-Mar-05 17:48
Ryan Binns7-Mar-05 17:48 
GeneralRe: DEstroyWindow and Focus question ( weird behaviour) Pin
Maximilien8-Mar-05 4:00
Maximilien8-Mar-05 4:00 
GeneralRe: DEstroyWindow and Focus question ( weird behaviour) Pin
Ryan Binns8-Mar-05 12:23
Ryan Binns8-Mar-05 12:23 
GeneralNot a C++ coder needing C++ help Pin
LongRange.Shooter7-Mar-05 4:21
LongRange.Shooter7-Mar-05 4:21 
GeneralRe: Not a C++ coder needing C++ help Pin
Serge Krynine7-Mar-05 14:17
Serge Krynine7-Mar-05 14:17 
GeneralRe: Not a C++ coder needing C++ help Pin
LongRange.Shooter8-Mar-05 2:11
LongRange.Shooter8-Mar-05 2:11 
GeneralRe: Not a C++ coder needing C++ help Pin
Serge Krynine8-Mar-05 13:58
Serge Krynine8-Mar-05 13:58 
GeneralSubstitute CFTPConnection Pin
densitet7-Mar-05 3:59
densitet7-Mar-05 3:59 
GeneralButton Background color and Text Pin
sweep1237-Mar-05 3:46
sweep1237-Mar-05 3:46 
GeneralStrikethrough text in CListCtrl Pin
DanYELL7-Mar-05 3:16
DanYELL7-Mar-05 3:16 
GeneralRe: Strikethrough text in CListCtrl Pin
Manfred Staiger7-Mar-05 3:37
Manfred Staiger7-Mar-05 3:37 
QuestionHow to check if logged on user has admin privileges Pin
g3e7-Mar-05 3:01
g3e7-Mar-05 3:01 

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.