vb.net窗口分辨率 vb窗口大小

在VB.NET中通过那个函数可以获取当前屏幕的分辨率?您可以用下面给出这一小段代码检测当前屏幕分辨率 , 然后根据结果作出反应──例如,重新调整窗体大小以适应用程序户分辨率 。
PublicFunctionCheckRez(pixelWidthAsLong,pixelHeightAsLong)AsBoolean
'
DimlngTwipsXAsLong
DimlngTwipsYAsLong
'
'convertpixelstotwips
lngTwipsX=pixelWidth*15
lngTwipsY=pixelHeight*15
'
'checkagainstcurrentsettings
IflngTwipsXScreen.WidthThen
CheckRez=False
Else
IflngTwipsYScreen.HeightThen
CheckRez=False
Else
CheckRez=True
EndIf
EndIf
'
EndFunction
Next,runthefollowingcodeatthestartoftheprogram:
IfCheckRez(640,480)=FalseThen
MsgBox"Incorrectscreensize!"
Else
MsgBox"ScreenResolutionMatches!"
EndIf
VB.NET设置屏幕分辨率、颜色位数、刷新率 实例代码这篇文章介绍vb.net窗口分辨率了VB.NET设置屏幕分辨率、颜色位数、刷新率
实例代码vb.net窗口分辨率,有需要vb.net窗口分辨率的朋友可以参考一下
复制代码
代码如下:
Private
Declare
Function
GetDeviceCaps
Lib
"gdi32"
(ByVal
hdc
As
Long,
ByVal
nIndex
As
Long)
As
Long
Private
Declare
Function
ChangeDisplaySettings
Lib
"user32"
Alias
"ChangeDisplaySettingsA"
(lpDevMode
As
Any,
ByVal
dwflags
As
Long)
As
Long
Private
Const
CCDEVICENAME
As
Long
=
32
Private
Const
CCFORMNAME
As
Long
=
32
Private
Const
DM_BITSPERPEL
As
Long
=
H40000
Private
Const
DM_PELSWIDTH
As
Long
=
H80000
Private
Const
DM_PELSHEIGHT
As
Long
=
H100000
Private
Const
DM_DISPLAYFLAGS
As
Long
=
H200000
Private
Const
DM_DISPLAYFREQUENCY
=
H400000
Private
Const
CDS_FORCE
As
Long
=
H80000000
Private
Const
BITSPIXEL
As
Long
=
12
Private
Const
HORZRES
As
Long
=
8
Private
Const
VERTRES
As
Long
=
10
Private
Const
VREFRESH
=
116
Private
Type
DEVMODE
dmDeviceName
As
String
*
CCDEVICENAME
dmSpecVersion
As
Integer
dmDriverVersion
As
Integer
dmSize
As
Integer
dmDriverExtra
As
Integer
dmFields
As
Long
dmOrientation
As
Integer
dmPaperSize
As
Integer
dmPaperLength
As
Integer
dmPaperWidth
As
Integer
dmScale
As
Integer
dmCopies
As
Integer
dmDefaultSource
As
Integer
dmPrintQuality
As
Integer
dmColor
As
Integer
dmDuplex
As
Integer
dmYResolution
As
Integer
dmTTOption
As
Integer
dmCollate
As
Integer
dmFormName
As
String
*
CCFORMNAME
dmUnusedPadding
As
Integer
【vb.net窗口分辨率 vb窗口大小】dmBitsPerPel
As
Integer
dmPelsWidth
As
Long
dmPelsHeight
As
Long
dmDisplayFlags
As
Long
dmDisplayFrequency
As
Long
End
Type
Private
Sub
cmdChangeDesktopMode_Click()
Dim
DM
As
DEVMODE
With
DM
.dmPelsWidth
=
CInt(txtNewWidth.Text)
.dmPelsHeight
=
CInt(txtNewHeight.Text)
.dmBitsPerPel
=
CInt(txtNewColor.Text)
.dmDisplayFrequency
=
CInt(txtNewFreq.Text)
.dmFields
=
DM_PELSWIDTH
Or
DM_PELSHEIGHT
Or
DM_BITSPERPEL
Or
DM_DISPLAYFREQUENCY
.dmSize
=
LenB(DM)
End
With
If
ChangeDisplaySettings(DM,
CDS_FORCE)
Then
MsgBox
"错误!不支持此模式vb.net窗口分辨率!"
End
If
End
Sub
Private
Sub
Form_Load()
txtOldWidth.Text
=
GetDeviceCaps(Me.hdc,
HORZRES)
txtOldHeight.Text
=
GetDeviceCaps(Me.hdc,
VERTRES)
txtOldColor.Text
=
GetDeviceCaps(Me.hdc,
BITSPIXEL)
txtOldFreq.Text
=
GetDeviceCaps(Me.hdc,
VREFRESH)
End
Sub
.NET (C#,VB也行)调用API使窗口大小能够超过屏幕分辨率要怎么做???首先你要熟悉API函数,具体用哪些函数就不记得了~~~~~
其次,把你要用到API函数引用到代码中来 , 就可以用了啊
VB里貌似这段代码挺多的,需要好好研究
C#中,可以通过

winform窗体分辨率问题解决方案:
你也可以选择使用TableLayoutPanel等控件作为容器 , 把其他的控件放入Panel中,这个控件会使其中包含的控件随着程序环境的变化而变化 。
注:TableLayoutPanel和Panel控件的DOCK属性应该都设为:fill 。

的方法来实现~~~~~~~~~~·
vb.net 怎样将窗体和所有控件根据电脑分辨率固定?Public Class Form1
Dim 初始化控件自动大小调整与窗口的宽度比例 As Integer
Dim 初始化控件自动大小调整与窗口的高度比例 As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
初始化控件自动大小调整与窗口的宽度比例 = Me.Width / 控件自动大小调整.Width
初始化控件自动大小调整与窗口的高度比例 = Me.Height / 控件自动大小调整.Height
显示控件的位置坐标()
End Sub
Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd
' Form1_ResizeEnd这个事件是 窗口大小变化完成后 再进行操作的
控件自动大小调整.Location = New Point(控件自动大小调整.Left, 控件自动大小调整.Top)
'设置控件的初始左位置坐标与上位置坐标
控件自动大小调整.Size = New Point(Int(Me.Width / 初始化控件自动大小调整与窗口的宽度比例), Int(Me.Height / 初始化控件自动大小调整与窗口的高度比例))
'更改控件的大小按第一次窗口的比例 进行调整
显示控件的位置坐标()
End Sub
Private Sub 显示控件的位置坐标()
Label1.Text = "控件的上边距坐标: "控件自动大小调整.Top
Label2.Text = "控件的左边距坐标: "控件自动大小调整.Left
Label3.Text = "控件的宽度大?。?"控件自动大小调整.Width
Label4.Text = "控件的高度大?。?"控件自动大小调整.Height
End Sub
End Class
vb.net如何获取屏幕分辨率从而设置窗体大小默认单位是像素
96是系统的一种设定 , 每英寸的点数,是系统界面用小字体时的设置
用像素数除以dpi没有意义
VB.NET中设定窗体大小窗体初始化时,设定Windowstate= maximized.
窗体分辨率仍然可以设成1920x1080 。设计元素的时候拖拽,或者使用代码初始化控件 。
关于vb.net窗口分辨率和vb窗口大小的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读