vb 中怎么取屏幕的长和宽

来源:百度知道 编辑:UC知道 时间:2024/07/05 06:23:13
有什么方法或属性 或则是函数才能知道屏幕的长和宽!

screen.width就是屏幕的宽呀。screen.height高

Private Sub Command1_Click()
x = Screen.Width / Screen.TwipsPerPixelX
y = Screen.Height / Screen.TwipsPerPixelY
MsgBox x & "x" & y
End Sub

Screen.Width 是屏幕的绝对宽度,单位是twip(1twip=1/1440英寸)
Screen.Height 是屏幕的绝对高度,单位是twip
Screen.Width/Screen.TwipsPerPixelX 是屏幕的相对宽度,单位是像素pixel,其值根据分辨率大小而不同,TwipsPerPixelX是美像素有多少twip
Screen.Height/Screen.TwipsPerPixelY 是屏幕的相对宽度,单位是像素pixel