convert mm to Pixels??


  • Hi, does anyone have any idea how to convert mm to Pixels. I use this to let users  align labels on a form dynamically, and then save the values in a db.

    Monday, July 04, 2005 2:28 AM


  • That would depend on the screen resolution.  The pixel per inch (or Pixel per MM in yoru case) changes for each resolution.

    You can do 2 things.  Because the controls are all saved in Pixel distances, you can save the current Top,Left,height, width of a control into your database, and simply restore those settings.

    the other option, would be to save it as a percentage.  So if they change their screen resolution, you can always position the control near the same place.

    ie, to save the .left of a control, use...

    LeftVal = 100 - (((Me.Width - Button1.Left) / Me.Width) * 100)

    where ME is the form, and button1 is a sample control.
    Just reverse the formula when restoring the values.

    Monday, July 04, 2005 6:39 AM