Crew algemeen |
|
Dit is wss wat je zoekt (paste code in je form):
Public Class Form1
Private Const SM_CXSCREEN As Integer = 0
Private Const SM_CYSCREEN As Integer = 1
Private Shared HWND_TOP As IntPtr = IntPtr.Zero
Private Const SWP_SHOWWINDOW As Integer = 64
Private Declare Function SetWindowPos Lib "user32.dll" Alias "SetWindowPos" (ByVal hWnd As IntPtr, ByVal hWndIntertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean
Private Declare Function GetSystemMetrics Lib "user32.dll" Alias "GetSystemMetrics" (ByVal Which As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FullScreen()
End Sub
Public ReadOnly Property ScreenX() As Integer
Get
Return GetSystemMetrics(SM_CXSCREEN)
End Get
End Property
Public ReadOnly Property ScreenY() As Integer
Get
Return GetSystemMetrics(SM_CYSCREEN)
End Get
End Property
Private Sub FullScreen()
Me.WindowState = FormWindowState.Maximized
Me.FormBorderStyle = FormBorderStyle.None
Me.TopMost = True
SetWindowPos(Me.Handle, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW)
End Sub
Public Sub NormalMode()
Me.WindowState = FormWindowState.Normal
Me.FormBorderStyle = FormBorderStyle.SizableToolWindow
Me.TopMost = False
End Sub
End Class
Public Class Form1 Private Const SM_CXSCREEN As Integer = 0 Private Const SM_CYSCREEN As Integer = 1 Private Shared HWND_TOP As IntPtr = IntPtr.Zero Private Const SWP_SHOWWINDOW As Integer = 64 Private Declare Function SetWindowPos Lib "user32.dll" Alias "SetWindowPos" (ByVal hWnd As IntPtr, ByVal hWndIntertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean Private Declare Function GetSystemMetrics Lib "user32.dll" Alias "GetSystemMetrics" (ByVal Which As Integer) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FullScreen() End Sub Public ReadOnly Property ScreenX() As Integer Get Return GetSystemMetrics(SM_CXSCREEN) End Get End Property Public ReadOnly Property ScreenY() As Integer Get Return GetSystemMetrics(SM_CYSCREEN) End Get End Property Private Sub FullScreen() Me.WindowState = FormWindowState.Maximized Me.FormBorderStyle = FormBorderStyle.None Me.TopMost = True SetWindowPos(Me.Handle, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW) End Sub Public Sub NormalMode() Me.WindowState = FormWindowState.Normal Me.FormBorderStyle = FormBorderStyle.SizableToolWindow Me.TopMost = False End Sub End Class
PS : Tommy, het equivalent in vb.net is
WindowState = FormWindowState.Maximized
WindowState = FormWindowState.Maximized
Maar dat zie je nog altijd je taak en titelbalk
mvg,
RedThread
|