Search code examples
delphibuttonbordertms-web-coreborder-color

How do I change the border color on a TWebButton component?


I'm able to change the button's background color using the Color property on the component, but I don't see a property to change the border color.

You can see here that the button has a border, but I'm not sure how to change the border color in Delphi:

Delphi TWebButton


Solution

  • There doesn't seem to be a property to change this in design-time, So you'll have to change it dynamically during run-time.

    In the OnCreate event of the form, you can write:

    WebButton1.ElementHandle.style.setProperty('border-color', 'red');
    

    The first parameter, you pass in the border-color CSS property, and the second parameter you pass in the HTML Color:

    Delphi TWebButton with red border