Click here to Skip to main content
15,921,841 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProgrammers needed Pin
LOSTTWARE.com5-Oct-03 18:29
LOSTTWARE.com5-Oct-03 18:29 
GeneralRe: Programmers needed Pin
KaЯl6-Oct-03 3:13
KaЯl6-Oct-03 3:13 
GeneralC++ Question. Pin
WREY5-Oct-03 17:44
WREY5-Oct-03 17:44 
GeneralRe: C++ Question. Pin
Anonymous5-Oct-03 20:47
Anonymous5-Oct-03 20:47 
GeneralRe: C++ Question. Pin
WREY5-Oct-03 21:19
WREY5-Oct-03 21:19 
GeneralRe: C++ Question. Pin
Johnny ²6-Oct-03 1:05
Johnny ²6-Oct-03 1:05 
GeneralRe: C++ Question. Pin
WREY6-Oct-03 20:35
WREY6-Oct-03 20:35 
QuestionAny SetWindowOrg(x,y) Gurus? Pin
spiritualfields5-Oct-03 17:10
spiritualfields5-Oct-03 17:10 
I've been using SetWindowOrg for quite a while now, but it still bugs me that I don't completely understand what's happening with the "y" coordinate. I know that SetWindowOrg maps the logical (x,y) coordinates to the physical device's (0,0) coordinates (upper left), but I don't understand the sign associated with the "y" coordinate of SetWindowOrg. For example, the following code will draw a circle in the center of the screen (assuming that you've got a device context):

CRect rect;
GetClientRect(&rect);
CPoint point(rect.Width()/2, rect.Height()/2);
dc.SetMapMode(MM_LOENGLISH);
dc.DPtoLP(&point);
dc.SetWindowOrg(-point.x, -point.y);
dc.Ellipse(-50,50,50,-50);

So the origin has been shifted to the center of the screen. Here's my question. Why must negative point.y be sent to SetWindowOrg and not positive point.y? After all, in the MM_LOENGLISH mapping mode the coordinate system is with positive y up and negative y down. So if this code makes the logical upper left be in the second quadrant somewhere (-x,y), which is where it has to be if the logical origin is now in the center, then why do I have to send a negative point.y into the SetWindowOrg? Sending a positive point.y makes more sense, but sending a positive point.y ends up with the circle off the screen. The sign associated with point.x makes sense.

Ed


GeneralMoving Windows Pin
DougW485-Oct-03 16:04
DougW485-Oct-03 16:04 
GeneralRe: Moving Windows Pin
Beer265-Oct-03 16:09
Beer265-Oct-03 16:09 
GeneralRe: Moving Windows Pin
Dave Bryant5-Oct-03 16:10
Dave Bryant5-Oct-03 16:10 
Questionloosing my backspace messages??? Pin
Beer265-Oct-03 15:38
Beer265-Oct-03 15:38 
AnswerRe: loosing my backspace messages??? Pin
J. Dunlap5-Oct-03 15:53
J. Dunlap5-Oct-03 15:53 
GeneralRe: loosing my backspace messages??? Pin
Beer265-Oct-03 15:57
Beer265-Oct-03 15:57 
GeneralRe: loosing my backspace messages??? Pin
J. Dunlap5-Oct-03 16:28
J. Dunlap5-Oct-03 16:28 
AnswerRe: loosing my backspace messages??? Pin
Michael Dunn5-Oct-03 19:26
sitebuilderMichael Dunn5-Oct-03 19:26 
GeneralRe: loosing my backspace messages??? Pin
Beer266-Oct-03 3:28
Beer266-Oct-03 3:28 
GeneralSQL Database Pin
don7cry5-Oct-03 15:21
don7cry5-Oct-03 15:21 
GeneralRe: SQL Database Pin
alex.barylski5-Oct-03 16:12
alex.barylski5-Oct-03 16:12 
Generaltext color and font Pin
no_life5-Oct-03 12:51
no_life5-Oct-03 12:51 
GeneralRe: text color and font Pin
alex.barylski5-Oct-03 16:29
alex.barylski5-Oct-03 16:29 
GeneralRe: text color and font Pin
J. Dunlap5-Oct-03 16:32
J. Dunlap5-Oct-03 16:32 
GeneralRe: text color and font Pin
no_life6-Oct-03 17:11
no_life6-Oct-03 17:11 
GeneralRe: text color and font Pin
no_life7-Oct-03 8:55
no_life7-Oct-03 8:55 
GeneralRe: text color and font Pin
alex.barylski7-Oct-03 9:16
alex.barylski7-Oct-03 9:16 

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.