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

How to change RadForm background gradient at runtime?

1 Answer 252 Views
Form
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 04 May 2012, 09:10 PM
Hello,

Is there anyway i can change the background gradient of a RadForm at runtime? If so, how can i do it?

I have multiple forms, and some of them will have different gradients, so i would to be able to change the gradients at runtime so i don't have to create a ton of different theme files for each form.

Please let me know if this is possible.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 May 2012, 02:24 PM
Hi Mark,

Thank you for writing.

The form itself cannot have gradients. It can only have its BackColor set. However, you can easily achieve gradients as form's back color, by docking a panel in the form (which support gradients) and use it as controls container. Here is a sample:
RadPanel panel = new RadPanel();
panel.Dock = DockStyle.Fill;
this.Controls.Add(panel);
  
panel.PanelElement.PanelFill.BackColor = Color.Red;
panel.PanelElement.PanelFill.BackColor2 = Color.Blue;
panel.PanelElement.PanelFill.BackColor3 = Color.Yellow;
panel.PanelElement.PanelFill.BackColor4 = Color.Green;
panel.PanelElement.PanelFill.NumberOfColors = 4;
panel.PanelElement.PanelFill.GradientStyle = Telerik.WinControls.GradientStyles.Linear;

I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Form
Asked by
Mark
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or