public static void EnsureFullPreviewVisible(Pixelmap currFrame, Form parentForm) { lock(s_SyncRoot) { if (s_FullPreviewForm != null) { try { // This will test if the form has been disposed if (!s_FullPreviewForm.Visible && s_FullPreviewForm.Handle == IntPtr.Zero) s_FullPreviewForm = null; } catch(ObjectDisposedException) { s_FullPreviewForm = null; } } if (s_FullPreviewForm == null) { s_FullPreviewForm = new frmFullSizePreview(); s_FullPreviewForm.Width = currFrame.Width + (s_FullPreviewForm.Width - s_FullPreviewForm.pictureBox.Width); s_FullPreviewForm.Height = currFrame.Height + (s_FullPreviewForm.Height - s_FullPreviewForm.pictureBox.Height); s_FullPreviewForm.Top = parentForm.Top; s_FullPreviewForm.Left = parentForm.Right; s_FullPreviewForm.StartPosition = FormStartPosition.Manual; } s_FullPreviewForm.pictureBox.Image = GetPreviewImage(currFrame); if (!s_FullPreviewForm.Visible) s_FullPreviewForm.Show(parentForm); s_FullPreviewForm.Refresh(); } }
public static void EnsureFullPreviewHidden() { lock (s_SyncRoot) { if (s_FullPreviewForm != null) { s_FullPreviewForm.Close(); s_FullPreviewForm.Dispose(); s_FullPreviewForm = null; } } }
public static void EnsureFullPreviewVisible(Pixelmap currFrame, Form parentForm) { lock (s_SyncRoot) { if (s_FullPreviewForm != null) { try { // This will test if the form has been disposed if (!s_FullPreviewForm.Visible && s_FullPreviewForm.Handle == IntPtr.Zero) { s_FullPreviewForm = null; } } catch (ObjectDisposedException) { s_FullPreviewForm = null; } } if (s_FullPreviewForm == null) { s_FullPreviewForm = new frmFullSizePreview(); s_FullPreviewForm.Width = currFrame.Width + (s_FullPreviewForm.Width - s_FullPreviewForm.pictureBox.Width); s_FullPreviewForm.Height = currFrame.Height + (s_FullPreviewForm.Height - s_FullPreviewForm.pictureBox.Height); s_FullPreviewForm.Top = parentForm.Top; s_FullPreviewForm.Left = parentForm.Right; s_FullPreviewForm.StartPosition = FormStartPosition.Manual; } s_FullPreviewForm.pictureBox.Image = GetPreviewImage(currFrame); if (!s_FullPreviewForm.Visible) { s_FullPreviewForm.Show(parentForm); } s_FullPreviewForm.Refresh(); } }