We are trying to enable our application for high-DPI displays, and have run into a problem.
When using an AppStylist style, the width of the drop down button (and the associated image) are different in UltraTextEditor with a DropDownEditorButton than they are in the UltraCombo and UltraComboEditor. Even at 96 DPI, the widths are different, but not by much so not very noticeable. Under high DPI settings, the difference is much bigger and definitely noticeable.
The attached sample demonstrates the problem using the stock Office2007Blue.isl style sheet.
How can we correct this so that all the drop-down buttons appear the same width, and their drop-down arrow image appears the same size?
Hello Scott,
Thank you for the sample. The width of the builtin DropDown button of the UltraCombo/UltraComboEditor is determined based on the resolved DisplayStyle of the control. When the DisplayStyle resolves to Standard, the width of the button is equivalent to the width of the VerticalScrollbar. For all other DisplayStyles, the width is hardcoded at 14 pixels. All of the EditorButtons default to the VerticalScrollbar width, no matter the DisplayStyle. While this is done so that all of the EditorButtons have the same default width, I'm going to log an issue in our system so we can investigate the behavior further and determine if the DropDownEditorButton should have it's size match the built in DropDown buttons when the DisplayStyle is changed. I'll provide further information regarding the logged issue in a support case created for you.
In the meantime, the DropDownEditorButton has a Width property that can be set to 14 to force it to match the width of the other dropdown buttons.
Let me know if you have any questions.
We had a number of discussions among the engineering staff about what how the DropDownEditorButton should be sized by default. In the end, we came to the conclusion, that we'd prefer the width of the DropDownEditorButton matches the width of the EditorButtons, instead of attempting the match the DropDownButton.
In any case, the workaround to get the DropDownEditorButton to match the DropDownButton (setting the Width property to 14) is pretty straightforward.
Hi Chris,
We have been running into the same problem. We have observed if the UltraCombo/UltraComboEditor is set to Standard and AppStyling is not activated the width of the DropDownEditorButton does follow to the width of the VerticalScrollbar. But if AppStyling is activated, the width of the DropDownEditorButton is 14 pixels. Our customers are more and more using 4K displays and therefore we please need to have a workaround for this. If we could overwrite the width of the DropDownEditorButton at runtime it would help a lot.
Thank you very much indeed.
Best regards Frank
This is an image cut from a camera dialog.
I will install the next official service pack after it is released. Thank you very much for your quick answer.
Hey Frank,
We have already addressed this issue internally in versions 2017.1 and 2017.2. So as long as you have a registered key, we can send you a link to the private patch with the fix. Simply create a new support case, referencing this forum thread, and we'll go from there.
As far as a workaround goes, the best option I foresee is simply replacing the existing DropDownButton of the UltraCombo/UltraComboEditor, with a DropDownEditorButton in the ButtonsRight collection. The editor buttons have a Width property that you can set once you determine the DPI. The following code works well in my sample:
private float scalingFactor;
private void Form1_Load(object sender, EventArgs e)
{
using (Bitmap bmp = new Bitmap(1, 1))
using (Graphics g = Graphics.FromImage(bmp))
scalingFactor = g.DpiX / 96f;
}
this.ReplaceDropDownButton(this.ultraComboEditor1);
this.ReplaceDropDownButton(this.ultraCombo1);
private void ReplaceDropDownButton(UltraComboEditor comboEditor)
comboEditor.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never;
var newButton = new DropDownEditorButton();
newButton.Width = (int)(EditorWithComboDropDownButtonUIElement.defaultDropDownButtonWidth * scalingFactor);
newButton.Click += (p1, p2) =>
comboEditor.DropDown();
};
comboEditor.ButtonsRight.Add(newButton);
private void ReplaceDropDownButton(UltraCombo combo)
combo.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never;
combo.PerformAction(UltraComboAction.Dropdown);
combo.ButtonsRight.Add(newButton);
Let me know if you have any questions,
Chris