Board logo

標題: VB.Net 2005 變換螢幕解析度語法範例 [打印本頁]

作者: narita    時間: 2011-9-6 00:26     標題: VB.Net 2005 變換螢幕解析度語法範例

下面的 Form 裡面,只有一個 Label 及兩個 Button 元件而已:
Public Class Form1

Private Const CCDEVICENAME As Short = 32
Private Const CCFORMNAME As Short = 32
Private Const DM_PELSWIDTH As Integer = &H80000
Private Const DM_PELSHEIGHT As Integer = &H100000
'更新螢幕掃瞄頻率常數
Private Const DM_DISPLAYFREQUENCY As Integer = &H400000

'宣告要使用的 API 函式
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Integer, ByVal iModeNum As Integer, ByRef lpDevMode As DEVMODE) As Boolean

'宣告要使用的 API 函式
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (ByRef lpDevMode As DEVMODE, ByVal dwflags As Integer) As Integer

'定義要使用的變數結構
Private Structure DEVMODE
<VBFixedString(CCDEVICENAME), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=CCDEV ..




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)