How to draw a shape that resizes with the form WPF?

Paulo Balbino

I'm new to WPF and would like to know what to use to get a shape like the image below: enter image description here

I also wonder if it is possible that this design may follow the form's dimensions, ie, if the form is resized, the design is too.

In advance, thank you!

Windows 8.1, Visual Studio 2013, C#, WPF Application

Casper Taylor Korshøj

To draw the shape you can use a Path. A path can draw any type of shape specified by its Data property. The Fill and Stroke defines the colors of the shape.

To "follow the form's dimensions" you can set the Stretch property to "Uniform". The shape will then scale accordingly to the window.

Here is an example:

<Window x:Class="WpfApplication57.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="600" Width="800">
    <Grid>
      <Path Data="F1 M 0 0 800 0 800 30 200 30 150 60 0 60 0 0" 
            Fill="Yellow" 
            Stretch="Uniform" 
            Stroke="Black"
            StrokeThickness="4"
            VerticalAlignment="Top" />
   </Grid>
</Window>

Happy coding :-)

Best regards, Casper Korshøj

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to draw a shape that resizes with the form WPF?

From Dev

Draw Shape in Windows Form Application

From Dev

How to draw a responsive shape

From Dev

How to autoresize a parent form when a child form resizes in code?

From Dev

How to draw a diamond shape in java?

From Dev

How to Draw a triangle shape in python?

From Dev

How to draw trapezoid shape in iOS?

From Dev

How to draw a line wpf

From Dev

How to calculate the orientation of a shape in wpf

From Dev

How to increase thickness of shape in WPF

From Java

SwiftUI: How to draw filled and stroked shape?

From Dev

How do I draw this shape in SVG?

From Dev

Android how to draw Rounded Rectangle shape programmatically

From Dev

How to draw fan shape with animation by using UIBezierPath?

From Dev

How to draw an arbitrary shape using html canvas?

From Dev

How to remove previous shape after draw() in Processing

From Dev

How to draw a shape using a piece of image in php

From Dev

How to draw Diamond And zick zack shape in ios?

From Dev

How can I draw a shape in CSS?

From Dev

how to draw oval shape around objects in image

From Dev

Android how to draw Rounded Rectangle shape programmatically

From Dev

How to draw multiple circle shape in SFML

From Dev

How to draw a text in a shape? C#

From Dev

ThreeJS how to draw shape with curved edges

From Dev

i need to draw a whatever shape on a form and repeat it for each 5 seconds

From Dev

[WPF]How to draw a grid on canvas?

From Dev

How to draw digital signal in WPF?

From Dev

WPF Path : How to Draw this in XAML?

From Dev

How to dynamically draw a timeline in WPF