Rt
    比如,第一次点击Frm的(0,0),第二次点击(800,600),两个点之间的距离是1000像素(勾股定理)。请教,如何计算物理距离。(多少厘米)。
    看了不少帖子,觉得不透彻,请求高手指点。

解决方案 »

  1.   

    1pixel   =   1/72   inch 
    1inch   =   2.5   cm
      

  2.   


    屏幕分辨率是1366*960时, 宽度是1366个像素, 
    if(1pixel==1/72inch)   width1=1366*(1/72);屏幕分辨率是800*600时, 宽度是800个像素
    width2=800*(1/72);请问,这个显示器的宽度是多少? 1366/72 inch 还是 800/72inch?
      

  3.   

          
    //代码如下,欢迎指正。
      private void Form1_Load(object sender, EventArgs e)
            {
                width = 0.34;                      //使用尺子 量算到的 显示器 宽度
                height = 0.272;                    //使用尺子 量算的 显示器 高度            widthPx = Screen.PrimaryScreen.Bounds.Width;      //水平像素数
                heightPx = Screen.PrimaryScreen.Bounds.Height;    //垂直像素数            pixUnitWidth = width / widthPx;        //单像素宽 
                pixUnitHeight = height / heightPx;    //单像素高
            }        //更新
            private void Form1_MouseMove(object sender, MouseEventArgs e)
            {
                double deltaX = e.X * pixUnitWidth;
                double deltaY = e.Y * pixUnitHeight;            double distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
                label1.Text = (distance).ToString() + "米";
            }
    //我就是nb,你服吗?