示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     theRoad = new TheRoad(Convert.ToInt32(txbStartPoint.Text) - 1, Convert.ToInt32(txbEnds.Text) - 1, Convert.ToInt32(txbCash.Text), Convert.ToInt32(nUDCityAmount.Value), Convert.ToInt32(nUDRoadAmount.Value));
     count   = theRoad.RoadsAmount;
     addToComboBox();
     theRoad.createPosition();
     VeDoThi();
 }
示例#2
0
文件: fMain.cs 项目: pntn0705/LTDT
        private void btnReadFile_Click(object sender, EventArgs e)
        {
            string         s    = "";
            OpenFileDialog open = new OpenFileDialog();
            DialogResult   rs   = open.ShowDialog();

            if (rs == DialogResult.OK)
            {
                isFirst = 0;
                FileStream   fs  = new FileStream(open.FileName, FileMode.Open);
                StreamReader doc = new StreamReader(fs);
                s = doc.ReadLine();
                s.Trim();
                List <int> kq    = ToInt(s);
                int        start = kq[0] - 1;
                int        ends  = kq[1] - 1;
                int        cash  = kq[2];

                s = doc.ReadLine();
                s.Trim();
                kq = ToInt(s);
                int dinh = kq[0];

                s = doc.ReadLine();
                s.Trim();
                kq = ToInt(s);
                int canh = kq[0];
                theRoad = new TheRoad(start, ends, cash, dinh, canh);
                theRoad.createPosition();
                VeDoThi();
                for (int i = 0; i < canh; i++)
                {
                    s = doc.ReadLine();
                    s.Trim();
                    kq = ToInt(s);
                    theRoad.Cost[kq[0] - 1, kq[1] - 1]    = kq[3];
                    theRoad.Map[kq[0] - 1, kq[1] - 1]     = kq[2];
                    theRoad.MinCost[kq[0] - 1, kq[1] - 1] = kq[3];
                    theRoad.MinRoad[kq[0] - 1, kq[1] - 1] = kq[2];

                    Point a = new Point(theRoad.X[kq[0] - 1], theRoad.Y[kq[0] - 1]);
                    Point b = new Point(theRoad.X[kq[1] - 1], theRoad.Y[kq[1] - 1]);
                    DrawALine(a, b, kq[0] - 1, kq[1] - 1, 0);
                    DrawALine(a, b, kq[0] - 1, kq[1] - 1, 0);
                }
                fs.Close();
            }
        }
示例#3
0
文件: fMain.cs 项目: pntn0705/LTDT
 private void button1_Click(object sender, EventArgs e)
 {
     isKQ = 0;
     if (isFirst == 1)
     {
         isFirst = 0;
         theRoad = new TheRoad(Convert.ToInt32(txbStartPoint.Text) - 1, Convert.ToInt32(txbEnds.Text) - 1, Convert.ToInt32(txbCash.Text), Convert.ToInt32(nUDCityAmount.Value), Convert.ToInt32(nUDRoadAmount.Value));
         count   = theRoad.RoadsAmount;
         addToComboBox();
         theRoad.createPosition();
     }
     else
     {
         theRoad.StartPoint = (Convert.ToInt32(txbStartPoint.Text)) - 1;
         theRoad.Ends       = Convert.ToInt32(txbEnds.Text) - 1;
         theRoad.Cash       = Convert.ToInt32(txbCash.Text);
         theRoad.RoadsCount = 0;
     }
     VeDoThi();
 }