Short Courses on Computer Graphics, Image Processing and Computer Vision

Let me know what you think Mail me...

Course 2DCis: 2D-Computer Graphics with C#/.NET

Copyright © by V. Miszalok, last update: 03-03-2008

  Visitors since 01-01-2002
deutsch english
Einführung
Was sind Windows Forms ?
C1: Intro, erste Graphikbefehle
C2: Draw, ein Malprogramm
C3: XML, speichern und lesen von Polygonen in drei Formaten
C4: Anim, eine Animation
C5: Controls, GUI-Programmierung
Introduction
What are Windows Forms ?
C1: Intro, some simple graphic commands
C2: Draw, a scribble program
C3: XML, store and read polygons in three different formats
C4: Anim, an endless animation
C5: Controls, GUI Programming

Was sind Windows Forms ?

WF ist eine Sammlung von .NET Klassenbibliotheken zum Erstellen von Windows-Programmen mit graphischer Benutzeroberfläche.
Siehe: Erstellen von Windows-basierten Anwendungen
Siehe: Windows-Forms-Programmierung
Siehe: Übersicht über Grafiken

What are Windows Forms ?

WF is a collection of .NET class libraries to create Windows-programs with a graphical user interface.
See: Creating Windows-Based Applications
See: Windows Forms Programming
See: Graphics Overview

C1: Intro, erste Graphikbefehle

Schreiben Sie ein erstes zweckloses Graphikprogramm. Es enthält den Hello-World-Text, es erfragt die dehnbare Fenstergröße, schreibt zwei Linien, ein Rechteck, eine Ellipse. Es zieht sternförmig dicke Linien mit Zufallsfarben und speichert die Endpunkte in einem Polygonarray, das am Ende zackenförmig rot gezeichnet wird.
Spielen Sie mit dem Programm, indem Sie das Fenster mit der Maus zoomen.
Eine Bauanleitung in VisualBasic.NET ist beigefügt, damit Sie vergleichen können, wie wenig sich die Codes der .NET-Sprachen unterscheiden.

C1: Intro, some simple graphic commands

Write Your first useless C#-program that demonstrates some simple graphic commands. It demonstrates a Hello-World-text, it evaluates the variable window size, draws two lines, a rectangle and an ellipse. It draws thick radial lines using random colors. Finally it stores the end points of the lines in form of a polygon array which forms a final red splash. It redraws everything in a different way from scratch when you change the window size by dragging one of its borders.

EXE 8kB Demo.exe → Download it and start it from Your local disk
Link C# Bauanleitung Link C# Guidance
PDF C# Bauanleitung Druckversion PDF C# Guidance Print Version
Link C# Complete Code
PDF C# Complete Code Print Version
Link C# Code Comments
PDF C# Code Comments Print Version
Link VBasic Bauanleitung
PDF VBasic Bauanleitung Druckversion

C2: Draw, ein Malprogramm

Das Programm besteht aus 6 aufeinander aufbauenden Versionen V1 - V6.
V1: Zeichne die Mausbewegungen ohne sie zu speichern
V2: Anzeige der laufenden Mauskoordinaten
V3: Markieren der Vertices als Kästchen
V4: Minimalabstand zwischen Vertices verlangen
V5: Vertex Array
V6: Umfang, Fläche, Schwerpunkt, umschreibendes Rechteck

C2: Draw, a scribble program

This is a scribble program in 5 increasingly complex versions V1 - V6.
V1: Draw the raw mouse mouvements and forget them
V2: Display the current mouse coordinates
V3: Mark the vertices as small rectangles
V4: Ask for a minimal distance between adjacent vertices
V5: Vertex array
V6: Perimeter, area, center of gravity, surrounding rectangle

EXE 9kB Demo.exe → Download it and start it from Your local disk
Link C# Bauanleitung Link C# Guidance
PDF C# Bauanleitung Druckversion PDF C# Guidance Print Version
Link C# Complete Code
PDF C# Complete Code Print Version
Link C# Code Comments
PDF C# Code Comments Print Version

C3: XML, speichern und lesen von Polygonen in drei Formaten

Die von der Mausbewegung erzeugten Vertices werden zunächst in einem dynamischen Array gesammelt. Das gesamte Polygon kann anschließend dauerhaft unter beliebigem Namen auf die Platte gespeichert und von dort gelesen werden. Sie werden das Polygon im Textformat und in den beiden XML-Formaten Vector Markup Language VML und Scalable Vector Graphics SVG speichern, die Ihr Browser lesen und interpretieren kann.
Aktuelles Firefox und Opera haben natives SVG, aber kein VML.
Internet Explorer hat natives VML, braucht aber für SVG ein Plugin: www.adobe.com/svg/viewer.

C3: XML, store and read polygons in three different formats

At first, the vertices generated by the mouse movements are collected in a dynamic array. The complete polygon can be stored to and reloaded from the hard disk under an arbitrary file name. You will store it in text format and in the XML-formats Vector Markup Language VML and Scalable Vector Graphics SVG that your browser can read and interpret.
New Firefox and Opera offer native SVG but no VML.
Internet Explorer offers native VML but needs a plugin for SVG: www.adobe.com/svg/viewer.

EXE 20kB Demo.exe → Download it and start it from Your local disk
Link C# Bauanleitung Link C# Guidance
PDF C# Bauanleitung Druckversion PDF C# Guidance Print Version
Link C# Complete Code
PDF C# Complete Code Print Version
Link C# Code Comments
PDF C# Code Comments Print Version

C4: Anim, eine Animation

Malprogramm mit Daueranimation. Das offene Polygon dreht und schrumpft um seinen Schwerpunkt und fängt dann an, rhytmisch zu pumpen in Schrittweiten von 1 Grad und 5% Zoom. Geschwindigkeit und Umkehrpunkte sind im Code frei regelbar.

C4: Anim, an endless animation

Scribble program followed by an endless animation.
The open polygone rotates and shrinks around its center of gravitiy and starts to breath in steps of 1 degree and a zoom of 5%. The animation velocity and the reversal points are programmable.

EXE 9kB Demo.exe → Download it and start it from Your local disk
Link C# Bauanleitung Link C# Guidance
PDF C# Bauanleitung Druckversion PDF C# Guidance Print Version
Link C# Complete Code
PDF C# Complete Code Print Version
Link C# Code Comments
PDF C# Code Comments Print Version

C5: Controls, GUI-Programmierung

Animation mit Graphical User Interface: Buttons, TrackBars, Labels, CheckBoxes und RadioButtons. Programmierung von erweiterbaren Control-Arrays, die sich automatisch an die Fenstergröße anpassen.

C5: Controls, GUI Programming

Animation program with a Graphical User Interface: Buttons, TrackBars, Labels, CheckBoxes and RadioButtons. Programming of expandable Control arrays, which fit at run time to any window size.

EXE 20kB Demo.exe → Download it and start it from Your local disk
Link C# Bauanleitung Link C# Guidance
PDF C# Bauanleitung Druckversion PDF C# Guidance Print Version
Link C# Complete Code
PDF C# Complete Code Print Version
Link C# Code Comments
PDF C# Code Comments Print Version
top of page: