I tried importing, Making windows and it almost all errored

As i was trying to use github-Copilot, I Was trying to make a c# window with a circle. I don't understand why it errored. Why did it error? How did it error? And why did the import fail?,

As for now, I Don't understand c# much yet. And i might need some help with the errors and all. Whoever helped me, I thank you much. [Back to details]

I tried making a circle in a window which will be able to shrink and grow by clicking an button, And github- copilot inserted the Imports (using) How did the circles we're made : Eclipse

This was made in visual code as i was making the code. But i imported it in visual studio 2019 and those were the errors : Errors of the code

Code for you :

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
// Create circle game namespace

// Make the window
public partial class MainWindow : Window
{
    public MainWindow()
    {
        // Initialize the window
        InitializeComponent();
    }
    private void MakeCircle(object sender, RoutedEventArgs e)
    {
        // Make the circle
        Ellipse circle = new Ellipse();
        // Set the size of the circle
        circle.Height = 100;
        circle.Width = 100;
        circle.Fill = Brushes.Red;
        circle.Margin = new Thickness(100, 100, 0, 0);
        canvas.Children.Add(circle);
    }
    private void GrowCircle(object sender, RoutedEventArgs e)
    {
        // Make the circle grow
        circle.Height += 10;
        circle.Width += 10;
    }

    private void ShrinkCircle(object sender, RoutedEventArgs e)
    {
        circle.Height -= 10;
        circle.Width -= 10;
    }
}```

Upvotes: 0

Views: 43

Answers (1)

Mohammad Mirmostafa
Mohammad Mirmostafa

Reputation: 1775

I think that's because you have chosen an incorrect Output type:

enter image description here

Check that out please.

Upvotes: 1

Related Questions