[英]How can i get drawingcontext to draw recatangle with strokes
I need to draw a dashed rectangle on selection of items in an itemcontrol.I am looking for a way to draw a rectangle by DrawingContext
.We have got DrawingContext.DrawRectangle
and DawingContext.DrawRoundedRectangle
.But How can we give the properties like Stroke and StrokeDashArray of the Rectangle我需要在 itemcontrol 中选择项目时绘制一个虚线矩形。我正在寻找一种通过
DrawingContext
绘制矩形的方法。我们有DrawingContext.DrawRectangle
和DawingContext.DrawRoundedRectangle
。但是我们怎样才能给出像 Stroke 和 StrokeDashArray 这样的属性矩形的
When you call DrawingContext.DrawRectangle
you should specify the Pen pen
parameter which is used to draw stroke.当您调用
DrawingContext.DrawRectangle
时,您应该指定用于绘制笔划的Pen pen
参数。 So you can create the Pen
instance and set the Pen.DashStyle
property.因此,您可以创建
Pen
实例并设置Pen.DashStyle
属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.