Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between GTK# and Windows Forms?

What is the difference between GTK# and windows forms? Are they totally different?

Thanks

like image 338
Josh Avatar asked Apr 28 '09 08:04

Josh


2 Answers

They are both GUI toolkits, each having their strength and weaknesses. From my experience:

  • Winforms does not require installation on windows, Gtk# does require installation on Windows.
  • Winforms has a designer in Visual Studio, Gtk# has standalone designer and integrated designed in MonoDevelop.
  • Winforms is bound to Windows, Gtk# is cross-platform.
  • Winforms is slow and flickers. Gtk is faster.
  • Most Winforms controls are wrappers around standard windows controls and offer very limited functionality. Gtk widgets are more feature-rich.
  • Gtk allows creating forms and widgets with complex layout. Winforms offers only trivial variants of layout, and FlowLayout & TableLayout & AutoSize are too weak to be able to have complex forms that resize and automatically accomodate to different font sizes, different resolutions.
  • Cairo is faster and has more features than Gdi+ (Cairo supports output and input from more types of files, e.g., svg, pdf)
  • Gtk# is open-source, winforms is not
  • Winforms and Gtk# have 3rd-party controls/widgets (however, with Gtk# there is less need for them because basic controls work really good).

In short, I would not recommend using Winforms (except when there is a strong reason not to have more dependencies than .NET FW), but using Gtk# or WPF.

like image 122
dmitry_vk Avatar answered Nov 09 '22 04:11

dmitry_vk


Gtk#:

GTK# is a .NET binding for the Gtk+ toolkit. The toolkit is written in C for speed and compatibility, while the GTK# binding provides an easy to use, object oriented API for managed use. It is in active development by the Mono project, and there are various real-world applications available that use it (Banshee , F-Spot, Beagle, MonoDevelop).

In general, GTK# applications are written using MonoDevelop, which provides a visual designer for creating GTK# GUIs.

Platforms: Unix, Windows, OSX

Pros:

  • Good support for accessibility through its Gtk+ heritage.
  • Layout engine ideal for handling internationalized environments, and adapts to font-size without breaking applications.
  • Applications integrate with the Gnome Desktop.
  • API is familiar to Gtk+ developers.
  • Large Gtk+ community.
  • A Win32 port is available, with native look on Windows XP.
  • The API is fairly stable at this point, and syntactic sugar is being added to improve it.
  • Unicode support is exceptional.

Cons:

  • Gtk+ apps run like foreign applications on MacOS X.
  • Incomplete documentation.

Windows.Forms:

Windows.Forms is a binding developed by Microsoft to the Win32 toolkit. As a popular toolkit used by millions of Windows developers (especially for internal enterprise applications), the Mono project decided to produce a compatible implementation (Winforms) to allow these developers to easily port their applications to run on Linux and other Mono platforms.

Whereas the .Net implementation is a binding to the Win32 toolkit, the Mono implementation is written in C# to allow it to work on multiple platforms. Most of the Windows.Forms API will work on Mono, however some applications (and especially third party controls) occasionally bypass the API and P/Invoke straight to the Win32 API. These calls will likely have to changed to work on Mono.

In general, Winforms applications are written using Microsoft's Visual Studio or SharpDevelop, which both provide a visual designer for creating Winforms GUIs.

Platforms: Windows, Unix, OSX

Pros:

  • Extensive documentation exists for it (books, tutorials, online documents).
  • Large community of active developers.
  • Easiest route to port an existing Windows.Forms application.

Cons:

  • Internationalization can be tricky with fixed layouts.
  • Looks alien on non-Windows platforms.
  • Code that calls the Win32 API is not portable.

Source: Picking the Right Toolkit

like image 30
CSharper Avatar answered Nov 09 '22 05:11

CSharper