Home > Software engineering >  Changed after mapping mode, the client area changed..
Changed after mapping mode, the client area changed..

Time:09-15

The first picture is code, the second is the interface,

CodePudding user response:

Don't use figure code!

CodePudding user response:

Different from those MM_TEXT MM_LOENGLISH unit

CodePudding user response:

reference 1st floor schlafenhamster response:
code don't use figure!

Afx_msg void cmainwindw: : OnLButtonDown (UINT nFlags, CPoint point) {CClientDC dc (this); CRect the rect. GetClientRect (& amp; The rect); Dc. SetMapMode (MM_LOENGLISH); CPoint pp (the rect. Width ()/2, - (the rect. Height ()/2)); Dc. LPtoDP (& amp; Pp); Dc. SetViewportOrg (pp); Dc. MoveTo (0, 0); Dc. LineTo (- the rect. Width ()/2, - (the rect. Height ()/2)); Dc. MoveTo (0, 0); Dc. LineTo (the rect. Width ()/2, (the rect. Height ()/2)); Dc. MoveTo (0, 0); Dc. LineTo (- the rect. Width ()/2, (the rect. Height ()/2)); Dc. MoveTo (0, 0); Dc. LineTo (the rect. Width ()/2, - (the rect. Height ()/2)); Dc. The Ellipse (200200200, 200); }

CodePudding user response:

reference 1st floor schlafenhamster response:
code don't use figure!

Afx_msg void cmainwindw: : OnLButtonDown (UINT nFlags, CPoint point)
{
CClientDC dc (this);
CRect the rect.
GetClientRect (& amp; The rect); Dc. SetMapMode (MM_LOENGLISH);
CPoint pp (the rect. Width ()/2, - (the rect. Height ()/2)); Dc. LPtoDP (& amp; Pp);
Dc. SetViewportOrg (pp);
Dc. MoveTo (0, 0);
Dc. LineTo (- the rect. Width ()/2, - (the rect. Height ()/2)); Dc. MoveTo (0, 0);
Dc. LineTo (the rect. Width ()/2, (the rect. Height ()/2)); Dc. MoveTo (0, 0);
Dc. LineTo (- the rect. Width ()/2, (the rect. Height ()/2)); Dc. MoveTo (0, 0);
Dc. LineTo (the rect. Width ()/2, - (the rect. Height ()/2)); Dc. The Ellipse (200200200, 200);
}

CodePudding user response:

//Convert the size in points to device coordinate
Void CLoEnglishView: : PointToDevice (CDC * pDC, SIZE & amp; The size)
{
Int dpix=pDC - & gt; GetDeviceCaps (LOGPIXELSX);//144
Int dpiy=pDC - & gt; GetDeviceCaps (LOGPIXELSY);//144

Cx * dpix/size. Cx=size. 72;//11737 * 144/72=20
Size. Cy=size. Cy * dpiy/72;//4
}
//Convert the size in device coordinate to logical coordinate
Void CLoEnglishView: : DeviceToLogical (CDC * pDC, SIZE & amp; The size)
{
POINT p [2]={cx, 0, 0, the size size. The cy};

PDC - & gt; DPtoLP (p, 2);

Size. Cx=abs (p [1]. X - p [0]. X);
Size. Cy=abs (p [1]. Y - p [0]. Y);
}

CodePudding user response:

MM_LOENGLISH mode the use of double buffer drawing window "
https://download.csdn.net/download/schlafenhamster/9427265
This program demonstrates how to MM_LOENGLISH mode with double buffer drawing window, focus on MM_TEXT and MM_LOENGLISH mode BitBlt calls,

CodePudding user response:

refer to 6th floor schlafenhamster response:
MM_LOENGLISH mode the use of double buffer drawing window "
https://download.csdn.net/download/schlafenhamster/9427265
This program demonstrates how to MM_LOENGLISH mode with double buffer drawing window, focus on MM_TEXT and MM_LOENGLISH mode BitBlt calls,

I don't have to this pattern,, I use a custom mode or LOM beginning,

CodePudding user response:

refer to 6th floor schlafenhamster response:
MM_LOENGLISH mode the use of double buffer drawing window "
https://download.csdn.net/download/schlafenhamster/9427265
This program demonstrates how to MM_LOENGLISH mode with double buffer drawing window, focus on MM_TEXT and MM_LOENGLISH mode BitBlt calls,

And this seems to be complicated, I read a book or on the Internet is a simple method, is to use setwindowExt setviewExt and change the size of the logical unit,

CodePudding user response:

refer to 6th floor schlafenhamster response:
MM_LOENGLISH mode the use of double buffer drawing window "
https://download.csdn.net/download/schlafenhamster/9427265
This program demonstrates how to MM_LOENGLISH mode with double buffer drawing window, focus on MM_TEXT and MM_LOENGLISH mode BitBlt calls,

It's just I wouldn't use,

CodePudding user response:

What is the meaning of the client area changed? What is the original
SDI, MID the drawing of the client area should be CXXXXView View class and choose the wrong handling of class?

CodePudding user response:

Give you wrote a
 
Void CLoEnglishView: : OnLButtonDown (UINT nFlags, CPoint point)
{
//TODO: Add your message handler code here and/or call the default
The static BOOL sw=FALSE;
CClientDC dc (this);
//back color
CRect the rect.
GetClientRect (& amp; The rect);
Dc. SetMapMode (MM_TEXT);
SetWindowOrgEx (dc, 0, 0, NULL);
SetViewportOrgEx (dc, 0, 0, NULL);
If (sw)
Dc. FillSolidRect (0, 0, the rect. Width (), the rect. Height (), RGB (255, 128, 255));
The else
Dc. FillSolidRect (0, 0, the rect. Width (), the rect. Height (), RGB (255, 255, 128));
if(! Sw)
{
Sw=TRUE;
Dc. SetMapMode (MM_LOENGLISH);
SetWindowOrgEx (dc, 0, 0, NULL);
SetViewportOrgEx (dc, the rect. Right/2, the rect. The bottom/2, NULL);
}
The else
{
Sw=FALSE;
Dc. SetMapMode (MM_TEXT);
SetWindowOrgEx (dc, 0, 0, NULL);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related