こんにちわ
日本に仕事する、韓国人です。
C#に入門してから一か月です。
プログラムを作るが目標です。でも
以下のエーラが出ます。
*勉強したもの
1.2点の距離探す関数作りました。
2.型変換を勉強しました。
3.関数の使用方法に勉強しました。
プログラムソースです。
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;
using System.Collections;
using System.Runtime.InteropServices;
using System.Threading;
namespace MISSION9
{
public partial class Form1 : Form
{
public Form1() { InitializeComponent(); } private int num; protected double GetAB(double x, double y, double x1, double y1) //두점 사이의 거리 구하는 함수 { string xValue = textBox1.Text; x = Convert.ToDouble(xValue); //convert를 사용해서 형 변환하기 x = Convert.ToInt32(textBox1.Text);
// this.textBox1 = new TextBox();
// this.textBox1.Name = x;
string yValue = textBox2.Text; y = Convert.ToDouble(yValue); y = Convert.ToInt32(textBox2.Text); string x1Value = textBox3.Text; x1 = Convert.ToDouble(x1Value); x1 = Convert.ToInt32(textBox3.Text); string y1Value = textBox4.Text; y1 = Convert.ToDouble(y1Value); y1 = Convert.ToInt32(textBox4.Text); double distance = Math.Sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y)); return (int)distance; } protected double GetBC(double x1, double y1, double x2, double y2) //DelegateFunc { string x1Value = textBox3.Text; x1 = Convert.ToDouble(x1Value); x1 = Convert.ToInt32(textBox3.Text); string y1Value = textBox4.Text; y1 = Convert.ToDouble(y1Value); y1 = Convert.ToInt32(textBox5.Text); string x2Value = textBox5.Text; x2 = Convert.ToDouble(x2Value); x2 = Convert.ToInt32(textBox5.Text); string y2Value = textBox6.Text; y2 = Convert.ToDouble(y2Value); y2 = Convert.ToInt32(textBox6); double distance1 = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); return (int)distance1; } protected double GetAC(double x, double y, double x2, double y2) { string x2Value = textBox5.Text; x2 = Convert.ToDouble(x2Value); x2 = Convert.ToInt32(textBox5); string y2Value = textBox6.Text; y2 = Convert.ToDouble(y2Value); y2 = Convert.ToInt32(textBox6); string xValue = textBox1.Text; x = Convert.ToDouble(xValue); x = Convert.ToInt32(textBox1); string yValue = textBox2.Text; y = Convert.ToDouble(yValue); y = Convert.ToInt32(textBox2); double distance2 = Math.Sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)); return (int)distance2; } private void button1_Click(object sender, EventArgs e) { label15.Text = GetAB(distance); label16.Text = GetBC(distance1); label17.Text = GetAC(distance2); //메소드, 함수 사용법 다시 훓기 } private void pictureBox1_Click(object sender, EventArgs e) //그냥 삼각형 출력하기 위해서 한것. { Bitmap canvas = new Bitmap(pictureBox1.Width, pictureBox1.Height); // 렌더링 대상으로하는 Image 객체를 만드는 Graphics g = Graphics.FromImage(canvas); // Image 객체의 Graphics 객체를 만들 Point[] ps = { new Point (0, 0), // 직선으로 연결하는 점의 배열을 만들 new Point (190, 90), new Point (120, 140) }; g.DrawPolygon(Pens.Black, ps); // 다각형 그리기 g.Dispose(); // 리소스를 해제 pictureBox1.Image = canvas; // PictureBox1에 표시 } private void textBox1_TextChanged(object sender, EventArgs e) { //string textBox1 = xValue; //x = xValue; } } public partial class Keisan { }
}
理由をわからないです。。。
日本のC#能力者たちさま手伝ってください
回答3件
あなたの回答
tips
プレビュー