I have the below code, which works, to draw a border around a control in a WinForm 3.5 app.
What I can't figure out is how to THICKEN the border that is being drawn. I tried Inflate(5,5)
on the ClientRectangle
but that actually made the Border disappear all together versus making it thicker.
I get the impression that I actually need to be working with e.Graphics
to accomplish开发者_StackOverflow this but I can't, for the life of me, figure out how.
Ideas?
ControlPaint.DrawBorder(
e.Graphics, datImmunizationRecieved.ClientRectangle, Color.OrangeRed, ButtonBorderStyle.Solid);
The Answer in Action for future reference
Below is how I implemented the same Method but overloaded(note: these are both inside a Paint_Event)
var borderColor = Color.FromArgb(173, 216, 230);
var borderStyle = ButtonBorderStyle.Solid;
var borderWidth = 3;
ControlPaint.DrawBorder(
e.Graphics,
lkuNOImmunizationReason.ClientRectangle,
borderColor,
borderWidth,
borderStyle,
borderColor,
borderWidth,
borderStyle,
borderColor,
borderWidth,
borderStyle,
borderColor,
borderWidth,
borderStyle);
There's an overload for that method that allows you to specify the width for all of the sides -- http://msdn.microsoft.com/en-us/library/616fkc53.aspx
精彩评论