网站建设资讯

NEWS

网站建设资讯

包含vb.net显示器分辨率的词条

vb.net屏幕分辨率的单位是什么?

默认单位是像素

在织金等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都做网站、网站建设、外贸营销网站建设 网站设计制作按需定制,公司网站建设,企业网站建设,品牌网站设计,全网营销推广,成都外贸网站建设,织金网站建设费用合理。

96是系统的一种设定,每英寸的点数,是系统界面用小字体时的设置

用像素数除以DPI没有意义

在VB.NET中通过那个函数可以获取当前屏幕的分辨率?

您可以用下面给出这一小段代码检测当前屏幕分辨率,然后根据结果作出反应──例如,重新调整窗体大小以适应用程序户分辨率。

Public Function CheckRez(pixelWidth As Long, pixelHeight As Long) As Boolean

'

Dim lngTwipsX As Long

Dim lngTwipsY As Long

'

' convert pixels to twips

lngTwipsX = pixelWidth * 15

lngTwipsY = pixelHeight * 15

'

' check against current settings

If lngTwipsX Screen.Width Then

CheckRez = False

Else

If lngTwipsY Screen.Height Then

CheckRez = False

Else

CheckRez = True

End If

End If

'

End Function

Next, run the following code at the start of the program:

If CheckRez(640, 480) = False Then

MsgBox "Incorrect screen size!"

Else

MsgBox "Screen Resolution Matches!"

End If

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

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

"错误!不支持此模式!"

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

vb.net中怎么可以让窗体全屏显示?

Me.Height = My.Computer.Screen.Bounds.Height

Me.Width = My.Computer.Screen.Bounds.Width

这是设置窗体的长宽和屏幕的分辨率一样大小,相当于全屏。

如果Me.WindowState=FormWindowState.Maximized的话,只是单纯的将窗体最大化,但恢复窗口大小后窗体的大小实际上还和原来一样大。

VB.NET的特点

1.真正成为面向对象以及支持继承性的语言。

2.窗体设计器支持可视化继承,并且包含了许多新的特性,比如自动改变窗体大小、资源本地化支持、数据类工具内在支持XML数据。

3.直接建立在.NET的框架结构上,因此开发人员可以充分利用所有.NET平台特性,也可以与其他的.NET语言交互。

4.为Windows应用程序提供了XCOPY部署,开发者不再需要为DLL的版本问题担忧。

vb.net 怎样将窗体和所有控件根据电脑分辨率固定?

使用SplitContainer1控件不就行了,SplitContainer1控件的Fixedpanel属性设置为Panel1\x0d\x0aSplitContainer1的Panel2里面再放置一个SplitContainer2\x0d\x0aSplitContainer2控件的Fixedpanel属性设置为Panel2\x0d\x0a二个SplitContainer设置为水平折为器方向\x0d\x0a至于播放器控件就放在SplitContainer2控件Panel1里面\x0d\x0a播放器控件DOCK设置为FILL\x0d\x0a\x0d\x0a这样不管放大缩小界面,播放器控件总是自适应窗体大小而菜单按钮总是在最边缘


分享标题:包含vb.net显示器分辨率的词条
文章出自:http://cdweb.net/article/hisesp.html