Click here to Skip to main content
15,904,497 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General__in64 and DWORD strange size Pin
Anonymous20-Nov-03 8:34
Anonymous20-Nov-03 8:34 
GeneralAlignment Pin
Vancouver20-Nov-03 8:53
Vancouver20-Nov-03 8:53 
GeneralRe: __in64 and DWORD strange size Pin
JWood20-Nov-03 8:54
JWood20-Nov-03 8:54 
GeneralRe: __in64 and DWORD strange size Pin
cmk20-Nov-03 9:01
cmk20-Nov-03 9:01 
Generalcmk is right Pin
Vancouver20-Nov-03 9:11
Vancouver20-Nov-03 9:11 
GeneralText does not appear on colored buttons Pin
Vancouver20-Nov-03 8:13
Vancouver20-Nov-03 8:13 
GeneralSolution Pin
Vancouver20-Nov-03 10:25
Vancouver20-Nov-03 10:25 
GeneralRe: Solution Pin
cmk20-Nov-03 16:13
cmk20-Nov-03 16:13 
Smile | :) I ran into the same thing (kinda) a couple days ago.

If we think of there being 3 coordinate systems : screen, window, client then we see that most drawing functions are in client with the remainder in screen.
But both ExtTextOut() and DrawText() seem to use window coordinates (and of course the MS docs don't mention this).

A general solution is to get the client coord then adjust for any border. I whipped up a small function to get the border :
bool  GetBorderRect( HWND H, RECT &R )
{
	if( !H || !::IsWindow(H) )  return(false);

	CkRECT  rw(1000,1000,1000,1000);

	::AdjustWindowRectEx(&rw, 
		::GetWindowLongPtrW(H, GWL_STYLE), 
		FALSE, 
		::GetWindowLongPtrW(H, GWL_EXSTYLE)
	);

	R.left   = 1000 - rw.left;
	R.top    = 1000 - rw.top;
	R.right  = rw.right  - 1000;
	R.bottom = rw.bottom - 1000;

	return(true);
}


I can then do something like (for custom static painting) :
CkRECT  rc;  ::GetClientRect(wndHnd, rc);
CkRECT  rb;  ::GetBorderRect(wndHnd, rb);
rc.MoveBy(rb.left, rb.top);

::ExtTextOutW(DC, rc.left,rc.top, ETO_OPAQUE, &rc, NULL, 0, NULL);
...
::DrawTextW(DC, s, -1, &rc, TxtStyle);



...cmk

Save the whales - collect the whole set
GeneralFor cmk Pin
Vancouver21-Nov-03 9:09
Vancouver21-Nov-03 9:09 
GeneralRe: For cmk - back to Vancouver Pin
cmk21-Nov-03 12:02
cmk21-Nov-03 12:02 
GeneralDirectshow and painting Pin
georgiek5020-Nov-03 6:31
georgiek5020-Nov-03 6:31 
Generalproblem with if statement Pin
si_6920-Nov-03 4:43
si_6920-Nov-03 4:43 
GeneralRe: problem with if statement Pin
LittleYellowBird20-Nov-03 5:02
LittleYellowBird20-Nov-03 5:02 
GeneralRe: problem with if statement Pin
si_6920-Nov-03 5:47
si_6920-Nov-03 5:47 
GeneralRe: problem with if statement Pin
Ian Darling20-Nov-03 6:01
Ian Darling20-Nov-03 6:01 
GeneralRe: problem with if statement Pin
Big Art20-Nov-03 5:56
Big Art20-Nov-03 5:56 
GeneralRe: problem with if statement Pin
TFrancis20-Nov-03 6:07
TFrancis20-Nov-03 6:07 
GeneralRe: problem with if statement Pin
Michael Dunn20-Nov-03 9:55
sitebuilderMichael Dunn20-Nov-03 9:55 
GeneralRe: problem with if statement Pin
Stye21-Nov-03 17:01
Stye21-Nov-03 17:01 
GeneralBrowse CD option Pin
Anonymous20-Nov-03 3:50
Anonymous20-Nov-03 3:50 
GeneralRe: Browse CD option Pin
Peter Molnar20-Nov-03 13:52
Peter Molnar20-Nov-03 13:52 
GeneralAfxSetResourceHandle() - I failed to load the default resources of the application. Pin
julych20-Nov-03 3:45
julych20-Nov-03 3:45 
GeneralRe: AfxSetResourceHandle() - I failed to load the default resources of the application. Pin
Antti Keskinen20-Nov-03 9:50
Antti Keskinen20-Nov-03 9:50 
GeneralRe: AfxSetResourceHandle() - I failed to load the default resources of the application. Pin
julych20-Nov-03 10:27
julych20-Nov-03 10:27 
GeneralCMenu question Pin
Niko Tanghe20-Nov-03 2:10
Niko Tanghe20-Nov-03 2:10 

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.