How do i scale a DC?
-
Hi, Im trying to scale a DC of a CWnd derivade (NOT CVIEW) and im not getting any success. Ive tried CDC::ScaleWindowExt(...) and CDC::ScaleViewportExt(...), among others. Also im using scroll bars in that window... does that affect it? Thanks in advanced
-
Hi, Im trying to scale a DC of a CWnd derivade (NOT CVIEW) and im not getting any success. Ive tried CDC::ScaleWindowExt(...) and CDC::ScaleViewportExt(...), among others. Also im using scroll bars in that window... does that affect it? Thanks in advanced
What mapping mode are you using...?
MM_ISOTROPIC
...? "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr -
What mapping mode are you using...?
MM_ISOTROPIC
...? "An expert is someone who has made all the mistakes in his or her field" - Niels BohrIve already tried with MM_ISOTROPIC and MM_ANISOTROPIC and MM_TEXT, but no success so far. Right now, i dont have a limitation in using any of type of mapping mode. Maybe im using it wrong. U have a good example?
-
Ive already tried with MM_ISOTROPIC and MM_ANISOTROPIC and MM_TEXT, but no success so far. Right now, i dont have a limitation in using any of type of mapping mode. Maybe im using it wrong. U have a good example?
One of my books shows exactly how this is accomplished...if I have some spare time in the next few i'll look into for you if someone hasn't answered it already... Cheers! "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
-
Ive already tried with MM_ISOTROPIC and MM_ANISOTROPIC and MM_TEXT, but no success so far. Right now, i dont have a limitation in using any of type of mapping mode. Maybe im using it wrong. U have a good example?
I managed to get this doing something like what you want (i think) but i'm gonna count on you to figure out how it works... :)
OnPaint()
: // make sure you call invalidate insideOnSize()
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(rect);dc.SetMapMode(MM_ISOTROPIC); // Force ONE to ONE relationship
dc.SetWindowExt(rect.Width(), rect.Height());// Start drawing
dc.SetViewportOrg(0, 0);dc.LineTo(CPoint(200, 200));
dc.LineTo(CPoint(0, 200));
dc.LineTo(CPoint(200, 0));"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
-
I managed to get this doing something like what you want (i think) but i'm gonna count on you to figure out how it works... :)
OnPaint()
: // make sure you call invalidate insideOnSize()
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(rect);dc.SetMapMode(MM_ISOTROPIC); // Force ONE to ONE relationship
dc.SetWindowExt(rect.Width(), rect.Height());// Start drawing
dc.SetViewportOrg(0, 0);dc.LineTo(CPoint(200, 200));
dc.LineTo(CPoint(0, 200));
dc.LineTo(CPoint(200, 0));"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
k, i found how it can work, but it needs some changes: U have to call CDC::SetViewportExt(...) It works something like this: 1st SetMapMode(MM_ISOTROPIC) 2nd SetWindowExt(200,300) - carefull here, cause it sets the portion of the window to be considered 3rd SetViewportExt(rect.Width(), rect.Height()), to set the corresponding size of the "view" thanks for the guidance :cool: