Пример #1
0
        private void addSpanButton_Click(object sender, EventArgs e)
        {
            TensionForm dlg = new TensionForm
            {
                Units    = rs.Units,
                Catenary = rs.NewCatenary()
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                rs.Spans.Add(dlg.Catenary);
                rs.SetHorizontalTensionFrom(rs.Spans.Count - 1);
            }
            RefreshAndPaintGrid();
        }
Пример #2
0
        private void pic_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (vis != null)
            {
                RectangleF target   = vis.GetDrawArea(sender as Control);
                Canvas     canvas   = vis.GetCanvasFor(target);
                var        mouse_pt = canvas.InvMap(e.Location);
                var        cat      = rs.FindCatenaryFromX(mouse_pt.X);
                int        index    = rs.Spans.IndexOf(cat);
                if (index >= 0)
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        bool sel = rulingspanDataGrid.Rows[index].Selected;
                        rulingspanDataGrid.Rows[index].Selected = true;
                        TensionForm dlg = new TensionForm
                        {
                            Units    = rs.Units,
                            Catenary = rs[index].Clone()
                        };

                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            rs[index] = dlg.Catenary;
                        }
                        rulingspanDataGrid.Rows[index].Selected = sel;
                    }
                    else if (e.Button == MouseButtons.Right)
                    {
                        bool sel = rulingspanDataGrid.Rows[index].Selected;
                        rulingspanDataGrid.Rows[index].Selected = true;
                        Cursor cur = pic.Cursor;
                        pic.Cursor = Cursors.WaitCursor;
                        var rs_temp = RulingSpan.Clone();
                        this.Enabled = false;
                        rs_temp[index].SetClearancePoint(mouse_pt);
                        this.Enabled = true;
                        pic.Cursor   = cur;
                        vis.ClearMousePosition();
                        RulingSpan = rs_temp;
                        rulingspanDataGrid.Rows[index].Selected = sel;
                    }
                }
            }
        }
Пример #3
0
        private void grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0 && rulingspanDataGrid.Columns[e.ColumnIndex] == AverageTension)
            {
                if (e.RowIndex >= 0)
                {
                    TensionForm dlg = new TensionForm
                    {
                        Units    = rs.Units,
                        Catenary = rs[e.RowIndex].Clone()
                    };

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        rs[e.RowIndex] = dlg.Catenary;
                    }
                }
            }
        }