From b8e19624669792ea1e86a2745e8aaf036aae0bb3 Mon Sep 17 00:00:00 2001 From: MaxXor Date: Tue, 28 Jul 2015 18:42:58 +0200 Subject: [PATCH 1/2] Small TabControl fix --- Server/Controls/DotNetBarTabControl.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Server/Controls/DotNetBarTabControl.cs b/Server/Controls/DotNetBarTabControl.cs index e46e837d..19e713ed 100644 --- a/Server/Controls/DotNetBarTabControl.cs +++ b/Server/Controls/DotNetBarTabControl.cs @@ -24,13 +24,8 @@ protected override void OnPaint(PaintEventArgs e) { Bitmap b = new Bitmap(Width, Height); Graphics g = Graphics.FromImage(b); - try - { + if (!DesignMode) SelectedTab.BackColor = SystemColors.Control; - } - catch (Exception) - { - } g.Clear(SystemColors.Control); g.FillRectangle(new SolidBrush(Color.FromArgb(246, 248, 252)), new Rectangle(0, 0, ItemSize.Height + 4, Height)); From 03bcaab524949514fb2b94a3a44b7ee53980bf4c Mon Sep 17 00:00:00 2001 From: MaxXor Date: Tue, 28 Jul 2015 18:44:29 +0200 Subject: [PATCH 2/2] Improved PictureBox --- Server/Controls/PictureBoxEx.cs | 12 ++++++++++++ Server/Forms/FrmRemoteDesktop.Designer.cs | 18 ++++++++++-------- Server/Server.csproj | 3 +++ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 Server/Controls/PictureBoxEx.cs diff --git a/Server/Controls/PictureBoxEx.cs b/Server/Controls/PictureBoxEx.cs new file mode 100644 index 00000000..bbf2d76c --- /dev/null +++ b/Server/Controls/PictureBoxEx.cs @@ -0,0 +1,12 @@ +using System.Windows.Forms; + +namespace xServer.Controls +{ + internal class PictureBoxEx : PictureBox + { + public PictureBoxEx() + { + this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); + } + } +} diff --git a/Server/Forms/FrmRemoteDesktop.Designer.cs b/Server/Forms/FrmRemoteDesktop.Designer.cs index f9aa4e67..8d897f12 100644 --- a/Server/Forms/FrmRemoteDesktop.Designer.cs +++ b/Server/Forms/FrmRemoteDesktop.Designer.cs @@ -1,4 +1,6 @@ -namespace xServer.Forms +using xServer.Controls; + +namespace xServer.Forms { partial class FrmRemoteDesktop { @@ -35,7 +37,7 @@ private void InitializeComponent() this.lblQuality = new System.Windows.Forms.Label(); this.lblQualityShow = new System.Windows.Forms.Label(); this.btnMouse = new System.Windows.Forms.Button(); - this.picDesktop = new System.Windows.Forms.PictureBox(); + this.picDesktop = new PictureBoxEx(); this.panelTop = new System.Windows.Forms.Panel(); this.cbMonitors = new System.Windows.Forms.ComboBox(); this.btnHide = new System.Windows.Forms.Button(); @@ -113,8 +115,7 @@ private void InitializeComponent() this.picDesktop.Dock = System.Windows.Forms.DockStyle.Fill; this.picDesktop.Location = new System.Drawing.Point(0, 0); this.picDesktop.Name = "picDesktop"; - this.picDesktop.Size = new System.Drawing.Size(797, 501); - this.picDesktop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.picDesktop.Size = new System.Drawing.Size(748, 438); this.picDesktop.TabIndex = 0; this.picDesktop.TabStop = false; this.picDesktop.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseDown); @@ -171,15 +172,16 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(797, 501); + this.ClientSize = new System.Drawing.Size(748, 438); this.Controls.Add(this.btnShow); this.Controls.Add(this.panelTop); this.Controls.Add(this.picDesktop); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(570, 421); + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(640, 480); this.Name = "FrmRemoteDesktop"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "xRAT 2.0 - Remote Desktop []"; @@ -205,7 +207,7 @@ private void InitializeComponent() private System.Windows.Forms.Panel panelTop; private System.Windows.Forms.Button btnHide; private System.Windows.Forms.Button btnShow; - private System.Windows.Forms.PictureBox picDesktop; + private PictureBoxEx picDesktop; private System.Windows.Forms.ComboBox cbMonitors; } } \ No newline at end of file diff --git a/Server/Server.csproj b/Server/Server.csproj index 17e56108..8f30a789 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -71,6 +71,9 @@ Component + + Component +