public RsMini(RsBrowser rs) { parent = rs; mainForm = rs.parent; if (!Properties.Settings.Default.Resizable) { MessageBox.Show("Mini requires DWM.", "Desktop composition not enabled", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } InitializeComponent(); GlassMargins = new Margins(-3); GlassEnabled = false; Program.RestoreLocationAndSize(this, Properties.Settings.Default.MiniLocation, Properties.Settings.Default.MiniSize); UpdateAspectRatio(); MaximumSize = new Size(MaximumSize.Width, (int)Math.Floor(MaximumSize.Width * AspectRatio)); MinimumSize = new Size((int)Math.Floor(MinimumSize.Width * AspectRatio), MinimumSize.Width); Game = DwmManager.Register(Handle, rs.Handle); Inventory = DwmManager.Register(Handle, rs.Handle); UpdateThumbnails(); if (Settings.Default.MiniVisible) { Show(); } else { Hide(); } }
public void DisposeNoUI() { try { if (noui) { gameArea.Close(); } gameArea = null; noui = false; UpdateProperties(); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("Couldn't close noui: {0}", ex.Message)); } }
/// <summary> /// Disposes current thumbnail and enters stand-by mode. /// </summary> public void UnsetThumbnail() { Log.Write("Unsetting thumbnail"); if (_thumbnail != null && !_thumbnail.IsInvalid) { _thumbnail.Close(); } _thumbnail = null; _labelGlass.Visible = true; }
/// <summary> /// Creates a new thumbnail of a certain window. /// </summary> /// <param name="handle">Handle of the window to clone.</param> /// <param name="region">Optional region.</param> public void SetThumbnailHandle(WindowHandle handle, ThumbnailRegion region) { Log.WriteDetails("Setting new thumbnail", "HWND {0}, region {1}", handle, region ); if (_thumbnail != null && !_thumbnail.IsInvalid) { _thumbnail.Close(); _thumbnail = null; } //Attempt to get top level Form from Control Form owner = this.TopLevelControl as Form; if (owner == null) throw new Exception("Internal error: ThumbnailPanel.TopLevelControl is not a Form."); _labelGlass.Visible = false; //Register new thumbnail, update regioning directly and refresh thumbnail _thumbnail = DwmManager.Register(owner, handle.Handle); _currentRegion = region; _regionEnabled = (region != null); UpdateThubmnail(); }
public static extern int DwmUpdateThumbnailProperties(Thumbnail hThumbnailId, ref DwmThumbnailProperties ptnProperties);
public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out Thumbnail phThumbnailId);
public static extern int DwmQueryThumbnailSourceSize(Thumbnail hThumbnail, out DwmSize pSize);
/// <summary> /// Disposes current thumbnail and enters stand-by mode. /// </summary> public void UnsetThumbnail() { System.Diagnostics.Trace.WriteLine("Unsetting thumbnail."); if (_thumbnail != null && !_thumbnail.IsInvalid) { _thumbnail.Close(); } _thumbnail = null; _labelGlass.Visible = true; }
/// <summary> /// Creates a new thumbnail of a certain window. /// </summary> /// <param name="handle">Handle of the window to clone.</param> /// <param name="region">Optional region.</param> public void SetThumbnailHandle(WindowHandle handle, ThumbnailRegion region) { System.Diagnostics.Trace.WriteLine(string.Format("Setting thumbnail to handle {0}, with region {1}.", handle, region), "ThumbnailPanel"); if (_thumbnail != null && !_thumbnail.IsInvalid) { _thumbnail.Close(); _thumbnail = null; } //Get form and register thumbnail on it Form owner = this.TopLevelControl as Form; if(owner == null) throw new Exception("Internal error: ThumbnailPanel.TopLevelControl is not a Form."); _labelGlass.Visible = false; //Register new thumbnail, disable regioning directly and refresh _thumbnail = DwmManager.Register(owner, handle.Handle); _currentRegion = region; _regionEnabled = (region != null); UpdateThubmnail(); }
/// <summary> /// Disposes current thumbnail and enters stand-by mode. /// </summary> public void UnsetThumbnail() { if (_thumbnail != null && !_thumbnail.IsInvalid) _thumbnail.Close(); _thumbnail = null; _labelGlass.Visible = true; }
/// <summary> /// Creates a new thumbnail of a certain window. /// </summary> /// <param name="handle">Handle of the window to clone.</param> public void SetThumbnailHandle(WindowHandle handle) { if (_thumbnail != null && !_thumbnail.IsInvalid) _thumbnail.Close(); //Get form and register thumbnail on it Form owner = this.TopLevelControl as Form; if(owner == null) throw new Exception("Internal error: ThumbnailPanel.TopLevelControl is not a Form."); _labelGlass.Visible = false; _thumbnail = DwmManager.Register(owner, handle.Handle); ConstrainToRegion = false; //this also invokes a thumbnail update }
public void InitializeNoUI() { gameArea = DwmManager.Register(Handle, rs.Handle); noui = true; UpdateProperties(); }
public static void Unregister(Thumbnail handle) { if (handle != null) { handle.Close(); } }