Merge pull request #694 from Mbucari/master

Fix DPI scaling bug (#692)
This commit is contained in:
rmcrackan 2023-08-01 15:03:21 -04:00 committed by GitHub
commit c61a863edd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 33 deletions

View File

@ -49,7 +49,7 @@ namespace LibationWinForms.Dialogs
// customDirectoryRb
//
customDirectoryRb.AutoSize = true;
customDirectoryRb.Location = new System.Drawing.Point(2, 62);
customDirectoryRb.Location = new System.Drawing.Point(3, 58);
customDirectoryRb.Name = "customDirectoryRb";
customDirectoryRb.Size = new System.Drawing.Size(14, 13);
customDirectoryRb.TabIndex = 2;
@ -58,18 +58,16 @@ namespace LibationWinForms.Dialogs
//
// customTb
//
customTb.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
customTb.Location = new System.Drawing.Point(22, 58);
customTb.Location = new System.Drawing.Point(23, 56);
customTb.Name = "customTb";
customTb.Size = new System.Drawing.Size(588, 23);
customTb.Size = new System.Drawing.Size(606, 23);
customTb.TabIndex = 3;
//
// customBtn
//
customBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
customBtn.Location = new System.Drawing.Point(616, 58);
customBtn.Location = new System.Drawing.Point(635, 55);
customBtn.Name = "customBtn";
customBtn.Size = new System.Drawing.Size(41, 27);
customBtn.Size = new System.Drawing.Size(26, 23);
customBtn.TabIndex = 4;
customBtn.Text = "...";
customBtn.UseVisualStyleBackColor = true;
@ -77,12 +75,9 @@ namespace LibationWinForms.Dialogs
//
// directorySelectControl
//
directorySelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
directorySelectControl.AutoSize = true;
directorySelectControl.Location = new System.Drawing.Point(23, 0);
directorySelectControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
directorySelectControl.Name = "directorySelectControl";
directorySelectControl.Size = new System.Drawing.Size(635, 55);
directorySelectControl.Size = new System.Drawing.Size(637, 50);
directorySelectControl.TabIndex = 5;
//
// DirectoryOrCustomSelectControl
@ -95,7 +90,7 @@ namespace LibationWinForms.Dialogs
Controls.Add(customDirectoryRb);
Controls.Add(knownDirectoryRb);
Name = "DirectoryOrCustomSelectControl";
Size = new System.Drawing.Size(660, 88);
Size = new System.Drawing.Size(660, 80);
Load += DirectoryOrCustomSelectControl_Load;
ResumeLayout(false);
PerformLayout();

View File

@ -37,11 +37,16 @@ namespace LibationWinForms.Dialogs
if (directory != Configuration.KnownDirectories.None)
selectDir(directory, null);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
//For some reason anchors don't work when the parent form scales up, even with AutoScale
directorySelectControl.Width = customTb.Width = Width;
//Workaround for anchoring bug in user controls
//https://github.com/dotnet/winforms/issues/6381
customBtn.Location = new System.Drawing.Point(Width - customBtn.Width, customTb.Location.Y);
customBtn.Height = customTb.Height;
directorySelectControl.Width = Width - directorySelectControl.Location.X;
customTb.Width = Width - customTb.Location.X - customBtn.Width - customTb.Margin.Left;
}
/// <summary>set selection</summary>

View File

@ -35,7 +35,7 @@ namespace LibationWinForms.Dialogs
//
// directoryComboBox
//
directoryComboBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
directoryComboBox.Dock = System.Windows.Forms.DockStyle.Top;
directoryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
directoryComboBox.FormattingEnabled = true;
directoryComboBox.Location = new System.Drawing.Point(0, 0);
@ -46,8 +46,8 @@ namespace LibationWinForms.Dialogs
//
// textBox1
//
textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
textBox1.Location = new System.Drawing.Point(0, 29);
textBox1.Dock = System.Windows.Forms.DockStyle.Bottom;
textBox1.Location = new System.Drawing.Point(0, 26);
textBox1.Name = "textBox1";
textBox1.ReadOnly = true;
textBox1.Size = new System.Drawing.Size(814, 23);
@ -57,11 +57,10 @@ namespace LibationWinForms.Dialogs
//
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoSize = true;
Controls.Add(textBox1);
Controls.Add(directoryComboBox);
Name = "DirectorySelectControl";
Size = new System.Drawing.Size(814, 55);
Size = new System.Drawing.Size(814, 49);
Load += DirectorySelectControl_Load;
ResumeLayout(false);
PerformLayout();

View File

@ -48,7 +48,7 @@
//
cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelBtn.Location = new System.Drawing.Point(832, 118);
cancelBtn.Location = new System.Drawing.Point(832, 119);
cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cancelBtn.Name = "cancelBtn";
cancelBtn.Size = new System.Drawing.Size(88, 27);
@ -60,7 +60,7 @@
// saveBtn
//
saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
saveBtn.Location = new System.Drawing.Point(714, 118);
saveBtn.Location = new System.Drawing.Point(736, 119);
saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
saveBtn.Name = "saveBtn";
saveBtn.Size = new System.Drawing.Size(88, 27);
@ -73,9 +73,9 @@
//
libationFilesSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
libationFilesSelectControl.Location = new System.Drawing.Point(14, 28);
libationFilesSelectControl.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
libationFilesSelectControl.Margin = new System.Windows.Forms.Padding(6);
libationFilesSelectControl.Name = "libationFilesSelectControl";
libationFilesSelectControl.Size = new System.Drawing.Size(906, 88);
libationFilesSelectControl.Size = new System.Drawing.Size(906, 81);
libationFilesSelectControl.TabIndex = 1;
//
// LibationFilesDialog
@ -83,7 +83,7 @@
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoSize = true;
ClientSize = new System.Drawing.Size(933, 164);
ClientSize = new System.Drawing.Size(933, 158);
Controls.Add(libationFilesSelectControl);
Controls.Add(cancelBtn);
Controls.Add(saveBtn);

View File

@ -339,11 +339,10 @@
// inProgressSelectControl
//
inProgressSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
inProgressSelectControl.AutoSize = true;
inProgressSelectControl.Location = new System.Drawing.Point(7, 68);
inProgressSelectControl.Location = new System.Drawing.Point(6, 85);
inProgressSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
inProgressSelectControl.Name = "inProgressSelectControl";
inProgressSelectControl.Size = new System.Drawing.Size(830, 55);
inProgressSelectControl.Size = new System.Drawing.Size(830, 49);
inProgressSelectControl.TabIndex = 19;
//
// logsBtn
@ -359,11 +358,10 @@
// booksSelectControl
//
booksSelectControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
booksSelectControl.AutoSize = true;
booksSelectControl.Location = new System.Drawing.Point(8, 38);
booksSelectControl.Location = new System.Drawing.Point(6, 37);
booksSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
booksSelectControl.Name = "booksSelectControl";
booksSelectControl.Size = new System.Drawing.Size(830, 102);
booksSelectControl.Size = new System.Drawing.Size(832, 102);
booksSelectControl.TabIndex = 2;
//
// loggingLevelLbl
@ -617,7 +615,7 @@
// saveMetadataToFileCbox
//
saveMetadataToFileCbox.AutoSize = true;
saveMetadataToFileCbox.Location = new System.Drawing.Point(482, 415);
saveMetadataToFileCbox.Location = new System.Drawing.Point(482, 428);
saveMetadataToFileCbox.Name = "saveMetadataToFileCbox";
saveMetadataToFileCbox.Size = new System.Drawing.Size(165, 19);
saveMetadataToFileCbox.TabIndex = 22;
@ -627,7 +625,7 @@
// useCoverAsFolderIconCb
//
useCoverAsFolderIconCb.AutoSize = true;
useCoverAsFolderIconCb.Location = new System.Drawing.Point(7, 415);
useCoverAsFolderIconCb.Location = new System.Drawing.Point(7, 428);
useCoverAsFolderIconCb.Name = "useCoverAsFolderIconCb";
useCoverAsFolderIconCb.Size = new System.Drawing.Size(180, 19);
useCoverAsFolderIconCb.TabIndex = 22;
@ -641,7 +639,7 @@
inProgressFilesGb.Controls.Add(inProgressSelectControl);
inProgressFilesGb.Location = new System.Drawing.Point(6, 281);
inProgressFilesGb.Name = "inProgressFilesGb";
inProgressFilesGb.Size = new System.Drawing.Size(842, 128);
inProgressFilesGb.Size = new System.Drawing.Size(842, 141);
inProgressFilesGb.TabIndex = 21;
inProgressFilesGb.TabStop = false;
inProgressFilesGb.Text = "In progress files";