简体   繁体   English

我怎样才能得到drawingcontext来用笔画画recatangle

[英]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.DrawRectangleDawingContext.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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM