当我试图使用github-Copilot时,我试图制作一个带有圆圈的c#窗口。我不明白为什么会出错。为什么会出错?它是怎么出错的?为什么进口失败了?
就目前而言,我还不太了解c#。我可能需要一些关于错误的帮助。不管是谁帮助了我,我非常感谢你。回到细节
我试着在一个窗口中做一个圆圈,通过点击一个按钮就可以收缩和生长,而github- copilot插入了导入(使用)我们是如何制作的圆圈: Eclipse。
这是在我做代码的时候用视觉代码做的。但是我在visual studio 2019中导入了它,这些都是错误:代码错误
你的代码:
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;
}
}```发布于 2022-03-29 21:24:30
我认为这是因为您选择了一个不正确的输出类型:

请看一下。
https://stackoverflow.com/questions/71668765
复制相似问题