Friday, November 2, 2012

WPF-Shape Drawing(Indian Flag)-Part One

A Shape is a type of UIElement that provides the functionalities to draw a shape to the screen and since it is UIElement, Shape objects can be used inside Panel elements and most controls.

WPF provides a number of predefined Shape objects that are inherited from the Shape class.
The Shape objects provided by Shape class are Line, Path, Rectangle, Polygon, Polyline and Ellipse. All Shape objects share some common properties such as Stroke, StrokeThickness and Fill.
Canvas panel is used to panel. So we will be considering it most of the time.
Drawing the Indian Flag
Steps to be followed.
1.Start Visual Studio and follow the same path as mentioned in article http://www.codingnodes.com/2012/11/window-presentation-foundation.html
2.Drag a control Canvas to MainWidow.xaml page and give dimensions (300,300).
3.Place the code selected in the below screenshot in between Canvas tag.

.
4.Run the application by pressing F5 and ouput is as in below screenshot.



No comments:

Copyright © Codingnodes,2014.All Rights Reserved.