Esempio n. 1
0
        private void chartControl1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            ScalarProgressionDragDropPacket packet = (ScalarProgressionDragDropPacket)e.Data.GetData(typeof(ScalarProgressionDragDropPacket));

            if (packet == null)
            {
                return;
            }

            ChartControl senderControl = (ChartControl)packet.sender;

            if (chartControl1.Handle == senderControl.Handle)
            {
                return;
            }

            FloatProgression newData = (FloatProgression)packet.data;

            if (newData == null)
            {
                return;
            }

            data.Copy(newData);

            bInitialized = false;
            getModifiedData();
            bInitialized = true;
            refreshListBox();
            refreshTextBoxes();
            refreshGraph();
            chartControl1.Refresh();
            updateEnableState();
        }
Esempio n. 2
0
        private void chartControl1_MouseDown(object sender, MouseEventArgs e)
        {
            if (!bInitialized)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                //-- unselect by default
                m_SelectedPoint = -1;

                double fX = 0;
                double fY = 0;
                convertMouseXYtoClientXY(e.X, e.Y, ref fX, ref fY);

                double offset     = 2.5f;
                double hitBoxMinX = Math.Max(0.0f, fX - offset);
                double hitBoxMaxX = Math.Min(100.0f, fX + offset);
                double hitBoxMinY = Math.Max(mMinY, fY - offset);
                double hitBoxMaxY = Math.Min(mMaxY, fY + offset);

                double yRange = mMaxY - mMinY;

                for (int i = 0; i < data.Stages.Count; ++i)
                {
                    double valueX = data.Stages[i].Alpha;
                    double valueY = data.Stages[i].Value;

                    if ((valueX >= hitBoxMinX) && (valueX <= hitBoxMaxX) &&
                        (valueY >= hitBoxMinY) && (valueY <= hitBoxMaxY))
                    {
                        m_SelectedPoint = i;
                        break;
                    }
                }

                if (m_SelectedPoint < 0 || m_SelectedPoint >= data.Stages.Count)
                {
                    m_SelectedPoint = -1;
                }
                else
                {
                    listBox1.SelectedIndex = m_SelectedPoint;
                }
            }

            //-- initiate a drag drop if it isn't a point
            if (m_SelectedPoint == -1 && e.Button == MouseButtons.Right)
            {
                ScalarProgressionDragDropPacket packet = new ScalarProgressionDragDropPacket();
                packet.data   = data;
                packet.sender = chartControl1;
                //chartControl1.DoDragDrop(data, DragDropEffects.Copy);
                chartControl1.DoDragDrop(packet, DragDropEffects.Copy);
            }
        }
Esempio n. 3
0
        private void chartControl1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;

            ScalarProgressionDragDropPacket packet = (ScalarProgressionDragDropPacket)e.Data.GetData(typeof(ScalarProgressionDragDropPacket));

            if (packet == null)
            {
                return;
            }

            ChartControl senderControl = (ChartControl)packet.sender;

            if (chartControl1.Handle == senderControl.Handle)
            {
                return;
            }

            if (e.Data.GetDataPresent(typeof(ScalarProgressionDragDropPacket)))
            {
                e.Effect = DragDropEffects.Copy;
            }
        }