可以使用下面的代码取得后进行判断,代码来自http://bingning.net/free/source/system/displaysize.htmlDim h, w As Integer '显示器的显示范围高度 h = System.Windows.Forms.Screen.GetWorkingArea(Me).Height '显示器的显示范围宽度 w = System.Windows.Forms.Screen.GetWorkingArea(Me).Width
If Screen.Width\Screen.TwipsPerPixelX =1024 AND Screen.Height\ Screen.TwipsPerPixelY =768 ThenEnd If
Const SWP_NOMOVE As Long = &H2 Const SWP_NOSIZE As Long = &H1 Const FLAG = SWP_NOMOVE Or SWP_NOSIZE Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const HWND_TOP = 0 Const HWND_BOTTOM = 1 Private Declare Function SetWindowPos Lib "user32" _ (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _ ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _ ByVal wFlags As Long) As Long
Private Sub Form_Load() Me.Move 0, 0, Screen.Width, Screen.Height Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAG) End Sub怎么改成,让窗体大小1024*768分辨率下的最大化 如果是别的分辨率,就不执行最大化?大家教下我
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Private Const SM_CXSCREEN = 0 Private Const SM_CYSCREEN = 1if GetSystemMetrics(SM_CXSCREEN)=1024 and GetSystemMetrics(SM_CYSCREEN)=768 then 全屏
If Screen.Width\Screen.TwipsPerPixelX =1024 AND Screen.Height\ Screen.TwipsPerPixelY =768 Then ....
GetSystemMetrics(SM_CXSCREEN)
GetSystemMetrics(SM_CYSCREEN)
VB自带的有时候返回的值会有错误,之前写改键器的时候遇到过
'显示器的显示范围高度
h = System.Windows.Forms.Screen.GetWorkingArea(Me).Height
'显示器的显示范围宽度
w = System.Windows.Forms.Screen.GetWorkingArea(Me).Width
Const SWP_NOSIZE As Long = &H1
Const FLAG = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const HWND_TOP = 0
Const HWND_BOTTOM = 1
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Sub Form_Load()
Me.Move 0, 0, Screen.Width, Screen.Height
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAG)
End Sub怎么改成,让窗体大小1024*768分辨率下的最大化
如果是别的分辨率,就不执行最大化?大家教下我
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1if GetSystemMetrics(SM_CXSCREEN)=1024 and GetSystemMetrics(SM_CYSCREEN)=768 then
全屏