How to set the RadDropDownButton fontcolor

4 posts, 0 answers
  1. Wen
    Wen avatar
    1 posts
    Member since:
    Jun 2012

    Posted 05 Jun 2014 Link to this post

    I am trying to set the RadDropDownButton font color by programming by setting  this.btnActionOfDeviceTask.ForeColor,but the font color does change at all, is there the way to set the font color?
                // 
                // btnActionOfDeviceTask
                // 
                this.btnActionOfDeviceTask.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
                this.btnActionOfDeviceTask.Items.AddRange(new Telerik.WinControls.RadItem[] { 
                this.btnEnableDeviceofTask,
                this.btnDisableDeviceOfTask}
                );
                this.btnActionOfDeviceTask.Location = new System.Drawing.Point(310, 7);
                this.btnActionOfDeviceTask.Name = "btnActionOfDeviceTask";
                this.btnActionOfDeviceTask.Text = "Edit task state";
                this.btnActionOfDeviceTask.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular);
                this.btnActionOfDeviceTask.ForeColor = System.Drawing.Color.FromArgb(21, 66, 139);
                this.btnActionOfDeviceTask.BackColor = System.Drawing.Color.Transparent; 
                this.btnActionOfDeviceTask.Size = new System.Drawing.Size(136, 24);
                this.btnActionOfDeviceTask.TabIndex = 77;
                this.btnActionOfDeviceTask.Enabled = false;
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 06 Jun 2014 Link to this post

    Hi Wen,

    Thank you for writing.

    To change the font of the text box area of the control, you should use the Font property of the control:
    Font f = new Font("Arial", 17);
    radDropDownList1.Font = f;

    To change the font in the drop down, you need to use the VisualItemFormatting event:
    void radDropDownList1_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
    {
        args.VisualItem.Font = f;
    }
     
    Font f = new Font("Arial", 17);

    If needed you can also use the AutoSizeItems property of the control, in order to allow them to size themselves according to the currently used font.

    More information about the items formatting is available here: http://www.telerik.com/help/winforms/dropdown-and-listcontrol-dropdownlist-customizing-items.html.

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ryan
    Ryan avatar
    1 posts
    Member since:
    Jun 2014

    Posted 24 Jun 2014 Link to this post

    I just downloaded the demo for WinForms control put a RadDropDownButton on a form and used the designer to change the font property size to 16 points.

    Whether in the designer or at runtime, the font size on the button does not change.

    What am I missing?
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Jun 2014 Link to this post

    Hi Ryan,

    Thank you for writing.

    It seems that in my previous post I mixed RadDropDownButton with RadDropDownList. Here is how to set the Font of the former:
    button.DropDownButtonElement.ActionButton.Font = new Font("Arial", 18);

    I have also added a feedback item for this, in order to allow font change via the Font property of the control: http://feedback.telerik.com/Project/154/Feedback/Details/131922.

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top