pDC->SetWindowOrg();
pDC->SetViewportOrg();
pDC->SetWindowExt();
pDC->SetViewportExt();
这4个函数怎么用?请解释以下他们的作用是什么?
举例~
RECT rc;
this->GetClientRec(&rc);
这样就可以得到窗口的大小吗?没有初始化呀?

解决方案 »

  1.   

    前四个不懂。。
    后面的你没初始化但GetClientRect会把RECT结构中的各个无素填入适当的值无需初始化
      

  2.   

    看MSDN里GDI的坐标空间和变换部分
      

  3.   

    Sets the window origin of the device context.CPoint SetWindowOrg(
       int x,
       int y 
    );
    CPoint SetWindowOrg(
       POINT point 
    );
    Parameters

    Specifies the logical x-coordinate of the new origin of the window. 

    Specifies the logical y-coordinate of the new origin of the window. 
    point 
    Specifies the logical coordinates of the new origin of the window. You can pass either a POINT structure or a CPoint object for this parameter. 
    Return Value
    The previous origin of the window as a CPoint object.Res
    The window, along with the device-context viewport, defines how GDI maps points in the logical coordinate system to points in the device coordinate system. The window origin s the point in the logical coordinate system from which GDI maps the viewport origin, a point in the device coordinate system specified by the SetWindowOrg function. GDI maps all other points by following the same process required to map the window origin to the viewport origin. For example, all points in a circle around the point at the window origin will be in a circle around the point at the viewport origin. Similarly, all points in a line that passes through the window origin will be in a line that passes through the viewport origin.具体见MSDN
      

  4.   

    靠,能看清楚还问你?
    pDC->SetWindowOrg(0,0);//把现在的(0,0)
    pDC->SetViewportOr(x,y);//设到(x,y)
    pDC->SetWindowExt();//设计宽和高
    pDC->SetViewportExt();//到那里
      

  5.   

    pDC->SetWindowOrg(0,0);//把现在的(0,0)
    pDC->SetViewportOr(x,y);//设到(x,y)
    pDC->SetWindowExt();//设计宽和高
    pDC->SetViewportExt();//到那里GetClientRect会把RECT结构中的各个无素填入适当的值无需初始化GetClientRect会把RECT结构中的各个无素填入适当的值无需初始化