Пример #1
0
        private void DragObjectFinished()
        {
            RestoreChartControlSetting();
            if (DragObject != null)
            {
                DragObject.Object.InSetup = false;
                DragObject.Object.InMove  = false;
            }

            if (AfterCreateFinished != null)
            {
                if (DragObject != null)
                {
                    AfterCreateFinished(this, DragObject.Object);
                }
                else
                {
                    AfterCreateFinished(this, null);
                }
            }

            DragObject       = null;
            ObjectType       = null;
            Canvas.Designing = false;
            ObjectSteps      = 0;
            Changed          = true;
            Invalidate();
        }
Пример #2
0
        private void DesignerControl_MouseDown(object sender, MouseEventArgs e)
        {
            FormulaArea fa = null;
            BaseObject  objectAt;

            this.StartPoint = this.GetValueFromPos((float)e.X, (float)e.Y, ref fa);
            this.SaveChartControlSetting();
            if (this.ObjectType == null)
            {
                this.SelectedObject = null;
                if (e.Button == MouseButtons.Left)
                {
                    int controlPointIndex = this.GetPointIndex(e.X, e.Y, out objectAt);
                    if (objectAt == null)
                    {
                        objectAt = this.GetObjectAt(e.X, e.Y);
                    }
                    if (objectAt != null)
                    {
                        this.SelectedObject = objectAt;
                        this.DragObject     = new ObjectDragging(new PointF((float)e.X, (float)e.Y), controlPointIndex, objectAt);
                        this.Designer.Invalidate(objectAt.GetRegion());
                        objectAt.InMove = true;
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                this.objects.Remove(this.DragObject.Object);
                this.DragObjectFinished();
            }
            else if (this.ObjectSteps == 0)
            {
                objectAt          = this.ObjectType.Invoke();
                objectAt.AreaName = fa.Name;
                objectAt.Area     = fa;
                objectAt.InSetup  = true;
                objectAt.InMove   = true;
                if (this.AfterCreateStart != null)
                {
                    this.AfterCreateStart(this, objectAt);
                }
                objectAt.SetObjectManager(this);
                for (int i = 0; i < objectAt.ControlPointNum; i++)
                {
                    objectAt.ControlPoints[i] = this.StartPoint;
                }
                this.objects.Add(objectAt);
                this.SelectedObject = objectAt;
                this.DragObject     = new ObjectDragging(new PointF((float)e.X, (float)e.Y), ((this.ObjectSteps + objectAt.InitNum) > 1) ? 1 : 0, objectAt);
            }
            this.DragMemBmp = null;
        }
Пример #3
0
 private void DragObjectFinished()
 {
     this.RestoreChartControlSetting();
     if ((this.AfterCreateFinished != null) && (this.DragObject != null))
     {
         this.DragObject.Object.InSetup = false;
         this.DragObject.Object.InMove  = false;
         this.AfterCreateFinished(this, this.DragObject.Object);
     }
     this.DragObject       = null;
     this.ObjectType       = null;
     this.Canvas.Designing = false;
     this.ObjectSteps      = 0;
     this.Designer.Invalidate();
 }
Пример #4
0
        private void DesignerControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Changed = true;
            FormulaArea fa = null;

            StartPoint = GetValueFromPos(e.X, e.Y, ref fa);
            BaseObject bo;

            SaveChartControlSetting();
            if (ObjectType == null)
            {
                SelectedObject = null;
                if (e.Button == MouseButtons.Left)
                {
                    int PointIndex = GetPointIndex(e.X, e.Y, out bo);
                    if (bo == null)
                    {
                        bo = GetObjectAt(e.X, e.Y);
                    }

                    if (bo != null)
                    {
                        SelectedObject = bo;
                        DragObject     = new ObjectDragging(new PointF(e.X, e.Y), PointIndex, bo);
                        Invalidate(bo.GetRegion());
                        bo.InMove = true;
                    }
                }
            }
            else
            {
                if (e.Button == MouseButtons.Right)
                {
                    if (DragObject != null)
                    {
                        objects.Remove(DragObject.Object);
                    }
                    DragObjectFinished();
                }
                else
                {
                    if (ObjectSteps == 0)
                    {
                        bo          = ObjectType.Invoke();
                        bo.AreaName = fa.Name;
                        bo.Area     = fa;
                        bo.InSetup  = true;
                        bo.InMove   = true;
                        if (AfterCreateStart != null)
                        {
                            AfterCreateStart(this, bo);
                        }
                        //ob.SetObjectManager(this);
                        for (int i = 0; i < bo.ControlPointNum; i++)
                        {
                            bo.ControlPoints[i] = StartPoint;
                        }
                        AddObject(bo);
                        //objects.Add(ob);
                        SelectedObject = bo;

                        DragObject = new ObjectDragging(new PointF(e.X, e.Y), ObjectSteps + bo.InitNum > 1?1:0, bo);
                    }
                }
            }
            DragMemBmp = null;
        }