RadPanel, gradient fill. Not working?

1 Answer 104 Views
Panel
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Iron
Czeshirecat asked on 12 Dec 2022, 01:58 PM

Winforms, c#, version 2022.3.1109.40,

I know it must be me, but I'm testing gradient fill on a radpanel, but theres no change in appearance at either design or run time

Here's my extract from the designer file. GradientFill is set to linear which is the default.

private void InitializeComponent()
    {
      this.radPanel2 = new Telerik.WinControls.UI.RadPanel();
      ((System.ComponentModel.ISupportInitialize)(this.radPanel2)).BeginInit();
      this.SuspendLayout();
      //
      // radPanel2
      //
      this.radPanel2.Location = new System.Drawing.Point(112, 57);
      this.radPanel2.Name = "radPanel2";
      this.radPanel2.Size = new System.Drawing.Size(218, 107);
      this.radPanel2.TabIndex = 1;
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(241)))), ((int)(((byte)(79)))));
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(238)))), ((int)(((byte)(155)))), ((int)(((byte)(64)))));
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(74)))), ((int)(((byte)(228)))), ((int)(((byte)(243)))));
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).NumberOfColors = 4;
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).GradientStyle = Telerik.WinControls.GradientStyles.Linear;
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).PaintUsingParentShape = false;
      ((Telerik.WinControls.Primitives.FillPrimitive)(this.radPanel2.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(244)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
      //
      // Form1
      //
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(800, 450);
      this.Controls.Add(this.radPanel2);
      this.Name = "Form1";
      this.Text = "Form1";
      ((System.ComponentModel.ISupportInitialize)(this.radPanel2)).EndInit();
      this.ResumeLayout(false);

    }

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Dec 2022, 02:30 PM

Hello, Claire,  

Following the provided code snippet, I have prepared a sample code snippet for your reference. The different colors are specified by using only the RGB values: 

        public RadForm1()
        {
            InitializeComponent();

            this.radPanel1.PanelElement.PanelFill.Visibility = ElementVisibility.Visible;
            this.radPanel1.PanelElement.PanelFill.GradientStyle = GradientStyles.Linear;
            this.radPanel1.PanelElement.PanelFill.NumberOfColors = 4;
            this.radPanel1.PanelElement.PanelFill.BackColor2 = Color.FromArgb(198,241,79);
            this.radPanel1.PanelElement.PanelFill.BackColor3 = Color.FromArgb(238, 155, 64);
            this.radPanel1.PanelElement.PanelFill.BackColor4 = Color.FromArgb(74,228, 243);
            this.radPanel1.PanelElement.PanelFill.BackColor =  Color.FromArgb(244,32,32);
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Panel
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or