HighTechTalks DotNet Forums  

Fullscreen ?

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss Fullscreen ? in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Engin AYDOGAN
 
Posts: n/a

Default Fullscreen ? - 11-29-2006 , 03:03 AM






I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?

Reply With Quote
  #2  
Old   
Buthrakaur
 
Posts: n/a

Default Re: Fullscreen ? - 11-29-2006 , 03:54 AM






Hi, it's possible to create a fullscreen app using SHFullScreen
function from aygshell.dll. Take a look on following code snippet:



public static bool SetTaskBarEnabled(bool enabled)
{
IntPtr hwnd = Win32Window.FindWindow("HHTaskBar", null);
return Win32Window.EnableWindow(hwnd, enabled);
}

[DllImport("aygshell.dll", EntryPoint="SHFullScreen",
SetLastError=true)]
private static extern bool SHFullScreen(IntPtr apphwnd, int state);


const int SHFS_SHOWTASKBAR = 0x1;
const int SHFS_HIDETASKBAR = 0x2;
const int SHFS_SHOWSIPBUTTON = 0x4;
const int SHFS_HIDESIPBUTTON = 0x8;
const int SHFS_SHOWSTARTICON = 0x10;
const int SHFS_HIDESTARTICON = 0x20;
const int SWP_NOZORDER = 0x4;
private const int HHTASKBARHEIGHT = 26;
/* private const int SHFS_HIDETASKBAR = &H2;
private const int SWP_NOZORDER = &H4;*/

public static bool HideTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_HIDETASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
0, width, height + HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}

public static bool SetStartButtonVisible(bool visible, IntPtr hwnd)
{
if (hwnd.ToInt32() > 0)
{
return SHFullScreen(hwnd, visible ? SHFS_SHOWSTARTICON :
SHFS_HIDESTARTICON);
}
else
{
return false;
}
}

public static bool ShowTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_SHOWTASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
HHTASKBARHEIGHT, width, height - HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}



Engin AYDOGAN napsal:
Quote:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?


Reply With Quote
  #3  
Old   
Engin AYDOGAN
 
Posts: n/a

Default Re: Fullscreen ? - 11-29-2006 , 04:18 AM



Thanks but that seems totally platform dependent. And I believe there
should be a neat and simple way of doing this.

Buthrakaur wrote:
Quote:
Hi, it's possible to create a fullscreen app using SHFullScreen
function from aygshell.dll. Take a look on following code snippet:



public static bool SetTaskBarEnabled(bool enabled)
{
IntPtr hwnd = Win32Window.FindWindow("HHTaskBar", null);
return Win32Window.EnableWindow(hwnd, enabled);
}

[DllImport("aygshell.dll", EntryPoint="SHFullScreen",
SetLastError=true)]
private static extern bool SHFullScreen(IntPtr apphwnd, int state);


const int SHFS_SHOWTASKBAR = 0x1;
const int SHFS_HIDETASKBAR = 0x2;
const int SHFS_SHOWSIPBUTTON = 0x4;
const int SHFS_HIDESIPBUTTON = 0x8;
const int SHFS_SHOWSTARTICON = 0x10;
const int SHFS_HIDESTARTICON = 0x20;
const int SWP_NOZORDER = 0x4;
private const int HHTASKBARHEIGHT = 26;
/* private const int SHFS_HIDETASKBAR = &H2;
private const int SWP_NOZORDER = &H4;*/

public static bool HideTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_HIDETASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
0, width, height + HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}

public static bool SetStartButtonVisible(bool visible, IntPtr hwnd)
{
if (hwnd.ToInt32() > 0)
{
return SHFullScreen(hwnd, visible ? SHFS_SHOWSTARTICON :
SHFS_HIDESTARTICON);
}
else
{
return false;
}
}

public static bool ShowTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_SHOWTASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
HHTASKBARHEIGHT, width, height - HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}



Engin AYDOGAN napsal:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?


Reply With Quote
  #4  
Old   
Tore Stensby
 
Posts: n/a

Default Re: Fullscreen ? - 11-29-2006 , 05:40 AM



