Completed
Last Updated: 06 Jun 2014 13:50 by ADMIN
ADMIN
George
Created on: 02 Apr 2014 11:51
Category: Editors
Type: Bug Report
1
FIX. RadDateTimePicker - The DropDown is not resized according to the DPI settings
To reproduce:

Add a RadDateTimePicker to a form,  set your DPI settings to 150% (you will need to re-log from windows), open the form and click the arrow of the RadDateTimePicker to show the dropdown. You will notice that the dropdown is not being scaled accordingly.

Workaround:

Subscribe to the PropertyChanged event of RadDateTimePicker and scale the dropdown manually:

Size initialPopupSize;
RadDateTimePicker dateTimePicker;
void DateTimePickerElement_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName == "IsDropDownShown")
    {
        RadDateTimePickerCalendar calendar = dateTimePicker.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
        if (calendar.PopupControl.MinimumSize != initialPopupSize && initialPopupSize != Size.Empty)
        {
            return;
        }

        float scale = 0;
        float dpi = this.CreateGraphics().DpiX;

        if (dpi == 96)
        {
            scale = 1f;
        }
        else if (dpi == 120)
        {
            scale = 1.25f;
        }
        else if (dpi == 144)
        {
            scale = 1.5f;
        }
        else if (dpi == 192)
        {
            scale = 2f;
        }

        Size popupSize = calendar.PopupControl.Size;
        Size newSize = new Size((int)(popupSize.Width * scale), (int)(popupSize.Height * scale));
        calendar.PopupControl.MinimumSize = newSize;
        initialPopupSize = popupSize;
    }
}


0 comments