Alex Rivera | Logout

How would I change the border color of a button?

Asked 2011-11-23T15:32:27.087
41

This is my code:

buttonName = "btn" + y.ToString() + x.ToString();
Control btn = this.Controls.Find(buttonName, true)[0] as Control;
btn.BackColor = System.Drawing.Color.Blue;

However, I see no border color changing properties, or the like.

I used this code because I have a lot of buttons on my form, and any of those buttons' properties can change, so rather than call them out individually, I just made up that code which could handle them.

Is there a code similar to the one above, that would allow me to change the border color of the button?

Edit
Report

1 Answer

4

Depending on your framework there is a new property called BorderColor

http://msdn.microsoft.com/en-us/library/system.windows.forms.flatbuttonappearance.bordercolor.aspx,

Have you checked that?

Also here is an example of something similar

Change border color of Windows Forms Control on focus

answered 2011-11-23T15:39:34.727

Your Answer