Blog

How to draw pie shape in F# window application

Aug 02, 2011 Blogs | F#
This blog is a demonstration regarding how you can draw a pie shape in F# using FillPie method.

This Blog is showing that how can you draw Pie shape in F# windows form application with some lines of code using FillPie method.

where Brush is an object that determine color used to fill the pie shape.

 Example

open System.Drawing
open System.Windows.Forms
let form =
// create a new form setting the minimum size
    let temp = new Form(MinimumSize = new Size(80, 80))
// repaint the form when it is resize
    temp.Resize.Add (fun _ -> temp.Invalidate())
// a brush to provide the shapes color
    let brush = new SolidBrush(Color.SkyBlue)
    temp.Paint.Add (fun e
->
// calculate the width and height of the shape
        let width, height = temp.Width - 54, temp.Height - 54
// draw the required shape
        e.Graphics.FillPie (brush, 32, 32, width, height, 0, 290))
// return the form to the top level
    temp
Application.Run(form)

Output

Pieshape Output

Shalini Juneja

Shalini juneja is working as a Software Trainnee .she has completed her Master degree in Computer application.she prefers to work in database and asp.net platform.

  • 96rank
  • 551K readers
COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs