Hi friend here i am giving you complete demonstration of canvas in wpf application. We can draw all shapes on canvas as you can see here. We can use canvas as one of panel type also.
Mainwindow
Mainwindow
<Window x:Class="canvas.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Canvas>
<Rectangle Canvas.Left="50" Canvas.Top="50" Fill="Green" Height="50" Width="50"/>
<Rectangle Canvas.Right="50" Canvas.Top="50" Fill="Red" Height="50" Width="50"/>
<Ellipse Height="50" Width="50" Fill="Yellow" Canvas.Left="225" Canvas.Top="150"/>
<Rectangle Canvas.Left="50" Canvas.Bottom="50" Fill="Green" Height="50" Width="50"/>
<Rectangle Canvas.Right="50" Canvas.Bottom="50" Fill="Red" Height="50" Width="50"/>
</Canvas>
</Window>
After implementing this code snippets output look like below.
0 comments:
Post a Comment