| PowerTools ActiveReports for .NET 11.0J > ActiveReportsユーザーガイド > よくある質問 > 共通の項目(ページレポート、RDLレポートとセクションレポート) > エンドユーザーデザイナ |
開いたファイルの名前を取得する(Professionalのみ)
RPXファイルのファイル名を取得するには、ExecuteActionメソッドを使用せずに、フォーム上に追加したOpenFileDialogコントロールを使用して、RPXファイルを読み込むことで実現が可能です。開かれたファイル名は、OpenFileDialogコントロールのFileNameプロパティにセットされます。
Visual Basic
| Visual Basicコード |
コードのコピー
|
|---|---|
OpenFileDialog1.Filter = "Reports (*.rpx)|*.rpx" If (OpenFileDialog1.ShowDialog() = DialogResult.OK) Then Me.Designer1.LoadReport(OpenFileDialog1.FileName) End If |
|
C#
| C#コード |
コードのコピー
|
|---|---|
this.openFileDialog1.Filter = "Reports (*.rpx)|*.rpx";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
this.designer1.LoadReport(openFileDialog1.FileName);
}
|
|
ツールボックスからレポートアイテムを削除したい、レポートアイテムの名前を変更したい(Professionalのみ)
Visual Basic
| Visual Basicコード |
コードのコピー
|
|---|---|
' ツールボックスの項目を削除します。
Dim item As System.Drawing.Design.ToolboxItem
For Each item In Me.arToolbox.GetToolboxItems("ActiveReports 11")
Me.arToolbox.RemoveToolboxItem(item)
Next
' ツールオックスに項目を追加します。
Dim arTool As System.Drawing.Design.ToolboxItem
' (テキストボックス)
arTool = New System.Drawing.Design.ToolboxItem(GetType(System.Windows.Forms.TextBox))
arTool.DisplayName = "テキストボックス"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (画像)
arTool = New System.Drawing.Design.ToolboxItem(GetType(Picture))
arTool.DisplayName = "画像"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (線)
arTool = New System.Drawing.Design.ToolboxItem(GetType(Line))
arTool.DisplayName = "線"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (チェックボックス)
arTool = New System.Drawing.Design.ToolboxItem(GetType(System.Windows.Forms.CheckBox))
arTool.DisplayName = "チェックボックス"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (バーコード)
arTool = New System.Drawing.Design.ToolboxItem(GetType(Barcode))
arTool.DisplayName = "バーコード"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (リッチテキストボックス)
arTool = New System.Drawing.Design.ToolboxItem(GetType(System.Windows.Forms.RichTextBox))
arTool.DisplayName = "リッチテキストボックス"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
' (グラフ)
arTool = New System.Drawing.Design.ToolboxItem(GetType(ChartControl))
arTool.DisplayName = "グラフ"
Me.arToolbox.AddToolboxItem(arTool, "ActiveReports 11")
|
|
C#
| C#コード |
コードのコピー
|
|---|---|
// ツールボックス項目を削除します。
foreach (System.Drawing.Design.ToolboxItem item in this.arToolbox.GetToolboxItems("ActiveReports 11"))
{
this.arToolbox.RemoveToolboxItem(item);
}
// ツールボックスに項目を追加します。
System.Drawing.Design.ToolboxItem arTool;
// (テキストボックス)
arTool = new System.Drawing.Design.ToolboxItem(typeof(GrapeCity.ActiveReports.SectionReportModel.TextBox));
arTool.DisplayName = "テキストボックス";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (画像)
arTool = new System.Drawing.Design.ToolboxItem(typeof(Picture));
arTool.DisplayName = "画像";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (線)
arTool = new System.Drawing.Design.ToolboxItem(typeof(Line));
arTool.DisplayName = "線";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (チェックボックス)
arTool = new System.Drawing.Design.ToolboxItem(typeof(GrapeCity.ActiveReports.SectionReportModel.CheckBox));
arTool.DisplayName = "チェックボックス";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (バーコード)
arTool = new System.Drawing.Design.ToolboxItem(typeof(Barcode));
arTool.DisplayName = "バーコード";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (リッチテキストボックス)
arTool = new System.Drawing.Design.ToolboxItem(typeof(GrapeCity.ActiveReports.SectionReportModel.RichTextBox));
arTool.DisplayName = "リッチテキストボックス";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
// (グラフ)
arTool = new System.Drawing.Design.ToolboxItem(typeof(ChartControl));
arTool.DisplayName = "グラフ";
this.arToolbox.AddToolboxItem(arTool, "ActiveReports 11");
|
|
コードから変更した内容をデザイナに反映させる(Professionalのみ)
Designerコントロールでコード上から編集中のレポートを変更しても、デザイナ上にその内容が正しく反映されません。例えば、PrintWidthプロパティをコードから変更した場合、デザイナの表示が更新されません。
これは、デザイナの表示は通常、OnComponentChangingまたはOnComponentChangedイベント発生時に有効になりますが、PrintWidthプロパティをコードから直接変更した場合にはこれらのイベントが発生しないためです。
コードから変更したPrintWidthの値をデザイナに反映させるには、以下のようにPropertyDescriptor.SetValue()メソッドを使用します。
Visual Basic
| Visual Basicコード |
コードのコピー
|
|---|---|
Dim p As System.ComponentModel.PropertyDescriptor = System.ComponentModel.TypeDescriptor.GetProperties(Me.arDesigner.Report).Item("PrintWidth")
p.SetValue(Me.arDesigner.Report, 5.0F)
|
|
C#
| C#コード |
コードのコピー
|
|---|---|
System.ComponentModel.PropertyDescriptor p = System.ComponentModel.TypeDescriptor.GetProperties(this.arDesigner.Report)["PrintWidth"]; p.SetValue(this.arDesigner.Report, 5f); |
|