如何在VB6中打开图像并使其全屏显示

时间:2015-11-19 12:28:34

标签: vb6

我一直在尝试使用2个图片框在VB6中打开图像,并将宽度和高度缩放到屏幕大小。

有没有办法以不会在底部显示窗口的Start命令和顶部窗口名称的方式打开图像?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以让表单以最大化模式运行。并将表单边框样式设置为none以隐藏标题栏。

对于隐藏/覆盖Windows的任务栏,您可以参考This Post from VBForums

所用代码的预览如下:

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 Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Const HWND_TOP = 0
Private Const SWP_SHOWWINDOW = &H40

Private Sub Form_Load()
'This code will maximize the window covering the task bar
   Dim ll_Width As Long
   Dim ll_Height As Long

If Me.WindowState = vbMaximized Then
    WindowState = vbNormal
End If

'work out full screen dimensions
ll_Width = GetSystemMetrics(SM_CXSCREEN)
ll_Height = GetSystemMetrics(SM_CYSCREEN)

'use SetWindowPos to resize window
Call SetWindowPos(Me.hwnd, HWND_TOP, 0, 0, ll_Width, _
    ll_Height, SWP_SHOWWINDOW)
End Sub