189 8069 5689

包含vb.net自适应分辨率的词条

VB 窗体控件分辨率自适应问题

Public Type CONTROLRECT Left As Single Top As Single Width As Single Height As SingleEnd Type Public Const HORZRES = 8Public Const VERTRES = 10Public Declare Function GetDesktopWindow Lib "user32" () As LongPublic Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As LongPublic Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As LongPublic Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long '取得界面原始控件的位置及大小,并保存到数组里Public Sub GetSourcePos(this As Object, rc() As CONTROLRECT, Optional bigFont As Boolean = True)

网站建设、成都做网站过程中,需要针对客户的行业特点、产品特性、目标受众和市场情况进行定位分析,以确定网站的风格、色彩、版式、交互等方面的设计方向。成都创新互联还需要根据客户的需求进行功能模块的开发和设计,包括内容管理、前台展示、用户权限管理、数据统计和安全保护等功能。

'On Error Resume Next

Dim tempX As Integer, tempY As IntegertempX = this.ScaleWidth '1024tempY = this.ScaleHeight '768 '此处原来如果在1024*768分辨率下显示正常的话,就可以直接赋值1024和768 Dim temp As Control Dim nSum As Integer nSum = 0 For Each temp In this '此处要注意,有些控件没有width,height等属性,在此要做出判断 If TypeOf temp Is ComboBox Then With rc(nSum) .Left = temp.Left / tempX .Width = temp.Width / tempX .Top = temp.Top / tempY End With ElseIf TypeOf temp Is Timer Then' 'none' ElseIf TypeOf temp Is StatusBar Then' 'none Else With rc(nSum) .Left = temp.Left / tempX .Width = temp.Width / tempX .Top = temp.Top / tempY .Height = temp.Height / tempY End With End If nSum = nSum + 1 NextEnd Sub '根据比例调整控件的大小Public Sub SetNewPos(this As Object, rc() As CONTROLRECT)

'On Error Resume Next Dim tempX As Integer, tempY As Integer tempX = this.ScaleWidth '1024 tempY = this.ScaleHeight '768 ' '如果初始界面显示始终是以最大化的方式显示的话,此处就可以调用系统分辨率进行设置tempx,tempy' hwnd = GetDesktopWindow()' ' Get the device context for the desktop' hdc = GetWindowDC(hwnd)' If hdc Then' Dim a As Long, b As Long' a = GetDeviceCaps(hdc, HORZRES)' b = GetDeviceCaps(hdc, VERTRES)' tempX = a' tempY = b' End If' ReleaseDC hwnd, hdc Dim temp As Control '//用于取各种控件 Dim nSum As Integer nSum = 0 For Each temp In this '此处要注意,有些控件没有width,height等属性,在此要做出判断 If TypeOf temp Is ComboBox Then temp.Left = rc(nSum).Left * tempX temp.Width = rc(nSum).Width * tempX temp.Top = rc(nSum).Top * tempY ElseIf TypeOf temp Is Timer Then 'none 'ElseIf TypeOf temp Is StatusBar Then 'none Else temp.Left = rc(nSum).Left * tempX temp.Width = rc(nSum).Width * tempX temp.Top = rc(nSum).Top * tempY temp.Height = rc(nSum).Height * tempY End If nSum = nSum + 1 Next End Sub

vb自适应分辨率

没有什么难的啊,窗体按分辨率大小,自动设置下就行了啊。

在LOAD时,添加上:

Me.Move 0, 0, Screen.Width, Screen.Height

就自动屏幕大小了啊。

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 怎样将窗体和所有控件根据电脑分辨率固定?

使用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保存图片时如何调整其分辨率

保存前加一句 myImage2.SetResolution(300, 300) 你设置的bMape不是保存的主画布 所以无效,设置分辨率就是 SetResolution(X,Y)


新闻标题:包含vb.net自适应分辨率的词条
URL网址:http://jkwzsj.com/article/dsegcci.html

其他资讯