변수를 선택하면 화면에 스마일을 그려주는 프로그램을 작성하려고합니다.다른 방법에 대한 ReadLine 입력 사용
다음 내용을 작성했습니다.
내 프로그램에서 세 가지 질문을합니다.이 질문은 0에서 11 사이의 숫자로 대답 할 것입니다.이 대답은 'tekenscherm'메서드에서 사용하고 싶습니다. 어떻게이 메소드에서 이러한 변수를 호출 할 수 있습니까?
class HalloForm : Form
{
public string a,b,c = ""; //Declare them here.
public HalloForm()
{
this.Text = "Hallo";
this.BackColor = Color.Yellow;
this.Size = new Size(800, 600);
this.Paint += this.tekenScherm;
}
public static void Main()
{
System.Console.WriteLine("Smiley size, on a scale of 1 tot 10?");
string a = System.Console.ReadLine();
Int32.Parse(a);
System.Console.WriteLine("X coordinate of the smiley, on a scale of 1 to 10");
string b = System.Console.ReadLine();
Int32.Parse(b);
System.Console.WriteLine("Y coordinate of the smiley, on a scale of 1 to 10");
string c = System.Console.ReadLine();
Int32.Parse(c);
HalloForm scherm;
scherm = new HalloForm();
Application.Run(scherm);
}
void tekenScherm(object obj, PaintEventArgs pea)
{
SolidBrush blueBrush = new SolidBrush(Color.Blue);
Pen blackBrush = new Pen(Color.Black, 5);
int x = 360;
int y = x + 75;
pea.Graphics.FillEllipse(blueBrush, 300, 200, 200, 200);
pea.Graphics.DrawEllipse(blackBrush, 300, 200, 200, 200);
pea.Graphics.DrawArc(blackBrush, 350, 250, 100, 100, 45, 90);
pea.Graphics.DrawEllipse(blackBrush, a, 250, 5, 5); //I've used it here
pea.Graphics.DrawEllipse(blackBrush, y, 250, 5, 5);
}
}
그것은 (: drawScreen 영어로 경우 tekenScherm에서) 모든 변수/함수 이름의 이름을 지정하는 것이 좋습니다입니다 : 여기
는 작업 코드입니다. –
이것은 주로 영어로 말하는 웹 사이트입니다. 도움이 필요하면 영어로 모든 것을 작성하는 것이 좋습니다. 다른 언어를 보게되는 순간 나는 독서를 그만 둔다. – Krythic