在不同的分辩率下(1024x768,800x600等),假设一控件的左边距为2厘米,如保转换成象素?谢谢各位朋友!
http://community.csdn.net/Expert/topic/3113/3113415.xml?temp=6.980532E-02

解决方案 »

  1.   

    http://www.pbdr.com/vbtips/gen/convtwip.htm這裹表達得比較清楚了
      

  2.   

    看看
        SetMapMode(Canvas.Handle, MM_HIMETRIC);
        SetViewportOrgEx(Canvas.Handle, 300, 200, nil);
    是不是你要的The MM_HIMETRIC map mode uses the same axes orientation as the above three modes. Its units are gotten by multiplying each of the given units by 0.01 millimeter. Here is an example:
     
    procedure TForm1.FormPaint(Sender: TObject);
    begin
        SetMapMode(Canvas.Handle, MM_HIMETRIC);
        SetViewportOrgEx(Canvas.Handle, 300, 200, nil);    Canvas.Pen.Color := clRed;
        Canvas.Ellipse(-100, -100, 100, 100);    Canvas.Pen.Color := clBlue;
        Canvas.MoveTo(-300, 0);
        Canvas.LineTo(300, 0);
        Canvas.MoveTo(0, -200);
        Canvas.LineTo(0, 200);    Canvas.Pen.Color := clFuchsia;
        Canvas.MoveTo(0, 0);
        Canvas.LineTo(150, 150);
    end;
     
      

  3.   

    PixelsPerInch是每英寸的象素数。在转化成厘米应该比较简单吧。
    它与分辨率好象没有关系哦。你的意思是不是控件左边留2厘米的边距,在分辨率改变的情况下看起来是一样的?
      

  4.   

    哈哈,我知道,告诉我你的Email,我发给你!