From 265cdff262e60cb12761b3a7896e2390ed3efc78 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sat, 3 Jun 2017 17:02:36 +0300 Subject: [PATCH] Added border to toolstrip control instead of using label as workaround --- .../Controls/BlackStyle/UpdatePanel.cs | 2 +- .../Controls/ToolStripBorderRight.cs | 49 ++ .../Controls/ToolStripButtonExtraImage.cs | 2 +- ShareX.HelpersLib/ShareX.HelpersLib.csproj | 3 + ShareX/Controls/NewsListControl.cs | 2 +- ShareX/Forms/MainForm.Designer.cs | 13 +- ShareX/Forms/MainForm.cs | 2 +- ShareX/Forms/MainForm.resx | 610 +++++++++--------- ShareX/Forms/NotificationForm.cs | 2 +- 9 files changed, 352 insertions(+), 333 deletions(-) create mode 100644 ShareX.HelpersLib/Controls/ToolStripBorderRight.cs diff --git a/ShareX.HelpersLib/Controls/BlackStyle/UpdatePanel.cs b/ShareX.HelpersLib/Controls/BlackStyle/UpdatePanel.cs index 8b0e80832..c7094ad0f 100644 --- a/ShareX.HelpersLib/Controls/BlackStyle/UpdatePanel.cs +++ b/ShareX.HelpersLib/Controls/BlackStyle/UpdatePanel.cs @@ -39,7 +39,7 @@ public UpdatePanel() protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; - Rectangle rect = e.ClipRectangle; + Rectangle rect = ClientRectangle; using (Brush backgroundBrush = new LinearGradientBrush(rect, Color.FromArgb(100, 100, 100), Color.FromArgb(70, 70, 70), LinearGradientMode.Vertical)) { diff --git a/ShareX.HelpersLib/Controls/ToolStripBorderRight.cs b/ShareX.HelpersLib/Controls/ToolStripBorderRight.cs new file mode 100644 index 000000000..a468b3467 --- /dev/null +++ b/ShareX.HelpersLib/Controls/ToolStripBorderRight.cs @@ -0,0 +1,49 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2017 ShareX Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ShareX.HelpersLib +{ + public class ToolStripBorderRight : ToolStrip + { + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + e.Graphics.DrawLine(Pens.DarkGray, new Point(ClientSize.Width - 1, 0), new Point(ClientSize.Width - 1, ClientSize.Height - 1)); + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + base.OnPaintBackground(e); + } + } +} \ No newline at end of file diff --git a/ShareX.HelpersLib/Controls/ToolStripButtonExtraImage.cs b/ShareX.HelpersLib/Controls/ToolStripButtonExtraImage.cs index 5676d6062..3b851d93a 100644 --- a/ShareX.HelpersLib/Controls/ToolStripButtonExtraImage.cs +++ b/ShareX.HelpersLib/Controls/ToolStripButtonExtraImage.cs @@ -49,7 +49,7 @@ protected override void OnPaint(PaintEventArgs e) if (ShowExtraImage && ExtraImage != null) { - e.Graphics.DrawImage(ExtraImage, new Point(e.ClipRectangle.Right - ExtraImage.Width - extraImagePadding, extraImagePadding)); + e.Graphics.DrawImage(ExtraImage, new Point(Width - ExtraImage.Width - extraImagePadding, extraImagePadding)); } } } diff --git a/ShareX.HelpersLib/ShareX.HelpersLib.csproj b/ShareX.HelpersLib/ShareX.HelpersLib.csproj index 6f0c30252..7d983f068 100644 --- a/ShareX.HelpersLib/ShareX.HelpersLib.csproj +++ b/ShareX.HelpersLib/ShareX.HelpersLib.csproj @@ -104,6 +104,9 @@ Component + + Component + Component diff --git a/ShareX/Controls/NewsListControl.cs b/ShareX/Controls/NewsListControl.cs index 703d38112..e7eae2c56 100644 --- a/ShareX/Controls/NewsListControl.cs +++ b/ShareX/Controls/NewsListControl.cs @@ -90,7 +90,7 @@ private void TlpMain_CellPaint(object sender, TableLayoutCellPaintEventArgs e) } else { - color = Color.FromArgb(246, 246, 246); + color = Color.FromArgb(247, 247, 247); } using (Brush brush = new SolidBrush(color)) diff --git a/ShareX/Forms/MainForm.Designer.cs b/ShareX/Forms/MainForm.Designer.cs index a288314cf..e08393323 100644 --- a/ShareX/Forms/MainForm.Designer.cs +++ b/ShareX/Forms/MainForm.Designer.cs @@ -32,7 +32,6 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter(); this.lblMainFormTip = new System.Windows.Forms.Label(); - this.lblSplitter = new System.Windows.Forms.Label(); this.lvUploads = new ShareX.HelpersLib.MyListView(); this.chFilename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -45,7 +44,7 @@ private void InitializeComponent() this.flpPatreon = new System.Windows.Forms.FlowLayoutPanel(); this.pbPatreonOpen = new System.Windows.Forms.PictureBox(); this.pbPatreonHide = new System.Windows.Forms.PictureBox(); - this.tsMain = new System.Windows.Forms.ToolStrip(); + this.tsMain = new ShareX.HelpersLib.ToolStripBorderRight(); this.tsddbCapture = new System.Windows.Forms.ToolStripDropDownButton(); this.tsmiFullscreen = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiWindow = new System.Windows.Forms.ToolStripMenuItem(); @@ -262,7 +261,6 @@ private void InitializeComponent() // scMain.Panel1 // this.scMain.Panel1.Controls.Add(this.lblMainFormTip); - this.scMain.Panel1.Controls.Add(this.lblSplitter); this.scMain.Panel1.Controls.Add(this.lvUploads); // // scMain.Panel2 @@ -280,12 +278,6 @@ private void InitializeComponent() this.lblMainFormTip.UseMnemonic = false; this.lblMainFormTip.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lblDragAndDropTip_MouseUp); // - // lblSplitter - // - this.lblSplitter.BackColor = System.Drawing.Color.DarkGray; - resources.ApplyResources(this.lblSplitter, "lblSplitter"); - this.lblSplitter.Name = "lblSplitter"; - // // lvUploads // this.lvUploads.AutoFillColumn = true; @@ -1917,7 +1909,7 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader chURL; private System.Windows.Forms.ColumnHeader chFilename; private System.Windows.Forms.ColumnHeader chProgress; - private System.Windows.Forms.ToolStrip tsMain; + private ShareX.HelpersLib.ToolStripBorderRight tsMain; private System.Windows.Forms.ToolStripSeparator tssMain1; private System.Windows.Forms.ColumnHeader chSpeed; private System.Windows.Forms.ColumnHeader chRemaining; @@ -1992,7 +1984,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tsmiTrayURLSharingServices; private System.Windows.Forms.ToolStripDropDownButton tsddbAfterUploadTasks; private System.Windows.Forms.ToolStripButton tsbScreenshotsFolder; - private System.Windows.Forms.Label lblSplitter; private System.Windows.Forms.ToolStripMenuItem tsmiTrayAfterUploadTasks; private System.Windows.Forms.ToolStripSeparator tssUploadInfo1; private System.Windows.Forms.ToolStripMenuItem tsmiImagePreview; diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 59f76783b..a088ceece 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -872,7 +872,7 @@ private void UpdateMainWindowLayout() tsmiHideMenu.Text = Resources.MainForm_UpdateMenu_Show_menu; } - tsMain.Visible = lblSplitter.Visible = Program.Settings.ShowMenu; + tsMain.Visible = Program.Settings.ShowMenu; if (Program.Settings.ShowColumns) { diff --git a/ShareX/Forms/MainForm.resx b/ShareX/Forms/MainForm.resx index ca7d16627..1693ff101 100644 --- a/ShareX/Forms/MainForm.resx +++ b/ShareX/Forms/MainForm.resx @@ -159,30 +159,6 @@ 0 - - Left - - - 0, 0 - - - 1, 429 - - - 0 - - - lblSplitter - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - scMain.Panel1 - - - 1 - Fill @@ -205,7 +181,7 @@ scMain.Panel1 - 2 + 1 scMain.Panel1 @@ -447,30 +423,6 @@ Left - - 0, 0 - - - 6, 6, 6, 6 - - - 160, 429 - - - 1 - - - tsMain - - - System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 5 - MiddleLeft @@ -483,84 +435,6 @@ Capture - - 191, 22 - - - Fullscreen - - - 191, 22 - - - Window - - - 191, 22 - - - Monitor - - - 191, 22 - - - Region - - - 191, 22 - - - Region (Light) - - - 191, 22 - - - Region (Transparent) - - - 191, 22 - - - Last region - - - 191, 22 - - - Screen recording - - - 191, 22 - - - Screen recording (GIF) - - - 191, 22 - - - Scrolling capture... - - - 191, 22 - - - Webpage capture... - - - 191, 22 - - - Text capture (OCR)... - - - 191, 22 - - - Auto capture... - MiddleLeft @@ -573,36 +447,6 @@ Upload - - 203, 22 - - - Upload file... - - - 203, 22 - - - Upload folder... - - - 203, 22 - - - Upload from clipboard... - - - 203, 22 - - - Upload from URL... - - - 203, 22 - - - Drag and drop upload... - BottomLeft @@ -627,90 +471,6 @@ Tools - - 183, 22 - - - Color picker... - - - 183, 22 - - - Screen color picker... - - - 183, 22 - - - Annotate image... - - - 183, 22 - - - Image effects... - - - 183, 22 - - - Hash check... - - - 183, 22 - - - DNS changer... - - - 183, 22 - - - QR code... - - - 183, 22 - - - Ruler... - - - 183, 22 - - - Directory indexer... - - - 183, 22 - - - Image combiner... - - - 183, 22 - - - Video thumbnailer... - - - 183, 22 - - - FTP client... - - - 183, 22 - - - Tweet message... - - - 183, 22 - - - Monitor test... - 147, 6 @@ -750,45 +510,6 @@ Destinations - - 187, 22 - - - Image uploaders - - - 187, 22 - - - Text uploaders - - - 187, 22 - - - File uploaders - - - 187, 22 - - - URL shorteners - - - 187, 22 - - - URL sharing services - - - 184, 6 - - - 187, 22 - - - Destination settings... - MiddleLeft @@ -876,42 +597,6 @@ Debug - - 172, 22 - - - Debug log... - - - 172, 22 - - - Test image upload - - - 172, 22 - - - Test text upload - - - 172, 22 - - - Test file upload - - - 172, 22 - - - Test URL shortener - - - 172, 22 - - - Test URL sharing - MiddleLeft @@ -948,6 +633,297 @@ About... + + 0, 0 + + + 6, 6, 6, 6 + + + 160, 429 + + + 1 + + + tsMain + + + ShareX.HelpersLib.ToolStripBorderRight, ShareX.HelpersLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 5 + + + 191, 22 + + + Fullscreen + + + 191, 22 + + + Window + + + 191, 22 + + + Monitor + + + 191, 22 + + + Region + + + 191, 22 + + + Region (Light) + + + 191, 22 + + + Region (Transparent) + + + 191, 22 + + + Last region + + + 191, 22 + + + Screen recording + + + 191, 22 + + + Screen recording (GIF) + + + 191, 22 + + + Scrolling capture... + + + 191, 22 + + + Webpage capture... + + + 191, 22 + + + Text capture (OCR)... + + + 191, 22 + + + Auto capture... + + + 203, 22 + + + Upload file... + + + 203, 22 + + + Upload folder... + + + 203, 22 + + + Upload from clipboard... + + + 203, 22 + + + Upload from URL... + + + 203, 22 + + + Drag and drop upload... + + + 183, 22 + + + Color picker... + + + 183, 22 + + + Screen color picker... + + + 183, 22 + + + Annotate image... + + + 183, 22 + + + Image effects... + + + 183, 22 + + + Hash check... + + + 183, 22 + + + DNS changer... + + + 183, 22 + + + QR code... + + + 183, 22 + + + Ruler... + + + 183, 22 + + + Directory indexer... + + + 183, 22 + + + Image combiner... + + + 183, 22 + + + Video thumbnailer... + + + 183, 22 + + + FTP client... + + + 183, 22 + + + Tweet message... + + + 183, 22 + + + Monitor test... + + + 187, 22 + + + Image uploaders + + + 187, 22 + + + Text uploaders + + + 187, 22 + + + File uploaders + + + 187, 22 + + + URL shorteners + + + 187, 22 + + + URL sharing services + + + 184, 6 + + + 187, 22 + + + Destination settings... + + + 172, 22 + + + Debug log... + + + 172, 22 + + + Test image upload + + + 172, 22 + + + Test text upload + + + 172, 22 + + + Test file upload + + + 172, 22 + + + Test URL shortener + + + 172, 22 + + + Test URL sharing + 286, 17 @@ -1774,7 +1750,7 @@ $this - 0 + 2 True diff --git a/ShareX/Forms/NotificationForm.cs b/ShareX/Forms/NotificationForm.cs index fa3bdcd5f..d386494c4 100644 --- a/ShareX/Forms/NotificationForm.cs +++ b/ShareX/Forms/NotificationForm.cs @@ -136,7 +136,7 @@ protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; - Rectangle rect = e.ClipRectangle; + Rectangle rect = ClientRectangle; if (ToastConfig.Image != null) {