开始使用Reports for WinForms > 打印和预览功能入门 > 添加文本 > 修改文本的字体和样式 |
C1PrintDocument 组件包含了一个RenderInLineText 方法用于渲染指定的字符串将其放在块状流动布局中(block flow),而无需创建一个新的段落。RenderInLineText 方法会自动将文本换行。本文展示了如何使用RenderInLineText 方法。
Visual Basic
Visual Basic |
拷贝代码
|
---|---|
Me.C1PrintDocument1.StartDoc() Me.C1PrintDocument1.RenderInlineText("With C1PrintDocument you can print ") |
C#
C# |
拷贝代码
|
---|---|
this.c1PrintDocument1.StartDoc(); this.c1PrintDocument1.RenderInlineText("With C1PrintDocument you can print "); |
Visual Basic
Visual Basic |
拷贝代码
|
---|---|
Me.C1PrintDocument1.RenderInlineText("Line by Line", New Font("Times New Roman", 30, FontStyle.Bold), Color.FromArgb(0, 0, 125)) Me.C1PrintDocument1.RenderInlineText(" and modify text attributes as you go.") |
C#
C# |
拷贝代码
|
---|---|
this.c1PrintDocument1.RenderInlineText("Line by Line", new Font("Times New Roman", 30, FontStyle.Bold), Color.FromArgb(0, 0, 125)); this.c1PrintDocument1.RenderInlineText(" and modify text attributes as you go."); |
Visual Basic
Visual Basic |
拷贝代码
|
---|---|
Me.C1PrintDocument1.RenderInlineText(" The text wraps automatically, so your life becomes easier.", Color.Green) |
C#
C# |
拷贝代码
|
---|---|
this.c1PrintDocument1.RenderInlineText(" The text wraps automatically, so your life becomes easier.", Color.Green); |
Visual Basic
Visual Basic |
拷贝代码
|
---|---|
Me.C1PrintDocument1.EndDoc() |
C#
C# |
拷贝代码
|
---|---|
this.c1PrintDocument1.EndDoc(); |
你的文本应该看起来和下图中的文本相似: