Button background color

Cringer

ProgressTalk.com Moderator
Staff member
I'm fairly sure the colour of buttons is taken from the environment settings of the OS. It's not an attribute you have direct control over as far as I know. You can probably work around it by using image overlays, but it's not ideal, or particularly neat.
 

Stefan

Well-Known Member
Use the BackColor property.

Code:
USING Progress.Lang.*.
USING Progress.Windows.Form.



CLASS button INHERITS Form: 
   
    DEFINE PRIVATE VARIABLE button1 AS System.Windows.Forms.Button NO-UNDO.
    DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO.

       
    CONSTRUCTOR PUBLIC button (  ):
       
       
        SUPER().
        InitializeComponent().
        THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.

    END CONSTRUCTOR.

    METHOD PRIVATE VOID InitializeComponent(  ):
       
        /* NOTE: The following method is automatically generated.
       
        We strongly suggest that the contents of this method only be modified using the
        Visual Designer to avoid any incompatible modifications.
       
        Modifying the contents of this method using a code editor will invalidate any support for this file. */
        THIS-OBJECT:button1 = NEW System.Windows.Forms.Button().
        THIS-OBJECT:SuspendLayout().
        /*  */
        /* button1 */
        /*  */
        THIS-OBJECT:button1:BackColor = System.Drawing.Color:Red.
        THIS-OBJECT:button1:Font = NEW System.Drawing.Font("Microsoft Sans Serif", Progress.Util.CastUtil:ToSingle(24), System.Drawing.FontStyle:Bold, System.Drawing.GraphicsUnit:Point, System.Convert:ToByte(0)).
        THIS-OBJECT:button1:ForeColor = System.Drawing.Color:White.
        THIS-OBJECT:button1:Location = NEW System.Drawing.Point(13, 13).
        THIS-OBJECT:button1:Name = "button1".
        THIS-OBJECT:button1:Size = NEW System.Drawing.Size(267, 241).
        THIS-OBJECT:button1:TabIndex = 0.
        THIS-OBJECT:button1:Text = "Panic!".
        THIS-OBJECT:button1:UseCompatibleTextRendering = TRUE.
        THIS-OBJECT:button1:UseVisualStyleBackColor = FALSE.
        /*  */
        /* button */
        /*  */
        THIS-OBJECT:ClientSize = NEW System.Drawing.Size(292, 266).
        THIS-OBJECT:Controls:Add(THIS-OBJECT:button1).
        THIS-OBJECT:Name = "button".
        THIS-OBJECT:Text = "".
        THIS-OBJECT:ResumeLayout(FALSE).
        CATCH e AS Progress.Lang.Error:
            UNDO, THROW e.
        END CATCH.
    END METHOD.

    DESTRUCTOR PUBLIC button ( ):

    END DESTRUCTOR.

END CLASS.
 
Top