Beispiel #1
0
        private void panelContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            ThumbnailPanel panel = (ThumbnailPanel)panelContextMenuStrip.SourceControl;

            hideWindowBorderToolStripMenuItem.Checked = panel.ClientAreaOnly;
            fixToolStripMenuItem.Checked = panel.IsFixed;
        }
Beispiel #2
0
        private void clipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThumbnailPanel panel = (ThumbnailPanel)panelContextMenuStrip.SourceControl;

            using (Image image = panel.CaptureCurrentImage())
            {
                Clipboard.SetImage(image);
            }
        }
Beispiel #3
0
        private void CaptureWindow(IntPtr windowHandle)
        {
            ThumbnailPanel panel = new ThumbnailPanel();

            panel.ContextMenuStrip = panelContextMenuStrip;
            RegisterMouseEventHandler(panel);
            Controls.Add(panel);
            panel.SetWindow(windowHandle);
            panel.BringToFront();
        }
Beispiel #4
0
        private void panelRegionSelectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThumbnailPanel panel    = (ThumbnailPanel)panelContextMenuStrip.SourceControl;
            RegionSelector selector = new RegionSelector();

            selector.Load += (eventSender, eventArgs) =>
            {
                selector.SetWindow(panel.GetWindow(), panel.ClientAreaOnly);
                selector.DrawnRegion = panel.DrawnRegion;
            };
            if (selector.ShowDialog(this) == DialogResult.OK)
            {
                panel.DrawnRegion = selector.DrawnRegion;
            }
        }
Beispiel #5
0
 private void RegisterMouseEventHandler(ThumbnailPanel panel)
 {
     panel.MouseDown += (sender, e) =>
     {
         if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
         {
             mouseLocation = e.Location;
             panel.BringToFront();
         }
     };
     panel.MouseMove += (sender, e) =>
     {
         if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
         {
             panel.Location = new Point(panel.Location.X + e.X - mouseLocation.X, panel.Location.Y + e.Y - mouseLocation.Y);
         }
     };
 }
Beispiel #6
0
        private void fixToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
        {
            ThumbnailPanel panel = (ThumbnailPanel)panelContextMenuStrip.SourceControl;

            panel.IsFixed = fixToolStripMenuItem.Checked;
        }
Beispiel #7
0
        private void hideWindowBorderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ThumbnailPanel panel = (ThumbnailPanel)panelContextMenuStrip.SourceControl;

            panel.ClientAreaOnly = hideWindowBorderToolStripMenuItem.Checked;
        }