internal override DialogResult Edit(dlgDrawings owner) { DialogResult ret = DialogResult.None; dlgEditArc dlgArc = new dlgEditArc(); dlgArc.LoadData(this, owner); ret = dlgArc.ShowDialog(owner); return(ret); }
protected override System.Windows.Forms.DialogResult dlgDrawingsMouseDown(object sender, System.Windows.Forms.MouseEventArgs e, ref int nStep, dlgDrawings owner) { System.Windows.Forms.DialogResult ret = System.Windows.Forms.DialogResult.None; switch (nStep) { case 0: //first step, select up-left corner rc.X = e.X; rc.Y = e.Y; nStep++; break; case 1: //second step, size if (e.X > rc.X) { rc.Width = e.X - rc.X; } else { rc.Width = rc.X - e.X; rc.X = e.X; } if (e.Y > rc.Y) { rc.Height = e.Y - rc.Y; } else { rc.Height = rc.Y - e.Y; rc.Y = e.Y; } nStep++; break; case 2: //start angle { int x = rc.X + rc.Width / 2; int y = rc.Y + rc.Height / 2; x = e.X - x; y = e.Y - y; this.startAngle = (float)((180 / System.Math.PI) * System.Math.Atan2((double)y, (double)x)); nStep++; } break; case 3: //end angle { int x = rc.X + rc.Width / 2; int y = rc.Y + rc.Height / 2; x = e.X - x; y = e.Y - y; float a = (float)((180 / System.Math.PI) * System.Math.Atan2((double)y, (double)x)); this.sweepAngle = a - this.startAngle; nStep++; owner.Invalidate(); dlgEditArc dlgArc = new dlgEditArc(); dlgArc.LoadData(this, owner); ret = dlgArc.ShowDialog(owner); } break; } step = nStep; return(ret); }