Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Krypton.Toolkit.KryptonMessageBox wrong form height when YesNo or AbortRetryIgnore buttons selected #491

Closed
W4TR1X opened this issue Nov 25, 2021 · 8 comments
Labels
bug Something isn't working completed This issue has been completed. fixed This issue has been fixed.
Milestone

Comments

@W4TR1X
Copy link

W4TR1X commented Nov 25, 2021

Describe the bug
Some types of Krypton.Toolkit.KryptonMessageBox form height is wrong when
MessageBoxButtons.YesNo or MessageBoxButtons.AbortRetryIgnore selected.

To Reproduce
Select MessageBoxButtons.YesNo or MessageBoxButtons.AbortRetryIgnore
in Krypton.Toolkit.KryptonMessageBox.Show(...)

Expected behavior
Correct height

Screenshots

image

Correct
imageimage

Incorrect
imageimage

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 19043.1348

Additional context
i just tried it in Krypton.Toolkit.Canary 6.2111.326-beta version only

@W4TR1X W4TR1X added the bug Something isn't working label Nov 25, 2021
@W4TR1X W4TR1X changed the title [Bug]: Krypton.Toolkit.KryptonMessageBox wrong height when YesNo or AbortRetryIgnore buttons selected [Bug]: Krypton.Toolkit.KryptonMessageBox wrong form height when YesNo or AbortRetryIgnore buttons selected Nov 25, 2021
@PWagner1
Copy link
Contributor

Now that is odd, @Smurf-IV have you seen this behaviour?

@mbsysde99
Copy link

mbsysde99 commented Nov 26, 2021

I downloaded the Standard-Toolkit-canary from here, and after I tested it, the KryptonMessageBox results worked fine.

KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Exclamation, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Hand, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.None, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Question, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Stop, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Warning, showCtrlCopy: false);

Results:
imageimageimageimageimageimageimageimageimage

@W4TR1X
Copy link
Author

W4TR1X commented Nov 26, 2021

Hi @mbsysde99 the error not appear when using MessageBoxButtons.OK button. Only visible when
MessageBoxButtons.YesNo or MessageBoxButtons.AbortRetryIgnore. Please check again with this settings.

@mbsysde99
Copy link

Hi @mbsysde99 the error not appear when using MessageBoxButtons.OK button. Only visible when MessageBoxButtons.YesNo or MessageBoxButtons.AbortRetryIgnore. Please check again with this settings.

With MessageBoxButtons.YesNo

KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Error, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Exclamation, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Hand, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Information, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.None, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Question, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Stop, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.YesNo, icon: MessageBoxIcon.Warning, showCtrlCopy: false);

Results:
imageimageimageimageimageimageimageimageimage

With AbortRetryIgnore

KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Error, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Exclamation, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Hand, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Information, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.None, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Question, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Stop, showCtrlCopy: false);
KryptonMessageBox.Show("This is text", "This is caption", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Warning, showCtrlCopy: false);

imageimageimageimageimageimageimageimageimage

@mbsysde99
Copy link

mbsysde99 commented Nov 26, 2021

You do not fill in the value for the caption, so the display is truncated, the bug is there. Add space for caption will resolved your problem. Space like " " or "\u0020".

KryptonMessageBox.Show("This is text", "\u0020", buttons: MessageBoxButtons.AbortRetryIgnore , icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);

Or

KryptonMessageBox.Show("This is text", " ", buttons: MessageBoxButtons.AbortRetryIgnore , icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);

Result:
image

@PWagner1
Copy link
Contributor

You do not fill in the value for the caption, so the display is truncated, the bug is there. Add space for caption will resolved your problem. Space like " " or "\u0020".

KryptonMessageBox.Show("This is text", "\u0020", buttons: MessageBoxButtons.AbortRetryIgnore , icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);

Or

KryptonMessageBox.Show("This is text", " ", buttons: MessageBoxButtons.AbortRetryIgnore , icon: MessageBoxIcon.Asterisk, showCtrlCopy:false);

Result: image

Maybe a check to see if caption = string.Empty || "" || " " is needed

@mbsysde99
Copy link

mbsysde99 commented Nov 26, 2021

To fix the bug at the source see KryptonMessageBox.cs

private static DialogResult InternalShow(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, KryptonMessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, HelpInfo helpInfo, bool? showCtrlCopy)
{
	////////////////////////////////////////////////////////
	// add this to fixed bug
	caption = String.IsNullOrEmpty(caption) ? @" " : caption;
	////////////////////////////////////////////////////////

	IWin32Window showOwner = ValidateOptions(owner, options, helpInfo);

	// Show message box window as a modal dialog and then dispose of it afterwards
	using KryptonMessageBoxForm kmb = new(showOwner, text, caption, buttons, icon, defaultButton, options, helpInfo, showCtrlCopy);
	kmb.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent;

	return kmb.ShowDialog(showOwner);
}

private static DialogResult InternalShow(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, HelpInfo helpInfo, bool? showCtrlCopy)
{
	////////////////////////////////////////////////////////
	// add this to fixed bug
	caption = String.IsNullOrEmpty(caption) ? @" " : caption;
	////////////////////////////////////////////////////////

	IWin32Window showOwner = ValidateOptions(owner, options, helpInfo);

	// Show message box window as a modal dialog and then dispose of it afterwards
	using KryptonMessageBoxForm kmb = new(showOwner, text, caption, buttons, icon, defaultButton, options, helpInfo, showCtrlCopy);
	kmb.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent;

	return kmb.ShowDialog(showOwner);
}

Testing:

KryptonMessageBox.Show(text: "This is text", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Asterisk, showCtrlCopy: false);
KryptonMessageBox.Show(text: "This is text", caption: null, buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Asterisk, showCtrlCopy: false);
KryptonMessageBox.Show(text: "This is text", caption: "", buttons: MessageBoxButtons.AbortRetryIgnore, icon: MessageBoxIcon.Asterisk, showCtrlCopy: false);

Result:
image

@PWagner1 PWagner1 self-assigned this Nov 26, 2021
@PWagner1 PWagner1 added the in progress A fix for this issue is in the works. label Nov 26, 2021
@PWagner1 PWagner1 added this to the January 2022 milestone Nov 26, 2021
PWagner1 added a commit that referenced this issue Nov 26, 2021
@PWagner1 PWagner1 mentioned this issue Nov 26, 2021
Smurf-IV added a commit that referenced this issue Nov 26, 2021
@PWagner1 PWagner1 added completed This issue has been completed. fixed This issue has been fixed. and removed in progress A fix for this issue is in the works. labels Dec 5, 2021
@PWagner1 PWagner1 removed their assignment Dec 5, 2021
@PWagner1
Copy link
Contributor

PWagner1 commented Dec 5, 2021

Fixed in build 2201

@PWagner1 PWagner1 closed this as completed Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed This issue has been completed. fixed This issue has been fixed.
Projects
None yet
Development

No branches or pull requests

3 participants