"Engin AYDOGAN" wrote:
Quote:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;' in
the (only) Form of the program, but it doesn't work. I still can see the
taskbar and title bar. I've tried placing above statment to few places
(i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?
In my app, I use this on one of my forms:
Private Sub frmSkjermLock_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.WindowState = FormWindowState.Maximized
End Sub

And i have set the property FormBorderStyle to None in the designer.



ToreS






Reply With Quote
  #5  
Old   
Engin AYDOGAN
 
Posts: n/a

Default Re: Fullscreen ? - 11-29-2006 , 06:37 AM



Tore Stensby wrote:

Quote:
In my app, I use this on one of my forms:
Private Sub frmSkjermLock_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.WindowState = FormWindowState.Maximized
End Sub

And i have set the property FormBorderStyle to None in the designer.

I'm doing the same. But when I deploy (into Win CE 5.0) and start my
application, it starts like a usual app with title bar and taskbar is
visible.

I create the form and pass it to the event loop.

Application.Run(new Form1());

And

private void Form1_Load(object sender, EventArgs e)
{
System.Console.Write( "load\n" );
MinimizeBox = false;
MaximizeBox = false;
////////////////////////////////////////
WindowState = FormWindowState.Maximized;
}

It still runs like a normal app.


Reply With Quote
  #6  
Old   
Buthrakaur
 
Posts: n/a

Default Re: Fullscreen ? - 11-29-2006 , 10:08 AM



I see, I silently presumed you're talking about PPC platform, but
you're targetting WinCE if I understand it right. My previous snippet
is designed for PPC. If I remember right, I had to P/Invoke
SetWindowPos to fill the whole screen with my window on WinCE device.

Rectangle scrrect = Screen.PrimaryScreen.Bounds;
Win32Window.SetWindowPos(win, HWND.TOPMOST, 0, 0, scrrect.Width,
scrrect.Height, SWP.NOZORDER);



Engin AYDOGAN napsal:
Quote:
Thanks but that seems totally platform dependent. And I believe there
should be a neat and simple way of doing this.

Buthrakaur wrote:
Hi, it's possible to create a fullscreen app using SHFullScreen
function from aygshell.dll. Take a look on following code snippet:



public static bool SetTaskBarEnabled(bool enabled)
{
IntPtr hwnd = Win32Window.FindWindow("HHTaskBar", null);
return Win32Window.EnableWindow(hwnd, enabled);
}

[DllImport("aygshell.dll", EntryPoint="SHFullScreen",
SetLastError=true)]
private static extern bool SHFullScreen(IntPtr apphwnd, int state);


const int SHFS_SHOWTASKBAR = 0x1;
const int SHFS_HIDETASKBAR = 0x2;
const int SHFS_SHOWSIPBUTTON = 0x4;
const int SHFS_HIDESIPBUTTON = 0x8;
const int SHFS_SHOWSTARTICON = 0x10;
const int SHFS_HIDESTARTICON = 0x20;
const int SWP_NOZORDER = 0x4;
private const int HHTASKBARHEIGHT = 26;
/* private const int SHFS_HIDETASKBAR = &H2;
private const int SWP_NOZORDER = &H4;*/

public static bool HideTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_HIDETASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
0, width, height + HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}

public static bool SetStartButtonVisible(bool visible, IntPtr hwnd)
{
if (hwnd.ToInt32() > 0)
{
return SHFullScreen(hwnd, visible ? SHFS_SHOWSTARTICON :
SHFS_HIDESTARTICON);
}
else
{
return false;
}
}

public static bool ShowTaskBarForWindow(IntPtr hwnd)
{
Rectangle rect = Win32Window.GetWindowRect(hwnd);
int width = rect.Right - rect.Left;
int height = rect.Bottom - rect.Top;
SHFullScreen(hwnd, SHFS_SHOWTASKBAR);
Win32Window.SetWindowPos(hwnd, OpenNETCF.Win32.HWND.TOPMOST, 0,
HHTASKBARHEIGHT, width, height - HHTASKBARHEIGHT, SWP.NOZORDER);
return true;
}



Engin AYDOGAN napsal:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?



Reply With Quote
  #7  
Old   
vikash
 
Posts: n/a

Default Re: Fullscreen ? - 11-30-2006 , 12:42 AM



please remove any instance of MainMenu from the designer, hope it will
work.


thanks n regards
vikash


Engin AYDOGAN wrote:
Quote:
I want to make my application to use the whole screen, searched through
msdn and it suggests to use `WindowState = FormWindowState.Maximized;'
in the (only) Form of the program, but it doesn't work. I still can see
the taskbar and title bar. I've tried placing above statment to few
places (i.e. in c-tor/onLoad of the form, etc), still no go.

Any ideas ?


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.