Herez the code to test whether your app is running in full screen mode or not.
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
public bool IsFullScreen()
{
bool runningFullScreen = false;
RECT appBounds;
Rectangle screenBounds;
IntPtr hWnd;
hWnd = GetForegroundWindow();
if (hWnd!=null && !hWnd.Equals(IntPtr.Zero))
{
if (!(hWnd.Equals(desktopHandle) || hWnd.Equals(shellHandle)))
{
GetWindowRect(hWnd, out appBounds);
screenBounds = Screen.FromHandle(hWnd).Bounds;
if ((appBounds.Bottom - appBounds.Top) == screenBounds.Height && (appBounds.Right - appBounds.Left) == screenBounds.Width)
{
runningFullScreen = true;
}
}
}
return runningFullScreen;
}
Later, app can be set to normal mode from full screen, by reducing few screen co-ordinates values as:
public void SetNormal()
{
IntPtr hWnd;
Rectangle screenBounds;
hWnd = GetForegroundWindow();
screenBounds = Screen.FromHandle(hWnd).Bounds;
screenBounds.Height -= 50;
screenBounds.Width -= 250;
}