我正在使用DrawingContext.DrawLine函数来画线。但看起来线条会影响画布上其他线条的位置。所以我需要为所有行添加不同的 z-index 值。有什么方法可以绘制具有不同 z-index 的线,这样它们就不会影响其他线的位置。或者是否有其他方法可用于绘制线条,例如绘制文本,我已将DrawText方法替换为TextBlock.
以下是我现在正在使用的示例代码:
DrawingGroup dGroup = new DrawingGroup();
DrawingContext dc = dGroup.Open()
dc.DrawLine(penScaleMarker, new Point((float)newPointX, (float)newPointY), new Point((float)newMinorEndX, (float)newMinorEndY));
Run Code Online (Sandbox Code Playgroud)