Question: Create a C# WPF app that can open a text file containing information about shapes to draw and then draw those shapes. Each line of
Create a C# WPF app that can open a text file containing information about shapes to draw and then draw those shapes. Each line of the file represents a single shape to draw. The line starts with the name of the shape (either ellipse or rectangle), followed by three integers for the red, green, and blue for the color, followed by two integers for x and y coordinates for the location of the shape, followed by two more integers for the width and height of the shape. So each line of the file will have this format:
shape red green blue x y width height
Here's an example contents of a file in this format:
ellipse 0 0 255 1 1 100 50
ellipse 255 0 255 150 150 100 100
rectangle 0 255 0 0 300 50 100
To open the file, you will need to use an OpenFileDialog, which might need to be programmatically created in WPF. It's created like a regular control, but you'll have to include the Microsoft.Win32 name space in your file (Add using Microsoft.Win32;).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
