This is a migrated thread and some comments may be shown as answers.

Arrow size

2 Answers 368 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 03 Nov 2015, 02:00 PM

Hello, is there a way to change the arrow size of a radpopupeditor ?

I tried the following, that changes the dropdown button size but I cannot find a way to edit the arrow size, the problem is that (on windows 10, 4k monitor, 200dpi screen) the arrow is almost invisible.

radPopupEditor1.PopupEditorElement.ArrowButtonElement.Size = getSizeByUnit(4.5F,6.35F); <--this works
radPopupEditor1.PopupEditorElement.ArrowButtonElement.Arrow.Size = getSizeByUnit(2, 2); <--no effect.

Best regards

Andrea

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Nov 2015, 12:39 PM
Hello Andrea,

Thank you for writing.

Note that RadDropDownList uses an arrow image. In order to increase the arrow size, you can hide the image and display the arrow primitive. Please refer to the following code snippet:
this.radDropDownList1.DropDownListElement.ArrowButton.Arrow.Visibility = Telerik.WinControls.ElementVisibility.Visible;
ImagePrimitive imagePrimitive = this.radDropDownList1.DropDownListElement.ArrowButton.FindDescendant<ImagePrimitive>();
if (imagePrimitive != null)
{
    imagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
}
this.radDropDownList1.DropDownListElement.ArrowButton.Arrow.Size = new Size(14, 10);

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andrea
Top achievements
Rank 1
answered on 05 Nov 2015, 08:47 AM

Hi Dess, thank you very much, that is working:

 

float dpiX;
float pixelPerUnit;
 
int getPixelByUnit(float units)
{
    return (int)(units * pixelPerUnit + 0.5);
}
Size getSizeByUnit(float xunits, float yunits)
{
    return new Size((int)(xunits * pixelPerUnit + 0.5), (int)(yunits * pixelPerUnit + 0.5));
}
 
private void ScaleToCurrentDPI()
{           
    using (Graphics graphics = this.CreateGraphics())
    {
        dpiX = graphics.DpiX;
    }
    pixelPerUnit = dpiX / 25.4F;//millimeters unit
             
    radPopupEditor1.Font = Font;
    radPopupEditor1.PopupEditorElement.ArrowButtonElement.AutoSize = false;
    radPopupEditor1.PopupEditorElement.ArrowButtonElement.Size = getSizeByUnit(4.5F,6.35F);
    radPopupEditor1.PopupEditorElement.ArrowButtonElement.Arrow.Visibility = Telerik.WinControls.ElementVisibility.Visible;
    ImagePrimitive imagePrimitive = radPopupEditor1.PopupEditorElement.ArrowButtonElement.FindDescendant<ImagePrimitive>();
    if (imagePrimitive != null)
    {
        imagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
    }
    radPopupEditor1.PopupEditorElement.ArrowButtonElement.Arrow.Size = getSizeByUnit(2.117F, 1.058F);
}

Thank you very much for your help.

Andrea

Tags
DropDownList
Asked by
Andrea
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or