À©µµ¿ì ÇÁ·Î±×·¡¹Ö ÀÚ·á |
---|
Á¦¸ñ | [MFC] Graphic °ü·Ã 1998/07/28 (10:30) |
À̸§ | ±èÈ¿¿ø |
¹øÈ£ | 39 |
Á¶È¸ | 406 |
º»¹® |
CWnd::GetClientRect void GetClientRect(LPRECT lpRect) const; Parameter lpRect : Points to a RECT structure or a CRect object to receive the client coordinates. The left and top members will be 0. The right and bottom members will contain the width and height of the window. Remarks Copies the client coordinates of the CWnd client area into the structure pointed to by lpRect. The client coordinates specify the upper-left and lower-right corners of the client area, Since client coordinates are relatives to the upper-left corners of the CWnd client area, the coordinates of the upper-left corner are (0,0) See Also : CWnd::GetWindowRect ex) CRect clientRect; GetClientRect(clientRect); InvalidateRect()´Â WM_PAINT¸¦ È£ÃâÇÏ¿©, ±Ã±ØÀûÀ¸·Î CViewŬ·¡½º ³»ÀÇ OnDraw()¸¦ ½ÇÇà. SetWindowOrg() ¾Æ·¡ÀÇ ¿¹¿¡¼ À©µµ¿ìÀÇ °¡Àå ¿ÞÂÊ »ó´Ü ÁöÁ¡À» (100,100)À¸·Î °¡Á¤ÇÏ°Ô µÈ´Ù. µû¶ó¼, (150,150)Àº ½ÇÁ¦·Î À©µµ¿ì¿¡¼ (50,50) ÁöÁ¡ÀÌ µÇ°í, (0,0)¿¡ ÀμâÇÑ Text´Â ´«¿¡ º¸ÀÌÁö ¾Ê°Ô µÈ´Ù. pDC->SetWindowOrg(100,100); string.Format("right=%d, bottom=%d",rect.right,rect.bottom); pDC->Rectangle(CRect(150,150,300,300)); pDC->TextOut(0,0,string); SetViewportOrg(); ¾Æ·¡ÀÇ ¿¹¿¡¼´Â À©µµ¿ì ³»ÀÇ (100,100)ÁöÁ¡À» (0,0)¿¡ ¸ÅÄ¡½ÃÅ°°Ô µÈ´Ù. µû¶ó¼, (150,150)Àº À©µµ¿ì ÁÂÃø »ó´Ü¿¡¼ (250,250) ¶³¾îÁø ÁöÁ¡À» ÀǹÌÇÏ¿©, (0,0)¿¡ ÀμâÇÑ Text´Â À©µµ¿ìÀÇ (100,100)ÁöÁ¡¿¡ ³ªÅ¸³ª°Ô µÈ´Ù. pDC->SetViewportOrg(100,100); string.Format("right=%d, bottom=%d",rect.right,rect.bottom); pDC->Rectangle(CRect(150,150,300,300)); pDC->TextOut(0,0,string); ³í¸®ÁÂÇ¥¿Í ÀåÄ¡ ÁÂÇ¥ ÀåÄ¡ ÁÂÇ¥´Â À©µµ¿ì ³»¿¡¼ °íÁ¤µÈ°Ô Á¸ÀçÇÏ´Â Pixel´ÜÀ§ÀÇ ÁÂÇ¥À̸ç, ³í¸®ÁÂÇ¥´Â SetWindowOrg, SetViewportOrgµîÀ¸·Î »ç¿ëÇϱâ ÆíÇÏ°Ô º¯È¯µÈ ÁÂǥü°èÀÌ´Ù. * LineÀ» ±×¸®´Â ¹æ¹ý CDC::MoveTo(int x, int y); CDC::MoveTo(POINT point); ¸¦ ÀÌ¿ëÇÏ¿©, ÇöÀçÀÇ ÁÂÇ¥¸¦ ¿Å±ä ÈÄ¿¡, BOOL CDC::LineTo(int x, int y); BOOL CDC::LineTo(POINT point); ¸¦ ÀÌ¿ëÇÏ¿© ±×¸°´Ù. |