RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Developing Windows Forms Applications on Mono

Developing cross-platform programs that rely on Windows Forms takes a big step forward with the latest release of the Mono platform.


ross-platform software development means different things to different people. For many programmers immersed in Microsoft languages such as VB.Net or C#, the real test comes down to creating a Windows Forms-based application in one of those languages, compiling it to MSIL, and running the resulting EXE file on the desired target platform, such as Linux or OS X. The Mono project is getting close to making that dream a reality.

The Mono project has tried at least three different approaches to implementing Windows Forms on Linux. The first implementation attempt tried to map Windows Forms to the Gtk toolkit. But that was an impedance mismatch. Trying to map equivalencies between two separate GUI toolkits didn't work well—and would have required an installation of Gtk+ on the target machine. The next attempt would have required the Wine Windows emulator. While that worked after a fashion, it was slow, buggy, and setting it up properly required many steps. This wasn't exactly the "copy a file over and run" scenario desired by most developers.

With Mono 1.1.4, the project has made the transition to a native implementation of System.Windows.Forms. Quoting from the Mono Web site:

"System.Windows.Forms in Mono is implemented using System.Drawing. All controls are natively drawn through System.Drawing. System.Windows.Forms implements its own driver interface to communicate with the host OS windowing system. Currently, we have a driver for Win32, for X11, and a driver for native Mac OS X support (no X11 required). The drivers translate the native window messages into WndProc compatible messages, to provide as much compatibility with native .Net as possible."
While the latest version (1.1.7) is getting closer to full parity with the .NET 1.1 framework's Windows Forms features, there are still some pretty big holes, such as incomplete or absent version of the DataGrid, RichTextBox, PrintPreview, and other controls. According to the Mono roadmap the project's goal is to be feature complete with the release of Mono version 1.2 in Q3 of 2005. Mono 1.2 will also include assemblies from Whidbey (Visual Studio 2005) as technology previews, adding full compatibility with the .NET 2.0 framework to later releases.

The primary Mono Web site has recently converted to a Wiki format using the MediaWiki engine. You'll find links to download the latest version of the Mono runtime and updates on the overall progress of the project. For specific information on Mono's Windows Forms implementation check out their site. There's also a site dedicated to Windows Forms development primarily from the Windows perspective; but many of the examples on that site run on Mono as well.

Author's Note: I used Mono version 1.1.7 running on Novell Linux Desktop to test the sample code developed for this article.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date