Пример #1
0
 private void TrackLine_lv_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (TrackLine_lv.SelectedItems.Count != 0)
     {
         deleteBtn.Enabled = true;
         TrackLine _tl = tLine[TrackLine_lv.SelectedItems[0].Index];
         id_tb.Text         = _tl.trackLineID.ToString();
         describe_tb.Text   = _tl.trackText.ToString();
         leftX_tb.Text      = _tl.selfLeftPoint.X.ToString();
         leftY_tb.Text      = _tl.selfLeftPoint.Y.ToString();
         rightX_tb.Text     = _tl.selfRightPoint.X.ToString();
         rightY_tb.Text     = _tl.selfRightPoint.Y.ToString();
         leftWayTo_tb.Text  = _tl.leftWayTo;
         rightWayTo_tb.Text = _tl.rightWayTo;
         if (_tl.leftTrackPoint != null)
         {
             lPoint_tb.Text = _tl.leftTrackPoint.trackPointID.ToString();
         }
         if (_tl.rightTrackPoint != null)
         {
             rPoint_tb.Text = _tl.rightTrackPoint.trackPointID.ToString();
         }
     }
     else
     {
         deleteBtn.Enabled = false;
     }
 }
Пример #2
0
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     try
     {
         TrackLine _tl = new TrackLine();
         if ((id_tb.Text.Length != 0 &&
              describe_tb.Text.Length != 0 &&
              leftX_tb.Text.Length != 0 &&
              leftY_tb.Text.Length != 0 &&
              rightX_tb.Text.Length != 0 &&
              rightY_tb.Text.Length != 0)
             )
         {
             _tl.trackLineID    = int.Parse(id_tb.Text);
             _tl.trackText      = describe_tb.Text;
             _tl.selfLeftPoint  = new Point(int.Parse(leftX_tb.Text), int.Parse(leftY_tb.Text));
             _tl.selfRightPoint = new Point(int.Parse(rightX_tb.Text), int.Parse(rightY_tb.Text));
             if (lPoint_tb.Text.Length != 0 &&
                 tempLPoint != null)
             {
                 _tl.leftTrackPoint = tempLPoint;
             }
             if (rPoint_tb.Text.Length != 0 &&
                 tempRPoint != null)
             {
                 _tl.rightTrackPoint = tempRPoint;
             }
             if (TrackLine_lv.SelectedItems.Count != 0)
             {
                 tLine.RemoveAt(TrackLine_lv.SelectedItems[0].Index);
             }
             if (leftWayTo_tb.Text.Length != 0)
             {
                 _tl.leftWayTo = leftWayTo_tb.Text;
             }
             if (rightWayTo_tb.Text.Length != 0)
             {
                 _tl.rightWayTo = rightWayTo_tb.Text;
             }
             tLine.Add(_tl);
             tLine.Sort();
             removeText();
             initUI();
         }
         else
         {
             MessageBox.Show("请填写可填写内容", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception e1)
     {
         MessageBox.Show(e1.ToString().Split('。')[0] + "。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }