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

View File

@ -37,11 +37,16 @@ namespace LibationWinForms.Dialogs
if (directory != Configuration.KnownDirectories.None) if (directory != Configuration.KnownDirectories.None)
selectDir(directory, null); selectDir(directory, null);
} }
protected override void OnResize(EventArgs e) protected override void OnResize(EventArgs e)
{ {
base.OnResize(e); base.OnResize(e);
//For some reason anchors don't work when the parent form scales up, even with AutoScale //Workaround for anchoring bug in user controls
directorySelectControl.Width = customTb.Width = Width; //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> /// <summary>set selection</summary>

View File

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

View File

@ -48,7 +48,7 @@
// //
cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; cancelBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; 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.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cancelBtn.Name = "cancelBtn"; cancelBtn.Name = "cancelBtn";
cancelBtn.Size = new System.Drawing.Size(88, 27); cancelBtn.Size = new System.Drawing.Size(88, 27);
@ -60,7 +60,7 @@
// saveBtn // saveBtn
// //
saveBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; 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.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
saveBtn.Name = "saveBtn"; saveBtn.Name = "saveBtn";
saveBtn.Size = new System.Drawing.Size(88, 27); 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.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.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.Name = "libationFilesSelectControl";
libationFilesSelectControl.Size = new System.Drawing.Size(906, 88); libationFilesSelectControl.Size = new System.Drawing.Size(906, 81);
libationFilesSelectControl.TabIndex = 1; libationFilesSelectControl.TabIndex = 1;
// //
// LibationFilesDialog // LibationFilesDialog
@ -83,7 +83,7 @@
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoSize = true; AutoSize = true;
ClientSize = new System.Drawing.Size(933, 164); ClientSize = new System.Drawing.Size(933, 158);
Controls.Add(libationFilesSelectControl); Controls.Add(libationFilesSelectControl);
Controls.Add(cancelBtn); Controls.Add(cancelBtn);
Controls.Add(saveBtn); Controls.Add(saveBtn);

View File

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