单元格中画线实现交叉报表样式
问题描述:在单元格中画线,实现交叉报表功能问题解答:通过 CustomDrawingObject 来在单元格中绘制
关键代码:
Canvas canvas = new Canvas();
Line diagonalLine1 = new Line();
diagonalLine1.Stroke = cellForeground;
diagonalLine1.StrokeThickness = 1;
diagonalLine1.X1 = 0;
diagonalLine1.Y1 = height / 3;
diagonalLine1.X2 = width;
diagonalLine1.Y2 = height;
Line diagonalLine2 = new Line();
diagonalLine2.Stroke = cellForeground;
diagonalLine2.StrokeThickness = 1;
diagonalLine2.X1 = width / 3;
diagonalLine2.Y1 = 0;
diagonalLine2.X2 = width;
diagonalLine2.Y2 = height;
canvas.Children.Add(diagonalLine1);
canvas.Children.Add(diagonalLine2);
效果截图:
示例下载:
页:
[1]