private void SetBounds(FpSpread fpSpread, LineShape lineShape) { Rectangle startCellRectangle = GetCellRectangle(fpSpread, startCellRow + rowOffset, startCellColumn); Rectangle endCellRectangle = GetCellRectangle(fpSpread, endCellRow + rowOffset, endCellColumn); int x = startCellRectangle.X; int y = startCellRectangle.Y; int width = endCellRectangle.Right - startCellRectangle.Left; int height = endCellRectangle.Bottom - startCellRectangle.Top; lineShape.SetBounds(x, y, width, height); if (bevelLineType == BevelLineType.Up) { lineShape.SetBounds(x, y + height, width, height); float tan = (float)height / (float)width; double rotate = Math.Atan2(height, width) * 180 / Math.PI; lineShape.Rotate(lineShape.Location, -2 * (float)rotate); } }