Jimwel Anobong
Jimwel Anobong

Reputation: 486

Borderstyle of RectangleShape in C#

I've been programming an application in C# that requires a Visual Studio Powerpack's RectangleShape in one of its form. A problem suddenly came up. RectangleShape's BorderStyle contains no "none" option. I then chose "custom" as temporary solution and then set the borderWidth to 0 and it can't be? How am I able to set the borderstyle of the RectangleShape to be not enabled or not present at all?

Upvotes: 1

Views: 214

Answers (1)

Cee McSharpface
Cee McSharpface

Reputation: 8726

This is behavior by design. BorderStyle is a DashStyle.

The property is inherited from Shape. See documentation:

On the one hand,

For an OvalShape or RectangleShape control, BorderStyle represents the style of the shape itself when the BackStyle property is set to Transparent.

And on the other hand,

When the BackStyle property is set to Opaque, the BorderStyle represents the style of the outer edges of the shape.

The easiest solution in your case would probably be to use Solid and set the same color for border and background. If that is not your design goal, add more information to your question.

Upvotes: 3

Related Questions