Italian Trovare width e height da mm

Fulvio75

Well-Known Member
Licensed User
Ciao domanda... Devo impostare il width e height di un panel dalle misure in mm di uno schermo come si fa?
 

Xfood

Expert
Licensed User
Gli schermi non vanno a millimetri' la risoluzione è un'altra cosa
 

Xfood

Expert
Licensed User
Devi guardare le caratterische dello schermo
E la risoluzione' non la dimensione in mm che non serve a nulla
 

Fulvio75

Well-Known Member
Licensed User
Devi guardare le caratterische dello schermo
E la risoluzione' non la dimensione in mm che non serve a nulla
Ok... Prendo l'applicazione la installo e con la label scrivo height e width del panel con l'adattamento di questo allo schermo
 

klaus

Expert
Licensed User
Longtime User
Even it is not really what you are looking for, you can also find the real dimensions of the pixels with the code below.

B4X:
    Private jo As JavaObject
    Private xdpi, ydpi As Double
    jo = Root
    jo = jo.RunMethodJO("getResources", Null)
    jo = jo.RunMethodJO("getDisplayMetrics", Null)
    xdpi = jo.GetField("xdpi")
    ydpi = jo.GetField("ydpi")

xdpi and ydpi are the dots per inch values, the number of pixels per inch, for the device.
You could use these values if you want to display anything in real dimensions., like a ruler.

Otherwise you need to understand what are dip (device independent pixels) Anchors and AutoScale in the Designer.
 
  • Like
Reactions: udg

Fulvio75

Well-Known Member
Licensed User
Even it is not really what you are looking for, you can also find the real dimensions of the pixels with the code below.

B4X:
    Private jo As JavaObject
    Private xdpi, ydpi As Double
    jo = Root
    jo = jo.RunMethodJO("getResources", Null)
    jo = jo.RunMethodJO("getDisplayMetrics", Null)
    xdpi = jo.GetField("xdpi")
    ydpi = jo.GetField("ydpi")

xdpi and ydpi are the dots per inch values, the number of pixels per inch, for the device.
You could use these values if you want to display anything in real dimensions., like a ruler.

Otherwise you need to understand what are dip (device independent pixels) Anchors and AutoScale in the Designer.
Ok grazie mille, provo
 
Top