diff --git a/OnTopReplica/AspectRatioForm.cs b/OnTopReplica/AspectRatioForm.cs index dec6cd8..d488d98 100644 --- a/OnTopReplica/AspectRatioForm.cs +++ b/OnTopReplica/AspectRatioForm.cs @@ -127,7 +127,7 @@ namespace OnTopReplica { //Ensure that the ClientSize of the form is always respected //(not ensured by the WM_SIZING message alone because of rounding errors and the chrome space) if (KeepAspectRatio) { - var newHeight = (int)((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio + ExtraPadding.Vertical); + var newHeight = (int)Math.Round(((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio) + ExtraPadding.Vertical); ClientSize = new Size(ClientSize.Width, newHeight); } } diff --git a/OnTopReplica/Assets/clickforwarding.png b/OnTopReplica/Assets/clickforwarding.png new file mode 100644 index 0000000..66d9bc8 Binary files /dev/null and b/OnTopReplica/Assets/clickforwarding.png differ diff --git a/OnTopReplica/Assets/fullscreen.png b/OnTopReplica/Assets/fullscreen.png new file mode 100644 index 0000000..b1f8a2b Binary files /dev/null and b/OnTopReplica/Assets/fullscreen.png differ diff --git a/OnTopReplica/Assets/groupmode.png b/OnTopReplica/Assets/groupmode.png new file mode 100644 index 0000000..39afe5a Binary files /dev/null and b/OnTopReplica/Assets/groupmode.png differ diff --git a/OnTopReplica/Assets/xiao_arrow.png b/OnTopReplica/Assets/xiao_arrow.png new file mode 100644 index 0000000..ca39d48 Binary files /dev/null and b/OnTopReplica/Assets/xiao_arrow.png differ diff --git a/OnTopReplica/Assets/xiao_help.png b/OnTopReplica/Assets/xiao_help.png new file mode 100644 index 0000000..df861f9 Binary files /dev/null and b/OnTopReplica/Assets/xiao_help.png differ diff --git a/OnTopReplica/MainForm.Designer.cs b/OnTopReplica/MainForm.Designer.cs index 179686f..880e5af 100644 --- a/OnTopReplica/MainForm.Designer.cs +++ b/OnTopReplica/MainForm.Designer.cs @@ -44,7 +44,6 @@ this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); - this.fullOpacityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuResize = new System.Windows.Forms.ContextMenuStrip(this.components); this.doubleToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); @@ -69,6 +68,7 @@ this.italianoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuContextClose = new System.Windows.Forms.ToolStripMenuItem(); + this.fullOpacityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.danskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuFullscreenContext = new System.Windows.Forms.ContextMenuStrip(this.components); this.enableClickthroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -115,7 +115,6 @@ this.menuWindows.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.noneToolStripMenuItem}); this.menuWindows.Name = "menuWindows"; - this.menuWindows.OwnerItem = this.menuContextWindows; this.menuWindows.Size = new System.Drawing.Size(118, 26); this.menuWindows.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Windows_opening); // @@ -130,13 +129,13 @@ this.fullSelectWindowToolStripMenuItem.DropDown = this.menuWindows; this.fullSelectWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.list; this.fullSelectWindowToolStripMenuItem.Name = "fullSelectWindowToolStripMenuItem"; - this.fullSelectWindowToolStripMenuItem.Size = new System.Drawing.Size(186, 22); + this.fullSelectWindowToolStripMenuItem.Size = new System.Drawing.Size(189, 22); this.fullSelectWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindows; this.fullSelectWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuWindowsTT; // // switchToWindowToolStripMenuItem // - this.switchToWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_switch; + this.switchToWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_arrow; this.switchToWindowToolStripMenuItem.Name = "switchToWindowToolStripMenuItem"; this.switchToWindowToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.switchToWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuSwitch; @@ -166,6 +165,7 @@ // // clickForwardingToolStripMenuItem // + this.clickForwardingToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding; this.clickForwardingToolStripMenuItem.Name = "clickForwardingToolStripMenuItem"; this.clickForwardingToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.clickForwardingToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickForwarding; @@ -174,6 +174,7 @@ // // clickThroughToolStripMenuItem // + this.clickThroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity; this.clickThroughToolStripMenuItem.Name = "clickThroughToolStripMenuItem"; this.clickThroughToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.clickThroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough; @@ -182,6 +183,7 @@ // // groupSwitchModeToolStripMenuItem // + this.groupSwitchModeToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.groupmode; this.groupSwitchModeToolStripMenuItem.Name = "groupSwitchModeToolStripMenuItem"; this.groupSwitchModeToolStripMenuItem.Size = new System.Drawing.Size(199, 22); this.groupSwitchModeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuGroupSwitch; @@ -204,7 +206,6 @@ this.toolStripMenuItem3, this.toolStripMenuItem4}); this.menuOpacity.Name = "menuOpacity"; - this.menuOpacity.OwnerItem = this.menuContextOpacity; this.menuOpacity.ShowCheckMargin = true; this.menuOpacity.ShowImageMargin = false; this.menuOpacity.Size = new System.Drawing.Size(154, 92); @@ -248,14 +249,6 @@ this.toolStripMenuItem4.ToolTipText = global::OnTopReplica.Strings.MenuOp25TT; this.toolStripMenuItem4.Click += new System.EventHandler(this.Menu_Opacity_click); // - // fullOpacityToolStripMenuItem - // - this.fullOpacityToolStripMenuItem.DropDown = this.menuOpacity; - this.fullOpacityToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity; - this.fullOpacityToolStripMenuItem.Name = "fullOpacityToolStripMenuItem"; - this.fullOpacityToolStripMenuItem.Size = new System.Drawing.Size(186, 22); - this.fullOpacityToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuOpacity; - // // resizeToolStripMenuItem // this.resizeToolStripMenuItem.DropDown = this.menuResize; @@ -313,6 +306,7 @@ // // fullscreenToolStripMenuItem1 // + this.fullscreenToolStripMenuItem1.Image = global::OnTopReplica.Properties.Resources.fullscreen; this.fullscreenToolStripMenuItem1.Name = "fullscreenToolStripMenuItem1"; this.fullscreenToolStripMenuItem1.Size = new System.Drawing.Size(164, 22); this.fullscreenToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitFullscreen; @@ -442,6 +436,7 @@ // // aboutToolStripMenuItem // + this.aboutToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_help; this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.aboutToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAbout; @@ -456,6 +451,14 @@ this.menuContextClose.Text = global::OnTopReplica.Strings.MenuClose; this.menuContextClose.Click += new System.EventHandler(this.Menu_Close_click); // + // fullOpacityToolStripMenuItem + // + this.fullOpacityToolStripMenuItem.DropDown = this.menuOpacity; + this.fullOpacityToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity; + this.fullOpacityToolStripMenuItem.Name = "fullOpacityToolStripMenuItem"; + this.fullOpacityToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + this.fullOpacityToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuOpacity; + // // danskToolStripMenuItem // this.danskToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.flag_danish; @@ -473,12 +476,13 @@ this.enableClickthroughToolStripMenuItem, this.fullExitToolStripMenuItem}); this.menuFullscreenContext.Name = "menuFullscreenContext"; - this.menuFullscreenContext.Size = new System.Drawing.Size(187, 114); + this.menuFullscreenContext.Size = new System.Drawing.Size(190, 92); // // enableClickthroughToolStripMenuItem // + this.enableClickthroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding; this.enableClickthroughToolStripMenuItem.Name = "enableClickthroughToolStripMenuItem"; - this.enableClickthroughToolStripMenuItem.Size = new System.Drawing.Size(186, 22); + this.enableClickthroughToolStripMenuItem.Size = new System.Drawing.Size(189, 22); this.enableClickthroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough; this.enableClickthroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickThroughTT; this.enableClickthroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickThrough_click); @@ -487,7 +491,7 @@ // this.fullExitToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.close_new; this.fullExitToolStripMenuItem.Name = "fullExitToolStripMenuItem"; - this.fullExitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.fullExitToolStripMenuItem.Size = new System.Drawing.Size(189, 22); this.fullExitToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuQuitFullscreen; this.fullExitToolStripMenuItem.Click += new System.EventHandler(this.Menu_Fullscreen_ExitFullscreen_click); // diff --git a/OnTopReplica/MainForm.cs b/OnTopReplica/MainForm.cs index 3a52363..c76e6da 100644 --- a/OnTopReplica/MainForm.cs +++ b/OnTopReplica/MainForm.cs @@ -152,7 +152,7 @@ namespace OnTopReplica { protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); - //Same story as above... + //Same story as above (OnMouseDoubleClick) if (e.Button == System.Windows.Forms.MouseButtons.Right) { OpenContextMenu(); } @@ -393,6 +393,30 @@ namespace OnTopReplica { _thumbnailPanel.ConstrainToRegion = false; SetAspectRatio(_thumbnailPanel.ThumbnailOriginalSize, true); } + + FixPositionAndSize(); + } + } + + const int FixMargin = 10; + + /// + /// Fixes the form's position and size, ensuring it is fully displayed in the current screen. + /// + private void FixPositionAndSize() { + var screen = Screen.FromControl(this); + + if (Width > screen.WorkingArea.Width) { + Width = screen.WorkingArea.Width - FixMargin; + } + if (Height > screen.WorkingArea.Height) { + Height = screen.WorkingArea.Height - FixMargin; + } + if (Location.X + Width > screen.WorkingArea.Right) { + Location = new Point(screen.WorkingArea.Right - Width - FixMargin, Location.Y); + } + if (Location.Y + Height > screen.WorkingArea.Bottom) { + Location = new Point(Location.X, screen.WorkingArea.Bottom - Height - FixMargin); } } diff --git a/OnTopReplica/MainForm_ChildForms.cs b/OnTopReplica/MainForm_ChildForms.cs index 524e6a7..0e43ad9 100644 --- a/OnTopReplica/MainForm_ChildForms.cs +++ b/OnTopReplica/MainForm_ChildForms.cs @@ -10,10 +10,6 @@ namespace OnTopReplica { EventHandler RequestClosingHandler; const int SidePanelMargin = 1; - const int ScreenBorderMargin = 10; - - bool _sidePanelDidMoveForm = false; - Point _sidePanelPreviousFormLocation; /// /// Opens a new side panel. @@ -63,17 +59,7 @@ namespace OnTopReplica { ); //Move window if needed - var screenCurr = Screen.FromControl(this); - int pRight = Location.X + Width + ScreenBorderMargin; - if (pRight >= screenCurr.Bounds.Width) { - _sidePanelPreviousFormLocation = Location; - _sidePanelDidMoveForm = true; - - Location = new Point(screenCurr.WorkingArea.Width - Width - ScreenBorderMargin, Location.Y); - } - else { - _sidePanelDidMoveForm = false; - } + FixPositionAndSize(); //Hook event listener if (RequestClosingHandler == null) @@ -105,12 +91,6 @@ namespace OnTopReplica { ); ExtraPadding = new Padding(0); _thumbnailPanel.Size = ClientSize; - - //Move window back if needed - if (_sidePanelDidMoveForm) { - Location = _sidePanelPreviousFormLocation; - _sidePanelDidMoveForm = false; - } } void SidePanel_RequestClosing(object sender, EventArgs e) { diff --git a/OnTopReplica/OnTopReplica.csproj b/OnTopReplica/OnTopReplica.csproj index 9390026..a26a570 100644 --- a/OnTopReplica/OnTopReplica.csproj +++ b/OnTopReplica/OnTopReplica.csproj @@ -299,6 +299,11 @@ + + + + + diff --git a/OnTopReplica/Properties/Resources.Designer.cs b/OnTopReplica/Properties/Resources.Designer.cs index aa53f2c..ee6767b 100644 --- a/OnTopReplica/Properties/Resources.Designer.cs +++ b/OnTopReplica/Properties/Resources.Designer.cs @@ -67,6 +67,13 @@ namespace OnTopReplica.Properties { } } + internal static System.Drawing.Bitmap clickforwarding { + get { + object obj = ResourceManager.GetObject("clickforwarding", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap close_new { get { object obj = ResourceManager.GetObject("close_new", resourceCulture); @@ -109,6 +116,20 @@ namespace OnTopReplica.Properties { } } + internal static System.Drawing.Bitmap fullscreen { + get { + object obj = ResourceManager.GetObject("fullscreen", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap groupmode { + get { + object obj = ResourceManager.GetObject("groupmode", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap icon { get { object obj = ResourceManager.GetObject("icon", resourceCulture); @@ -235,6 +256,13 @@ namespace OnTopReplica.Properties { } } + internal static System.Drawing.Bitmap xiao_arrow { + get { + object obj = ResourceManager.GetObject("xiao_arrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap xiao_component { get { object obj = ResourceManager.GetObject("xiao_component", resourceCulture); @@ -256,6 +284,13 @@ namespace OnTopReplica.Properties { } } + internal static System.Drawing.Bitmap xiao_help { + get { + object obj = ResourceManager.GetObject("xiao_help", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap xiao_ok { get { object obj = ResourceManager.GetObject("xiao_ok", resourceCulture); diff --git a/OnTopReplica/Properties/Resources.resx b/OnTopReplica/Properties/Resources.resx index 5f64b69..b84794e 100644 --- a/OnTopReplica/Properties/Resources.resx +++ b/OnTopReplica/Properties/Resources.resx @@ -121,11 +121,14 @@ ..\Assets\flag_ita.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\xiao_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\x-oblique.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Assets\pos_topright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\component.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Assets\25.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -133,9 +136,18 @@ ..\Assets\window_multiple16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\xiao_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\regions_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\pos_null.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\window_opacity_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\thumbs_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -145,6 +157,18 @@ ..\Assets\pos_bottomleft.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\pos_topright.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\clickforwarding.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\newicon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\xiao_help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\back.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -163,6 +187,9 @@ ..\Assets\window_switch.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\desktop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\flag_danish.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -172,44 +199,32 @@ ..\Assets\xiao_ok.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Assets\component.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\xiao_wrench.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\list.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\icon-new.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Assets\fullscreen.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Assets\xiao_down.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\xiao_arrow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Assets\window_border16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Assets\flag_usa.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Assets\xiao_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\xiao_wrench.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\newicon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\window_opacity_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\desktop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\regions_new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\list.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Assets\icon-new.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Assets\groupmode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/OnTopReplica/SidePanels/RegionPanel.cs b/OnTopReplica/SidePanels/RegionPanel.cs index 0d0f5f1..871a2a1 100644 --- a/OnTopReplica/SidePanels/RegionPanel.cs +++ b/OnTopReplica/SidePanels/RegionPanel.cs @@ -15,8 +15,12 @@ namespace OnTopReplica.SidePanels { comboRegions.Items.Add(o); } } + + _regionDrawnHandler = new ThumbnailPanel.RegionDrawnHandler(ThumbnailPanel_RegionDrawn); } + ThumbnailPanel.RegionDrawnHandler _regionDrawnHandler; + public override void OnFirstShown(MainForm form) { base.OnFirstShown(form); @@ -25,13 +29,14 @@ namespace OnTopReplica.SidePanels { SetRegion(form.SelectedThumbnailRegion.Value); form.ThumbnailPanel.DrawMouseRegions = true; - form.ThumbnailPanel.RegionDrawn += new ThumbnailPanel.RegionDrawnHandler(ThumbnailPanel_RegionDrawn); + form.ThumbnailPanel.RegionDrawn += _regionDrawnHandler; } public override void OnClosing(MainForm form) { base.OnClosing(form); form.ThumbnailPanel.DrawMouseRegions = false; + form.ThumbnailPanel.RegionDrawn -= _regionDrawnHandler; } void ThumbnailPanel_RegionDrawn(object sender, Rectangle region) {