private void btnDraw_Click(object sender, EventArgs e) { fShowRegion.Hide(); FormDrawRegion f = new FormDrawRegion(); f.ShowDialog(); Point start = f.PointToScreen(f.start); Point end = f.PointToScreen(f.end); f.Dispose(); Rectangle r = new Rectangle(start.X, start.Y, end.X - start.X, end.Y - start.Y); this.numLeft.Value = r.Left; this.numTop.Value = r.Top; this.numWidth.Value = r.Width; this.numHeight.Value = r.Height; this.updateRegion(); fShowRegion.Show(); }
private void chkEnabled_CheckedChanged(object sender, EventArgs e) { if (chkEnabled.Checked) { enabled = true; touchPad.ExclusiveCapture = true; formShowRegion = new FormShowRegion(); formShowRegion.SetLocationAndSize(region); formShowRegion.Show(); } else { enabled = false; touchPad.ExclusiveCapture = false; formShowRegion.Close(); formShowRegion.Dispose(); formShowRegion = null; } }