/// <summary> /// Makes a transparent window which adjust it's size and position to fit the parent window /// </summary> /// <param name="parent">HWND/Handle of a window</param> /// <param name="limitFPS">VSync</param> public Olay(IntPtr parent, bool limitFPS = true) { if (parent == IntPtr.Zero) { throw new Exception("The handle of the parent window isn't valid"); } Native.RCT bounds; Native.GetWindowRect(parent, out bounds); this.IsDisposing = false; this.IsVisible = true; this.IsTopMost = true; this.ParentWindowExists = true; this.X = bounds.Left; this.Y = bounds.Top; this.Width = bounds.Right - bounds.Left; this.Height = bounds.Bottom - bounds.Top; this.ParentWindow = parent; if (!this.CreateWindow()) { throw new Exception("Could not create OverlayWindow"); } this.Graphics = new D2DRen(this.Handle, limitFPS); this.SetBounds(this.X, this.Y, this.Width, this.Height); }
/// <summary> /// Makes a transparent Fullscreen window /// </summary> /// <param name="limitFPS">VSync</param> public Olay(bool limitFPS = true) { this.IsDisposing = false; this.IsVisible = true; this.IsTopMost = true; this.ParentWindowExists = false; this.X = 0; this.Y = 0; this.Width = Screen.PrimaryScreen.Bounds.Width; this.Height = Screen.PrimaryScreen.Bounds.Height; this.ParentWindow = IntPtr.Zero; if (!this.CreateWindow()) { throw new Exception("Could not create OverlayWindow"); } this.Graphics = new D2DRen(this.Handle, limitFPS); this.SetBounds(this.X, this.Y, this.Width, this.Height); }