转换为英寸 [英] Converting to inches

查看:74
本文介绍了转换为英寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表单的高度和宽度单位是什么?测量为

(像素?)以及如何将该测量值转换为英寸?


谢谢

布伦特

解决方案

表单的大小以像素为单位。正常的测量值是每英寸96美元bb像素(虽然这显然不是真的,请看下面的链接

。)


但是,如果您试图确定

监视器上表单的实际大小,那将很难 - 用户的监视器不太可能

将显示每英寸96个像素。考虑一下你可以改变屏幕分辨率,例如,从800 x 600到1024 x 768.格式

可能是正确的。一个分辨率的英寸大小,但不会是另一个分辨率。
另一个分辨率。要计算实际尺寸,您需要知道显示器的可见尺寸,以及环境的屏幕

分辨率。

http://msdn.microsoft.com/library/de...ew/highdpi.asp

http://msdn.microsoft.com/library/de ... atesystems.asp


" Brent Hoskisson" <峰; br ************ @ colliergov.net>在消息中写道

news:02 **************************** @ phx.gbl ... < blockquote class =post_quotes>以
(像素?)为单位测量形状的高度和宽度单位是什么?如何将该测量值转换为英寸?

谢谢布伦特



嗨布伦特,


表格'的宽度以像素为单位,因为你''我找到了。每个表格(实际控制)

都有一个由Graphics对象控制的绘图表面。这是一个属性

DpiX,它是Dots-Per-Inch-Horizo​​ntal,以及相应的DpiY。


试试这个:

Dim g As Graphics

g = SomeForm.CreateGraphics

MsgBox(" DpiX" g.DpiX& vbCrLf _

宽度(mm)& SomeForm.Width& vbCrLf _

" Width(inches)="& SomeForm.Width / g.DpiX)


问候,

Fergus


你好,


" ; Fergus Cooney <音响****** @ tesco.net> schrieb:

试试这个:
Dim g As Graphics
g = SomeForm.CreateGraphics

MsgBox(" DpiX"& g.DpiX & vbCrLf _
" Width(mm)& SomeForm.Width& vbCrLf _
" Width(inches)=" SomeForm.Width / g.DpiX)




\\\

g.Dispose()

///


-

Herfried K. Wagner

MVP·VB Classic,VB.NET
http://www.mvps.org/dotnet


What is a unit of height and width of a form measured as
(pixels?) and how can I convert that measurement to inches?

Thanks
Brent

解决方案

The size of a form is measured in pixels. The normal measurement is 96
pixels per inch (although this apparently isn''t always true, see the link
below.)

However, if you''re trying to determine the actual size of a form on the
monitor, that will be difficult -- it''s unlikely that the user''s monitor
will be displaying exactly 96 pixels per inch. Consider that you can change
the screen resolution, for example, from 800 x 600 to 1024 x 768. The form
might be the "right" size in inches at one resolution, but won''t be at
another resolution. To calculate the actual size, you''d need to know the
viewable size of the monitor, along with the environment''s screen
resolution.

http://msdn.microsoft.com/library/de...ew/highdpi.asp

http://msdn.microsoft.com/library/de...atesystems.asp


"Brent Hoskisson" <br************@colliergov.net> wrote in message
news:02****************************@phx.gbl...

What is a unit of height and width of a form measured as
(pixels?) and how can I convert that measurement to inches?

Thanks
Brent



Hi Brent,

A Form''s width is in pixels, as you''ve found. Each Form (actually Control)
has a drawing surface controlled by a Graphics object. This has a property
DpiX which is Dots-Per-Inch-Horizontal, and a corresponding DpiY.

Try this:
Dim g As Graphics
g = SomeForm.CreateGraphics

MsgBox ("DpiX " & g.DpiX & vbCrLf _
"Width (mm) " & SomeForm.Width & vbCrLf _
"Width (inches) = " & SomeForm.Width / g.DpiX)

Regards,
Fergus


Hello,

"Fergus Cooney" <fi******@tesco.net> schrieb:

Try this:
Dim g As Graphics
g = SomeForm.CreateGraphics

MsgBox ("DpiX " & g.DpiX & vbCrLf _
"Width (mm) " & SomeForm.Width & vbCrLf _
"Width (inches) = " & SomeForm.Width / g.DpiX)



\\\
g.Dispose()
///

SCNR

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


这篇关于转换为英寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