Introduction
In this article you'll see how to make a paint application in a Windows Forms application. With this article, you can learn how to create a paint application that enables you to draw pictures.
ColorDialog Object
The ColorDialog class represents a dialog box that displays available colors along with controls that enable the user to define custom colors. See the figure given below.
System.Windows.Forms.ColorDialog

ColorBlend Object
Defines arrays of colors and positions used for interpolating color blending in a multicolor gradient. This class cannot be inherited.
System.Drawing.Drawing2D.ColorBlend
CreateGraphics( ) Method
Using the CreateGraphics method, you can draw lines and shapes, render text, or display and manipulate images with GDI+. You need to create a Graphics object. The Graphics object represents a GDI+ drawing surface, and is the object that is used to create graphical images.
System.Windows.Forms
- Create a Graphics Object
- Use the Graphics object to draw lines and shapes, render text, or display and manipulate images
SmoothingMode Property
The smoothingMode Property specifies whether lines, curves, and the edges of filled areas use smoothing (also called antialiasing).
System.Drawing
Now let's use the following procedure.
Step 1:
Open Visual Studio then click on "Create New Project" then select "F# Console Application".

Step 2:
Now go the Solution Explorer on the right side of the application. Right-click on the "References" then select "Add references".


Step 3:
After selecting "Add References", in the framework template you need to select "System.Windows.Forms" and "System.Drawing" while holding down the Ctrl key and Click on "Ok."

Step 4:
Write the following code in the F# application:
// Learn more about F# at http://fsharp.net
//specifies the memory location of the class files
//that will be needed in our application
open System.Collections.Generic
open System
open System.Windows.Forms
open System.ComponentModel
open System.Drawing
open System.Drawing.Drawing2D
let drawingform = new Form(Text="Paint Application",AutoScaleDimensions=new System.Drawing.SizeF(60.0F, 13.0F),ClientSize=new System.Drawing.Size(400, 350),StartPosition=FormStartPosition.CenterScreen)
//creates our control
let exitbutton=new Button(Text="Exit", Location=new System.Drawing.Point(200, 200))
let erasebutton=new Button(Text="Erase", Location=new System.Drawing.Point(120, 200))





Sa KuraPosted Apr 15, 2014, 12:25 PM
and how to save the image and open it?
Sa KuraPosted Apr 15, 2014, 12:22 PM
hello you! Your example is very interesting. ask yourself how to draw rectangles, circles, ellipses? ? please help me! Thank you very much!