How to creating of messagebox

Doing as teixeira suggests will allow a dialog, but being on the Pocket PC it will be full screen. This might suit your purposes but I suspect you wanted a floating dialog like the actual MessageBox. As for how todo this or if it's infact possible I'm not entirely sure.
 
To the best of my knowledge there is no managed code solution. As far as I know the only way to achieve a floating dialog is through various API calls to methods such as MoveWindow(). A search on google for something like "floating dialog" "compact framework", should help you find an example.
 
Alternatively you could inherit from the panel class and dynamically create ontop of your current form - not strictly a dialog, but you'd be able to do pretty much anything with it...


Paul.
 
This is true and is a method I have employed in the past. The trickiest aspect of doing it this way is making the Panel modal so that the form behind it cannot be clicked untill the dialog is closed. In my case this wasn't too tricky as the entire page worked on GDI and clickable regions, rather than using standard System.Windows.Forms controls. Because of this I could solve this problem by temporarily unhooking the click events of the form. If somebody has a solution for achieving a truly modal panel, I'd certainly be interested to hear their ideas.
 
One possibility would be to put down two panels - the first having being made transparent. The second, being the dialog, obviously contains the message. I've never tried it, though.......
 
It's a nice idea but not actually workable since you cannot have a truly transparent panel. Setting the background colour to Transparent simply makes it's background colour the same as that of it's parent. A cheeky way of doing it might be to take a screenshot of the applications state before creating the dialog. Adding this to a picturebox infront of all other controls, then putting the dialog infront of it. But to the best of my knowledge there is no managed way todo this and as such you'd be better off just looking into using MoveWindow to resize the form. This would remove the modal problem as the Form class has a ShowDialog() method that essentially does it for you.
 
Back
Top