From ea5b0362df601a6989e214d76d7f184de1feee83 Mon Sep 17 00:00:00 2001 From: Sean Kaim Date: Sat, 5 Jan 2019 14:34:02 -0500 Subject: [PATCH] more DPI scaling fixes + frmChoosePnl fixes frmChoosePanel button layout was off a bit. Exception when clicking "new" when no panels exist. --- .../Controls/SecureTextBoxTestForm.Designer.cs | 4 ++-- mRemoteNGTests/UI/Controls/TestForm.Designer.cs | 4 ++-- .../TextBoxExtensionsTestForm.Designer.cs | 4 ++-- .../Connection/InterfaceControl.Designer.cs | 1 - mRemoteV1/Tools/ReconnectGroup.Designer.cs | 4 ++-- mRemoteV1/UI/Controls/Base/NGComboBox.cs | 16 +++++++++++----- .../CredentialRecordListView.Designer.cs | 4 ++-- .../CredentialRepositoryListView.Designer.cs | 4 ++-- .../NewPasswordWithVerification.Designer.cs | 4 ++-- mRemoteV1/UI/Forms/frmChoosePanel.Designer.cs | 11 +++++------ 10 files changed, 30 insertions(+), 26 deletions(-) diff --git a/mRemoteNGTests/UI/Controls/SecureTextBoxTestForm.Designer.cs b/mRemoteNGTests/UI/Controls/SecureTextBoxTestForm.Designer.cs index abe3ec476..7e61eac6e 100644 --- a/mRemoteNGTests/UI/Controls/SecureTextBoxTestForm.Designer.cs +++ b/mRemoteNGTests/UI/Controls/SecureTextBoxTestForm.Designer.cs @@ -43,8 +43,8 @@ namespace mRemoteNGTests.UI.Controls // // SecureTextBoxTestForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(256, 45); this.Controls.Add(this.secureTextBox1); this.Name = "SecureTextBoxTestForm"; diff --git a/mRemoteNGTests/UI/Controls/TestForm.Designer.cs b/mRemoteNGTests/UI/Controls/TestForm.Designer.cs index 3a5a7b7a8..f4341e91b 100644 --- a/mRemoteNGTests/UI/Controls/TestForm.Designer.cs +++ b/mRemoteNGTests/UI/Controls/TestForm.Designer.cs @@ -32,8 +32,8 @@ // // TestForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(284, 262); this.Name = "TestForm"; this.Text = "TestForm"; diff --git a/mRemoteNGTests/UI/Controls/TextBoxExtensionsTestForm.Designer.cs b/mRemoteNGTests/UI/Controls/TextBoxExtensionsTestForm.Designer.cs index 346b31bf3..f97a3dfdf 100644 --- a/mRemoteNGTests/UI/Controls/TextBoxExtensionsTestForm.Designer.cs +++ b/mRemoteNGTests/UI/Controls/TextBoxExtensionsTestForm.Designer.cs @@ -40,8 +40,8 @@ // // TextBoxExtensionsTestForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(220, 48); this.Controls.Add(this.textBox1); this.Name = "TextBoxExtensionsTestForm"; diff --git a/mRemoteV1/Connection/InterfaceControl.Designer.cs b/mRemoteV1/Connection/InterfaceControl.Designer.cs index f15e9a7d7..440fdce42 100644 --- a/mRemoteV1/Connection/InterfaceControl.Designer.cs +++ b/mRemoteV1/Connection/InterfaceControl.Designer.cs @@ -29,7 +29,6 @@ namespace mRemoteNG.Connection private void InitializeComponent() { components = new System.ComponentModel.Container(); - //Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font } } } diff --git a/mRemoteV1/Tools/ReconnectGroup.Designer.cs b/mRemoteV1/Tools/ReconnectGroup.Designer.cs index 3902cd378..4bbe7d77a 100644 --- a/mRemoteV1/Tools/ReconnectGroup.Designer.cs +++ b/mRemoteV1/Tools/ReconnectGroup.Designer.cs @@ -111,8 +111,8 @@ namespace mRemoteNG.Tools // // ReconnectGroup // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.grpAutomaticReconnect); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); diff --git a/mRemoteV1/UI/Controls/Base/NGComboBox.cs b/mRemoteV1/UI/Controls/Base/NGComboBox.cs index 5a9f69037..43ff476e8 100644 --- a/mRemoteV1/UI/Controls/Base/NGComboBox.cs +++ b/mRemoteV1/UI/Controls/Base/NGComboBox.cs @@ -73,15 +73,21 @@ namespace mRemoteNG.UI.Controls.Base else e.Graphics.FillRectangle(new SolidBrush(_themeManager.ActiveTheme.ExtendedPalette.getColor("ComboBox_Background")), e.Bounds); - if(string.IsNullOrEmpty(DisplayMember)) - e.Graphics.DrawString(Items[index].ToString(), e.Font, itemBrush, e.Bounds, StringFormat.GenericDefault); - else + if (Items.Count > 0) { - if (Items[index].GetType().GetProperty(DisplayMember) != null) + if (string.IsNullOrEmpty(DisplayMember)) + e.Graphics.DrawString(Items[index].ToString(), e.Font, itemBrush, e.Bounds, StringFormat.GenericDefault); + else { - e.Graphics.DrawString(Items[index].GetType().GetProperty(DisplayMember)?.GetValue(Items[index],null).ToString(), e.Font, itemBrush, e.Bounds, StringFormat.GenericDefault); + if (Items[index].GetType().GetProperty(DisplayMember) != null) + { + e.Graphics.DrawString( + Items[index].GetType().GetProperty(DisplayMember)?.GetValue(Items[index], null).ToString(), + e.Font, itemBrush, e.Bounds, StringFormat.GenericDefault); + } } } + e.DrawFocusRectangle(); } diff --git a/mRemoteV1/UI/Controls/CredentialRecordListView.Designer.cs b/mRemoteV1/UI/Controls/CredentialRecordListView.Designer.cs index cc002ab45..af55e86e3 100644 --- a/mRemoteV1/UI/Controls/CredentialRecordListView.Designer.cs +++ b/mRemoteV1/UI/Controls/CredentialRecordListView.Designer.cs @@ -105,8 +105,8 @@ // // CredentialRecordListView // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Controls.Add(this.objectListView1); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "CredentialRecordListView"; diff --git a/mRemoteV1/UI/Controls/CredentialRepositoryListView.Designer.cs b/mRemoteV1/UI/Controls/CredentialRepositoryListView.Designer.cs index 5195dfdbf..c9312d156 100644 --- a/mRemoteV1/UI/Controls/CredentialRepositoryListView.Designer.cs +++ b/mRemoteV1/UI/Controls/CredentialRepositoryListView.Designer.cs @@ -87,8 +87,8 @@ // // CredentialRepositoryListView // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Controls.Add(this.objectListView1); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "CredentialRepositoryListView"; diff --git a/mRemoteV1/UI/Controls/NewPasswordWithVerification.Designer.cs b/mRemoteV1/UI/Controls/NewPasswordWithVerification.Designer.cs index fcf158b40..236631756 100644 --- a/mRemoteV1/UI/Controls/NewPasswordWithVerification.Designer.cs +++ b/mRemoteV1/UI/Controls/NewPasswordWithVerification.Designer.cs @@ -95,8 +95,8 @@ // // NewPasswordWithVerification // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Controls.Add(this.imgError); this.Controls.Add(this.labelPasswordsDontMatch); this.Controls.Add(this.labelSecondPasswordBox); diff --git a/mRemoteV1/UI/Forms/frmChoosePanel.Designer.cs b/mRemoteV1/UI/Forms/frmChoosePanel.Designer.cs index c7a077472..0665428f6 100644 --- a/mRemoteV1/UI/Forms/frmChoosePanel.Designer.cs +++ b/mRemoteV1/UI/Forms/frmChoosePanel.Designer.cs @@ -50,7 +50,7 @@ namespace mRemoteNG.UI.Forms this.btnOK._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER; this.btnOK.Location = new System.Drawing.Point(167, 72); this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(69, 23); + this.btnOK.Size = new System.Drawing.Size(75, 24); this.btnOK.TabIndex = 20; this.btnOK.Text = global::mRemoteNG.Language.strButtonOK; this.btnOK.UseVisualStyleBackColor = true; @@ -70,20 +70,19 @@ namespace mRemoteNG.UI.Forms this.btnNew._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER; this.btnNew.Image = global::mRemoteNG.Resources.Panel_Add; this.btnNew.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.btnNew.Location = new System.Drawing.Point(101, 70); + this.btnNew.Location = new System.Drawing.Point(86, 72); this.btnNew.Name = "btnNew"; - this.btnNew.Size = new System.Drawing.Size(60, 27); + this.btnNew.Size = new System.Drawing.Size(75, 24); this.btnNew.TabIndex = 40; this.btnNew.Text = global::mRemoteNG.Language.strButtonNew; - this.btnNew.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnNew.UseVisualStyleBackColor = true; this.btnNew.Click += new System.EventHandler(this.btnNew_Click); // // FrmChoosePanel // this.AcceptButton = this.btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.ClientSize = new System.Drawing.Size(245, 107); this.Controls.Add(this.lblDescription); this.Controls.Add(this.btnNew);