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; }
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(); }