界面坐标和屏幕坐标有什么不同?他们是怎么定义的,比如,坐标(0,0)分别在哪个位值?X和Y轴的最大值分别是多少?

解决方案 »

  1.   

    屏幕左顶点为(0,0)点,往右1024,往下768(屏幕分辩率为1024*678情况下)界面坐标:界面左顶点为(0,0)点,往右为宽,往下为高
    通过GetClientRect获得
      

  2.   

    // 获取屏幕的分辨率
    int nFullWidth = GetSystemMetrics(SM_CXSCREEN);
    int nFullHeight = GetSystemMetrics(SM_CYSCREEN);
      

  3.   

    同意楼上,GetClientRect获得客户区的大小,应该就是你說的界面坐标了
      

  4.   

    CPoint SetWindowOrg( int x, int y );CPoint SetWindowOrg( POINT point );Return ValueThe previous origin of the window as a CPoint object.ParametersxSpecifies the logical x-coordinate of the new origin of the window.ySpecifies the logical y-coordinate of the new origin of the window.pointSpecifies the logical coordinates of the new origin of the window. You can pass either a POINT structure or a CPoint object for this parameter.ResSets the window origin of the device context. 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.
      

  5.   

    virtual int SetMapMode( int nMapMode );Return ValueThe previous mapping mode.ParametersnMapModeSpecifies the new mapping mode. It can be any one of the following values:MM_ANISOTROPIC   Logical units are converted to arbitrary units with arbitrarily scaled axes. Setting the mapping mode to MM_ANISOTROPIC does not change the current window or viewport settings. To change the units, orientation, and scaling, call the SetWindowExt and SetViewportExt member functions. MM_HIENGLISH   Each logical unit is converted to 0.001 inch. Positive x is to the right; positive y is up.
    MM_HIMETRIC   Each logical unit is converted to 0.01 millimeter. Positive x is to the right; positive y is up.
    MM_ISOTROPIC   Logical units are converted to arbitrary units with equally scaled axes; that is, 1 unit along the x-axis is equal to 1 unit along the y-axis. Use the SetWindowExt and SetViewportExt member functions to specify the desired units and the orientation of the axes. GDI makes adjustments as necessary to ensure that the x and y units remain the same size.
    MM_LOENGLISH   Each logical unit is converted to 0.01 inch. Positive x is to the right; positive y is up.
    MM_LOMETRIC   Each logical unit is converted to 0.1 millimeter. Positive x is to the right; positive y is up.
    MM_TEXT   Each logical unit is converted to 1 device pixel. Positive x is to the right; positive y is down.
    MM_TWIPS   Each logical unit is converted to 1/20 of a point. (Because a point is 1/72 inch, a twip is 1/1440 inch.) Positive x is to the right; positive y is up. 
    ResSets the mapping mode. The mapping mode defines the unit of measure used to convert logical units to device units; it also defines the orientation of the device’s x- and y-axes. GDI uses the mapping mode to convert logical coordinates into the appropriate device coordinates. The MM_TEXT mode allows applications to work in device pixels, where 1 unit is equal to 1 pixel. The physical size of a pixel varies from device to device. The MM_HIENGLISH, MM_HIMETRIC, MM_LOENGLISH, MM_LOMETRIC, and MM_TWIPS modes are useful for applications that must draw in physically meaningful units (such as inches or millimeters). The MM_ISOTROPIC mode ensures a 1:1 aspect ratio, which is useful when it is important to preserve the exact shape of an image. The MM_ANISOTROPIC mode allows the x- and y-coordinates to be adjusted independently.
      

  6.   

    GetClientRect得到的是客户区的大小,也就是说这样得到的左上角永远是(0,0)GetWindowRect 是窗口相对于整个屏幕的坐标,屏幕左上点为0,0相互转化用ScreenToClient 或者 ClientToScreen