Graphic in WPF with VB.NET

In this article, We will see how to use graphic function in WPF Application.
  • 2530

In this article, We will see how to use graphic function in WPF Application.

The WPF means Windows Presentation Foundation in .net. This example is very easy and explain the 2D in Graphic. We will show a line and rectangle. We will use 'Panel.Children' in this application.

Example:-

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Canvas Background="#FFFFFFFF">
            <Panel.Children>
                <Rectangle Fill="#FF0000FF" Height="70" Canvas.Left="75"
      Stroke="#FF000000" Canvas.Top="90" Width="130" />
                <Rectangle Fill="#FF0000FF" Height="70" Canvas.Left="100"
      Stroke="#FF000000" Canvas.Top="65" Width="130" />
                <Rectangle Fill="#FF0000FF" Height="70" Canvas.Left="125"
      Stroke="#FF000000" Canvas.Top="40" Width="131" />
                <Line Canvas.Left="0" Stroke="Red" StrokeThickness="10" Canvas.Top="0"
      X1="300" X2="100" Y1="50" Y2="225" />
            </Panel.Children>
        </Canvas>
    </Grid>
</
Window>

Output:-

simple1.bmp

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.