|
Hi,
Thank you for this article..
I need a solution for How to do MDI applications in Windows CE 5.0??
Do you any reference site for this
Thank you
sandesh daddi
sanshark.com
|
|
|
|
|
Why do you need MDI solution?
You can try to create tabcontrol with dynamic adding of tab pages and user controls in each tab page.
May be this solution can give you some new directions to your solution.
Oleg Levin
.NET Development Manager
|
|
|
|
|
Is it possible to set an image as form's background?
thanks
Ale
|
|
|
|
|
First Simple Option:
PictureBox Control with Dock State Fill in Form
Second Option:
Override OnPaint method of Form:
protected override void OnPaint(PaintEventArgs e)
{
Bitmap backgroundImage = Properties.Resources.MyBitMap;
e.Graphics.DrawImage(backgroundImage, this.ClientRectangle,
new Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height),
GraphicsUnit.Pixel);
}
Oleg Levin
.NET Development Manager
|
|
|
|
|
Hi
i follow your code,and implement the code i do a little bit change in the code part only
public static void StartFullScreen(Form form)
{
//Set Full Screen For Windows CE Device
//Normalize windows state
form.WindowState = FormWindowState.Normal;
IntPtr iptr = form.Handle;
SHFullScreen(iptr, (int)FullScreenFlags.HideStartIcon);
SHFullScreen(iptr, (int)FullScreenFlags.HideSipButton);
//detect taskbar height
int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height;
// move the viewing window north taskbar height to get rid of the command
//bar
MoveWindow(iptr, 0, -taskbarHeight, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height + taskbarHeight, 1);
// move the task bar south taskbar height so that its not visible anylonger
IntPtr iptrTB = FindWindowW("HHTaskBar", null);
MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height, Screen.PrimaryScreen.Bounds.Width, taskbarHeight, 1);
}
///
/// Stop Full Screen Mode
///
/// <param name="form" />
public static void StopFullScreen(Form form)
{
IntPtr iptr = form.Handle;
SHFullScreen(iptr, (int)FullScreenFlags.ShowStartIcon);
//detect taskbar height
int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height;
MoveWindow(iptr, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height - taskbarHeight, 1);
IntPtr iptrTB = FindWindowW("HHTaskBar", null);
MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height - taskbarHeight, Screen.PrimaryScreen.Bounds.Width, taskbarHeight, 1);
}
i want to make the application for pocket pc only,due to i do little bit change,i only want to hide the sip key icon and start icon in the form load in C# ,when we move to the next form the keyboard again show.Please help me regarding this problem.
give me suggestion .
Ram Krishna Pattnayak
Software Developer(SDS)
Sun-Dew Solutions Pvt.Ltd
www.sundewsolutions.com
kolkata
|
|
|
|
|
Hi.
Try to work with Activate and DeActivate events of the forms.
Oleg Levin
.NET Development Manager
|
|
|
|
|
it not work .i wan to hide the sip keyboard icon ,please refer any code c# then also that will be ok for me.
Ram Krishna Pattnayak
Software Developer(SDS)
Sun-Dew Solutions Pvt.Ltd
www.sundewsolutions.com
kolkata
|
|
|
|
|
Hi
This may be helpful:
Sip class wrapper:
using System;
using System.Runtime.InteropServices;
namespace Put.Your.Namespace.Here
{
/// <summary>
/// show the Standard SIP without the menu
/// with the "SetPosition" method you can set where to display the SIP
/// </summary>
public class Sip
{
class WinApi
{
[DllImport("coredll.dll")] public static extern int SipShowIM(SIPStatus i);
[DllImport("coredll.dll")] public static extern bool SipSetInfo(ref SIPINFO pSipInfo);
[DllImport("coredll.dll")] public static extern bool SipGetInfo(ref SIPINFO pSipInfo);
}
private static bool pvtVisible = false;
private enum SIPStatus
{
SIPF_OFF = 0,
SIPF_ON
}
private struct SIPINFO
{
public Int32 cbSize;
public Int32 fdwFlags;
public RECT rcVisibleDesktop;
public RECT rcSipRect;
public Int32 dwImDataSize;
public Int32 pvImData;
}
private struct RECT
{
public Int32 left;
public Int32 top;
public Int32 right;
public Int32 bottom;
}
private void Show ()
{
WinApi.SipShowIM(SIPStatus.SIPF_ON);
}
private void Hide ()
{
WinApi.SipShowIM(SIPStatus.SIPF_OFF);
}
public void SetPosition (Int32 top)
{
SIPINFO mySi = new SIPINFO();
bool result = true;
mySi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(SIPINFO));
result = WinApi.SipGetInfo(ref mySi);
mySi.rcSipRect.top = top;
mySi.rcSipRect.bottom = top + 80;
result = WinApi.SipSetInfo(ref mySi);
}
/// <summary>
/// Property setting shows or hides the SIP
/// </summary>
public static bool Visible
{
get
{
return pvtVisible;
}
set
{
if (value == true)
{
WinApi.SipShowIM(SIPStatus.SIPF_ON);
}
else
{
WinApi.SipShowIM(SIPStatus.SIPF_OFF);
}
pvtVisible = value;
}
}
}
}
Oleg Levin
.NET Development Manager
|
|
|
|
|
Hi,
Great article, thank you.
One question.
What if application will exited abnormally? I.e. it set FS mode and crashed. In this case only system reset can help to restore system windows?
Regards,
Oleg.
|
|
|
|
|
Hi
Setting the WindowStaus property to the form to maximized is enough without a need of P/Invoke
Regards
|
|
|
|
|
Hi
Thanks for sharing - I found I had to do a tweak to get it to work on Smartphone Mobile 5. The existing code left the taskbar visible at the top of the screen. To make the screen go fullscreen I changed:
IntPtr iptrTB = FindWindowW("HHTaskBar", null);
to
IntPtr iptrTB = FindWindowW("Tray", null);
and then it works great
and also removed the buttons since they're not supported controls on Smartphone
Thanks
Tim
|
|
|
|
|
Good article...
I have one ( maybe stupid) question on your source code, that why you use partial class for [PInvoke] and [PlatformDetection]? What's the purpose or advantage?
Thanks!
DG
|
|
|
|
|
Hi.
It is not important in this demo code.
i have some other extensions for my internal using and this is a reason for
some partials classes in this sample code.
Thank you.
Oleg Levin
.NET Developer/Group Leader
|
|
|
|
|
This may be a much easier way...
I don't know if this works on a Smartphone, but it definitely works on Windows Mobile 5.
Simply set the form's WindowState property to be FormWindowState.Maximized.
Works a treat!
Ronny
|
|
|
|
|
I found that the topic is very interesting, but after reading your article I do not have a clue how you did it. Did you use some kind of P/Invoke, or have you written a kind of wrapper-class for your functions? Probably they are from a third party vendor, if so, where did you get it? Is there more information available on this? How did you get to your solution? Are there any requirements to be able to implement your solution?
Don't get me wrong, i think your article is worth being on Codeproject - but til now there is not really more than pure downloadable source code.
|
|
|
|
|
I will update some information in this article.
This is article for advanced developers.
And i don't understand your problem.
You have source code and if you are not beginner in this area you can understand all.
Please explain me if you can.
Thank you.
-- modified at 3:39 Wednesday 13th June, 2007
-- modified at 4:19 Wednesday 13th June, 2007
Oleg Levin
.NET Developer
|
|
|
|
|
Hi Oleg,
thanks in advance for the coming update.
To answer your questions:
I do not have a problem; I only think that additional information will make your article more useful and understandable - even for advanced users
|
|
|
|
|
Always supposing you've got a 240x320 resolution display...
I understand it's pretty much the same for other different resolutions or the 24 pixels you play with, vary on other resolutions?
I personally use a little class to hide "TaskBar":
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
namespace PPC.Utilities<br />
{<br />
public sealed class TaskBar<br />
{<br />
private const int SW_HIDE = 0x0000;<br />
private const int SW_SHOW = 0x0001;<br />
<br />
private const string TASKBAR_PARAMETER = "HHTaskBar";<br />
<br />
public static void Hide()<br />
{<br />
int h = FindWindow(TASKBAR_PARAMETER, "");<br />
ShowWindow(h, SW_HIDE);<br />
}<br />
<br />
public static void Show()<br />
{<br />
int h = FindWindow(TASKBAR_PARAMETER, "");<br />
ShowWindow(h, SW_SHOW);<br />
}<br />
<br />
[DllImport("coredll.dll")]<br />
private static extern int FindWindow(string lpClassName, string lpWindowName);<br />
<br />
[DllImport("coredll.dll")]<br />
private static extern int ShowWindow(int hwnd, int nTaskShow);<br />
<br />
[DllImport("coredll.dll")]<br />
private static extern int MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);<br />
}<br />
}<br />
And appart from calling "Hide" method inside this class, in order to all forms appear maximized, there are some properties that must be set for each form of the application:
<br />
public static void SetFormToKioskMode(Form target)<br />
{<br />
target.Text = "";<br />
target.MaximizeBox = false;<br />
target.MinimizeBox = false;<br />
target.ControlBox = false;<br />
target.FormBorderStyle = FormBorderStyle.None;<br />
target.WindowState = FormWindowState.Maximized;<br />
}<br />
Nice trick! I'l try it out in my next project!
Regards.
MIGUEL
"Rezad a vuestros Dioses, amad a vuestras mujeres y luchad por vuestra patria!"
|
|
|
|
|
this sample was based on 240x320 resolution display.
Please try this if you want to know height of taskbar.
taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height
Soon I will update my article.
Thank you for reply.
Oleg Levin
|
|
|
|