Arrow size

3 posts, 1 answers
  1. Andrea
    Andrea avatar
    52 posts
    Member since:
    Oct 2012

    Posted 03 Nov 2015 Link to this post

    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. Answer
    Dess
    Admin
    Dess avatar
    1609 posts

    Posted 04 Nov 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Andrea
    Andrea avatar
    52 posts
    Member since:
    Oct 2012

    Posted 05 Nov 2015 in reply to Dess Link to this post

    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

Back to Top