首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带圆角的MigraDoc桌子

带圆角的MigraDoc桌子
EN

Stack Overflow用户
提问于 2014-07-05 00:50:36
回答 2查看 1.4K关注 0票数 2

如何为桌子设置圆角?我使用的是c#和MigraDoc。

代码语言:javascript
复制
MigraDoc.DocumentObjectModel.Tables.Table myTable = section.AddTable();
myTable.Borders.Visible = true;
MigraDoc.DocumentObjectModel.Tables.Column myColumn = myTable.AddColumn();
MigraDoc.DocumentObjectModel.Tables.Row myRow = myTable.AddRow();
myRow[0].AddParagraph("Some text");
EN

回答 2

Stack Overflow用户

发布于 2014-12-09 19:43:25

PdfSharp可以做到。对MigraDoc不太确定。

http://www.nudoq.org/#!/Packages/PDFsharp-MigraDoc-GDI/PdfSharp/XGraphicsPath/M/AddRoundedRectangle

http://www.nudoq.org/#!/Packages/PDFsharp-MigraDoc-GDI/PdfSharp/XGraphics/M/DrawRoundedRectangle

票数 1
EN

Stack Overflow用户

发布于 2020-01-07 20:22:43

MigraDoc表单元格具有RoundedCorner属性。

我现在没有时间创建一个功能齐全的示例,但是AIUI您必须在顶部和底部添加虚拟行,以及在左侧和右侧添加虚拟列,以便为圆角腾出空间。您必须设置单元格底纹,以查看圆角的效果。而且这些圆角很可能只适用于PDF,而不适用于RTF。

显示如何使用属性的代码片段:

代码语言:javascript
复制
public static void SetRoundedCorners(Table table)
{
    int rowCount = table.Rows.Count;
    int colCount = table.Columns.Count;

    if (rowCount < 2 || colCount < 2)
        return;

    table.Rows[0].Cells[0].RoundedCorner = RoundedCorner.TopLeft;
    table.Rows[0].Cells[colCount - 1].RoundedCorner =  RoundedCorner.TopRight;
    table.Rows[rowCount - 1].Cells[colCount - 1].RoundedCorner =  RoundedCorner.BottomRight;
    table.Rows[rowCount - 1].Cells[0].RoundedCorner =  RoundedCorner.BottomLeft;
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24578421

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档