'宣言 Public Class NamedReference Inherits Infragistics.Shared.KeyedSubObjectBase Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.CalcEngine.IFormulaProvider
public class NamedReference : Infragistics.Shared.KeyedSubObjectBase, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.CalcEngine.IFormulaProvider
NamedReference は関連付けられたコントロールがない計算ネットワーク内の参照です。
NamedReference を Formula で作成し、定数を他の計算で使用するために作成できます。または、画面に表示する必要はないが、コードや他の計算で使用できる計算結果を保存します。
NamedReference の計算済みの値を取得するために、FormulaResult プロパティで使用します。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports Infragistics.Win.CalcEngine Imports Infragistics.Win.UltraWinCalcManager Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click Me.UltraCalcManager1.NamedReferences.Clear() ' Add two named references named N1 and N2. N2 multiplies the value of ' N1 by 2. Me.UltraCalcManager1.NamedReferences.Add("N1", "5") Me.ultraCalcManager1.NamedReferences.Add("N2", "2 * [N1]") End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click ' Change the value of N1 from 5 to 20. This will cause the N2 to get ' recalculated and NamedReferenceResultChanged will be raised. Me.UltraCalcManager1.NamedReferences("N1").Formula = "20" End Sub Private Sub UltraCalcManager1_NamedReferenceResultChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinCalcManager.NamedReferenceResultChangedEventArgs) Handles ultraCalcManager1.NamedReferenceResultChanged System.Diagnostics.Debug.WriteLine(e.NamedReference.Key _ & " named reference got calculated. It's TypeOf value is " _ & e.NamedReference.FormulaResult.ToDouble()) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; using Infragistics.Win.CalcEngine; using Infragistics.Win.UltraWinCalcManager; private void button1_Click(object sender, System.EventArgs e) { this.ultraCalcManager1.NamedReferences.Clear( ); // Add two named references named N1 and N2. N2 multiplies the value of // N1 by 2. this.ultraCalcManager1.NamedReferences.Add( "N1", "5" ); this.ultraCalcManager1.NamedReferences.Add( "N2", "2 * [N1]" ); } private void button2_Click(object sender, System.EventArgs e) { // Change the value of N1 from 5 to 20. This will cause the N2 to get // recalculated and NamedReferenceResultChanged will be raised. this.ultraCalcManager1.NamedReferences["N1"].Formula = "20"; } private void ultraCalcManager1_NamedReferenceResultChanged(object sender, Infragistics.Win.UltraWinCalcManager.NamedReferenceResultChangedEventArgs e) { System.Diagnostics.Debug.WriteLine( e.NamedReference.Key + " named reference got calculated. It's value is " + e.NamedReference.FormulaResult.ToDouble() ); }