} // picDisplay_MouseDoubleClick private void btnAdd_Click(object sender, EventArgs e) { using (frmAddEvent frm = new frmAddEvent(0.0D, 0.0D)) { if (DialogResult.OK == frm.ShowDialog()) { this.m_calc.Add(frm.SpaceTimeEvent); } } // using frm } // btnAdd_Click
} // Draw private void picDisplay_MouseDoubleClick(object sender, MouseEventArgs e) { PictureBox pic = (PictureBox)sender; double ratioX = this.ViewPort.Width / pic.ClientRectangle.Width; double ratioY = this.ViewPort.Height / pic.ClientRectangle.Height; double pos = (ratioX * e.X) + this.ViewPort.X; double time = (ratioY * (pic.ClientRectangle.Height - e.Y)) + (this.ViewPort.Y - this.ViewPort.Height); using (frmAddEvent frm = new frmAddEvent(pos, time)) { if (DialogResult.OK == frm.ShowDialog()) { this.m_calc.Add(frm.SpaceTimeEvent); } } // using frm } // picDisplay_MouseDoubleClick