应用对 System.Drawing.Font 对象所做的更改。
[Visual Basic]
Public Overrideable Sub ApplyFont( _ ByVal value As System.Drawing.Font _ )
[C#]
public virtual void ApplyFont(
System.Drawing.Font value
);
参数
- value
包含 TextObject 的字体设置。
示例
下面的示例设置 TextObject 的字体和颜色。方法按名称由 ReportObjects 集合获取 ReportObject 并将其转换为 TextObject。然后,方法将由字体对话框设定的设置应用到该 TextObject,并将 TextObject 的颜色设置为蓝色。
[VJ#]
private void setFont(String reportObjectName)
{
TextObject text;
FontDialog fieldFont = new FontDialog();
try
{
text = (TextObject)Report.get_ReportDefinition()
.get_ReportObjects().get_Item(reportObjectName);
}
catch (Exception e)
{
return;
}
if ( fieldFont.ShowDialog() == DialogResult.OK )
{
text.ApplyFont( fieldFont.get_Font() );
text.set_Color( Color.get_Blue() );
}
}
[Visual Basic]
Public Sub SetFont(ByVal reportObjectName As String)
Dim text As TextObject
Dim fieldFont As New FontDialog()
If TypeOf _
(Report.ReportDefinition.ReportObjects. _
Item(reportObjectName)) Is TextObject Then
text = _
Report.ReportDefinition.ReportObjects. _
Item(reportObjectName)
If fieldFont.ShowDialog() = DialogResult.OK Then
text.ApplyFont(fieldFont.Font)
text.Color = Color.Blue
End If
End If
[C#]
private void SetFont(string reportObjectName)
{
TextObject text;
FontDialog fieldFont = new FontDialog();
text = Report.ReportDefinition.ReportObjects[reportObjectName]
as TextObject;
if (text!= null)
{
if (fieldFont.ShowDialog() == DialogResult.OK)
{
text.ApplyFont(fieldFont.Font);
text.Color = Color.Blue;
}
}
}
要求
命名空间 CrystalDecisions.CrystalReports.Engine
程序集 CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)
请参见
TextObject 类 | TextObject 成员 | CrystalDecisions.CrystalReports.Engine 命名空间
©2005 Business Objects SA 保留所有权利。
| Business Objects SA http://www.china.businessobjects.com/ 支持服务 http://www.china.businessobjects.com/ |