CustomControl does not contain a definition for BackColor

Posted by: sam.boustani on 28 May 2021, 6:59 am EST

  • Posted 28 May 2021, 6:59 am EST

    After upgrading ActiveReports from v11 to v15, the CustomControl.Control object no longer has a BackColor property.

    CustomControl customControl = new CustomControl(typeof(System.Windows.Forms.Panel));

    customControl.Control.BackColor = …

    What has changed and how do I access the BackColor of this object in v15?

  • Posted 30 May 2021, 4:35 pm EST

    Hello,

    Can you change the BackColor using the following code:

    Panel Panel1 = (Panel) customControl.Control;

    Panel1.BackColor= Color.Redl

    Thanks,

    Mohit

  • Posted 1 June 2021, 1:42 am EST

    Thank you. Here is the full code. I’m trying to set it to another controls BackColor

    if (a_control is CustomControl)
                {
                   CustomControl control = (CustomControl)a_control;
                   CustomControl customControl = new CustomControl(typeof(System.Windows.Forms.Panel));
                   customControl.Control.BackColor = control.Control.BackColor;
    
                   newControl = customControl;
                }
    

    This conversion works

    Panel panel1 = (Panel)customControl.Control;

    However, I still can’t set it to the other control’s BackColor because that conversion does not work, or I’m not sure how to do that conversion.

    panel1.BackColor = control.Control.BackColor;
    
  • Posted 1 June 2021, 4:10 pm EST

    Hello,

    Can you try after using the following code:

    Control ctr= (Control)control.Control;

    panel1.BackColor = ctr.BackColor;

    If issue still reproducible, please share the sample with us.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels