Windows Forms

Windows Forms ist ein GUI-Toolkit im .Net-Framework und im .NET. Es ermöglicht die Erstellung grafischer Benutzeroberflächen (GUIs) für Windows. Dies geschieht im Wesentlichen durch das Wrappen der existierenden Windows API in Managed Code.

Im Rahmen des Mono-Projekts steht Windows Forms weitgehend auch unter Linux und macOS (Carbon; bis 10.14) zur Verfügung. Diese Portierung wird nicht weiter entwickelt.

Vergleich zu anderen Programmierschnittstellen

Im Vergleich zu Microsoft Foundation Classes (MFC), die auf der Programmiersprache C++ basiert, ist der Einstieg in die Programmierung mit Windows Forms einfacher. Das Framework basiert nicht auf dem Paradigma Model View Controller (MVC).

Mit .NET Framework 3.0 wurde von Microsoft eine Alternative zu Windows Forms bereitgestellt, die Windows Presentation Foundation, welche eine stärkere Trennung der grafischen Oberfläche vom Programmcode und – unter Zuhilfenahme von XAML, einer XML-basierenden Sprache – ein dynamischeres Layout ermöglicht.

Hallo Welt-Beispiel

Nachfolgend ein einfaches C#-Programm, das Windows Forms benutzt.

using System;
using System.Windows.Forms;

public class HalloWelt
{
   [STAThread]
   public static void Main()
   {
      var form = new Form();
      var button = new Button();
      button.Text = "Hello World!";
      form.Controls.Add(button);
      form.Show();
      Application.Run(form);
   }
}

Literatur

  • Dirk Louis: Windows Forms mit Visual C++. Einstieg und professioneller Einsatz, entwickler.press 2008, ISBN 978-3935042888
  • Brian Noyes: Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET, Addison-Wesley 2006, ISBN 978-0321268921
  • Charles Petzold: Windows Forms-Programmierung mit Visual C# 2005, Microsoft Press 2006, ISBN 978-3860639856

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.