Captura.RegionSelector.WindowFromPoint(System.Drawing.Point)

Here are the examples of the csharp api class Captura.RegionSelector.WindowFromPoint(System.Drawing.Point) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: Captura
Source File: RegionSelector.xaml.cs
void SnapButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            _captured = true;

            DragMove();

            _captured = false;
            
            try
            {
                if (win == IntPtr.Zero)
                {
                    win = WindowFromPoint(new Point((int)(Left - 1), (int)Top - 1) * Dpi.Instance);
                }
                else ToggleBorder(win);

                if (win != IntPtr.Zero)
                {
                    SelectedRegion = new Screna.Window(win).Rectangle;

                    // Prevent going outside
                    if (Left < 0)
                    {
                        // Decrease Width
                        try { Width += Left; }
                        catch { }
                        finally { Left = 0; }
                    }

                    if (Top < 0)
                    {
                        // Decrease Height
                        try { Height += Top; }
                        catch { }
                        finally { Top = 0; }
                    }
                }
            }
            finally
            {
                win = IntPtr.Zero;
            }
        }

2. Example

Project: Captura
Source File: RegionSelector.xaml.cs
void SelectWindow()
        {
            var oldwin = win;

            win = WindowFromPoint(new Point((int)(Left - 1), (int)Top - 1) * Dpi.Instance);

            if (oldwin == IntPtr.Zero)
                ToggleBorder(win);
            else if (oldwin != win)
            {
                ToggleBorder(oldwin);
                ToggleBorder(win);
            }
        }