我的代码如下:
Private Sub Form_Load()
With Me
.Left = 0
. = 0
.Height = Screen.Height
.Width = Screen.Width
End With
End Sub
通过以上代码,本机可以显示任务栏,但是拿到别的机器上窗体却把任务栏也遮住了,请教如何修改?
取得屏幕可利用区域
声明
Private Const SPI_GETWORKAREA = 48
Private Declare Function SystemParametersInfo& Lib "User32" Alias "SystemParametersInfoA" (ByVal uAction As Long,ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long)
Private Type RECT
Left As Long
As Long
Right As Long
Bottom As Long
End Type
取得屏幕可利用区域,然后放置窗体。
Dim ScreenWidth&, ScreenHeight&, ScreenLeft&, Screen&
Dim DesktopArea As RECT
Call SystemParametersInfo (SPI_GETWORKAREA, 0, DesktopArea, 0)
ScreenHeight = (DesktopArea.Bottom - DesktopArea.) * Screen.TwipsPerPixelY
ScreenWidth = (DesktopArea.Right - DesktopArea.Left) * Screen.TwipsPerPixelX
ScreenLeft = DesktopArea.Left * Screen.TwipsPerPixelX
Screen = DesktopArea. * Screen.TwipsPerPixelY
Me.Move ScreenLeft,Screen,ScreenWidth,ScreenHeight