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

How to set the RadDropDownButton fontcolor

3 Answers 218 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Wen
Top achievements
Rank 1
Wen asked on 05 Jun 2014, 09:58 AM
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;

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 06 Jun 2014, 07:50 AM
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.
 
0
Ryan
Top achievements
Rank 1
answered on 24 Jun 2014, 09:38 PM
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?
0
Stefan
Telerik team
answered on 25 Jun 2014, 08:40 AM
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.
 
Tags
Wizard
Asked by
Wen
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or