TextObject.ApplyFont 方法
套用對 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 All rights reserved
Business Objects SA http://www.china.businessobjects.com/ 支援的服務 http://www.china.businessobjects.com/BOindex/support/ |