C#

Помогите исправить ошибку в коде.

Ошибка CS0234 Тип или имя пространства имен "Interaction" не существует в пространстве имен "Microsoft.VisualBasic" (возможно, отсутствует ссылка на сборку).

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows .Forms;

namespace CircleDrawingApp
{
public partial class Form1 : Form
{
private int n;
private Graphics g;
private Pen pen;
public Form1()
{
InitializeComponent();
pen = new Pen( Brushes.Black , 2);
g = CreateGraphics();
}

private void Form1_Load(object sender, EventArgs e)
{

n = int.Parse(Microsoft.VisualBasic.Interaction.InputBox("Enter number of circles:", "Input", "", 0, 0));
DrawCircles(n, 0, Width / 2, Height / 2, Width / 4);
}
private void DrawCircles(int n, int level, float x, float y, float radius)
{
if (level == n)
return;
g.DrawEllipse(pen, x - radius, y - radius, 2 * radius, 2 * radius);
DrawCircles(n, level + 1, x + 2 * radius, y, radius / 2);
DrawCircles(n, level + 1, x - 2 * radius, y, radius / 2);
}
}
}
 using Microsoft.VisualBasic; 


string input = Interaction.InputBox("Prompt", "Title", "Default", x_coordinate, y_coordinate);
Чарымурад Ханов
Чарымурад Ханов
96 443
Лучший ответ
Алексей Семенов string input = Interaction.InputBox("Prompt", "Title", "Default", x_coordinate, y_coordinate);
эту строчку куда нужно вставить?можете помочь?
 using System; 
using System.Drawing;
using System.Windows.Forms;


namespace CircleDrawingApp
{
public partial class Form1 : Form
{
private int n;
private Graphics g;
private Pen pen;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.NumericUpDown numericUpDown1;

public Form1()
{
InitializeComponent();
pen = new Pen(Brushes.Black, 2);
g = CreateGraphics();

this.button1 = new System.Windows.Forms.Button();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();

//
// button1
//
this.button1.Location = new System.Drawing.Point(100, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Draw";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(12, 12);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(57, 20);
this.numericUpDown1.TabIndex = 0;
this.numericUpDown1.Value = new decimal(new int[] {5, 0, 0, 0});

this.Controls.Add(this.button1);
this.Controls.Add(this.numericUpDown1);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();

}

private void Form1_Load(object sender, EventArgs e)
{

}
private void DrawCircles(int n, int level, float x, float y, float radius)
{
if (level == n)
return;
g.DrawEllipse(pen, x - radius, y - radius, 2 * radius, 2 * radius);
System.Threading.Thread.Sleep(50);
pen.Color = Color.FromArgb(pen.Color.R, (pen.Color.G + 20) % 255, pen.Color.B);
DrawCircles(n, level + 1, x + 2 * radius, y, radius / 2);
pen.Color = Color.FromArgb(pen.Color.R, pen.Color.G, (pen.Color.B + 20) % 255);
DrawCircles(n, level + 1, x - 2 * radius, y, radius / 2);
}

private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
button1.Text = "Wait";
Refresh();
n = (int)numericUpDown1.Value;
DrawCircles(n, 0, Width / 2, Height / 2, Height / (n * 1.5f) );
button1.Enabled = true;
button1.Text = "Draw";
}
}
}
Антон Дружинин
Антон Дружинин
22 714
Антон Дружинин Чет я залип над задачей xD