Forum Discussion

2 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You won't be able to change the colour like that. You'll have to create a name mapping for your colour  object or use coordinates instead.

  • KB1's avatar
    KB1
    Champion Level 2

     

    In TestComplete, you can use the "BackColor" property to set the background color of a button. To set the button color to red, you can use the following code:

     
    UserForms.AppMain.RunScript.Colors.BackColor = clRed;

    Note that "clRed" is a predefined constant in TestComplete that represents the color red.

    If you want to set the text color of the button, you can use the "ForeColor" property. For example:

     

    UserForms.AppMain.RunScript.Colors.ForeColor = clWhite;

     

    This will set the text color of the button to white.