Click here to Skip to main content
13,355,335 members (74,125 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


6 bookmarked
Posted 14 Oct 2012

Windows CE custom controls

, 5 Nov 2012
Rate this:
Please Sign up or sign in to vote.
Messagebox, mainmenu and contextmenu controls for Windows CE


I have developed a program (c#, .netcf) for some PNA devices shipped with Windows CE 6.0. The text on the mainmenu, contextmenu and messagebox controls were unreadable due to their font size. There is no way to change these control's font and some other major properties. So I decided to write my own classes to get full control over these controls. If you have the same problem feel free to use and/or modify the shared code.

Using the code

The usage of the controls are fairly straightforward. You can see some examples in the sample project.

Custom MessageBox class: Use it as the same way as .NET MessageBox. Custom messagebox has the same constructor with the same parameters as the normal messagebox. So you can use this in your exiting code without any change. The only thing you must to do is place the messagebox class to the same namespace with the code what which will use it. If you want to use it from more different namespaces, you will have to create a messagebox class for each namespaces and from their show() method you can call the custom messagbox class show() method, otherwise the codes exits in the other namespaces will use the system default messagebox class.

MessageBox.Show("This is a custom messagebox","ATTENTION",MessageBoxButtons.AbortRetryIgnore,MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);

The newly created messagebox will looks like this:

Context Menu class:
Simply create a new CustomContextMenu instance. You can attach the menu to any type of controls.

CustomContextMenu contextMenu = new CustomContextMenu(this.dataGrid,new Font("Arial",13,FontStyle.Bold));

contextMenu.AddContextMenu("Context menu 1",menu_Click);

contextMenu.AddContextMenu("Context menu 2",menu_Click);

Main Menu class:
Simply create a new CustomMainMenu instance. Add eventhandlers to the menu which has no submenu. Do not forget to create a main menu before you add a submenu to it. (see below)

CustomMainMenu mainMenu = new CustomMainMenu(this,new Font("Arial",13,FontStyle.Bold));






Happy coding!

Points of Interest

C#, MSSQL, Mobile devices




This article, along with any associated source code and files, is licensed under A Public Domain dedication


About the Author

Software Developer
Hungary Hungary
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 5 Nov 2012
Article Copyright 2012 by DeveloperEU
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid