'宣言 Public Class CalcSettings Inherits Infragistics.Shared.SubObjectBase Implements Infragistics.Win.CalcEngine.IFormulaProvider
public class CalcSettings : Infragistics.Shared.SubObjectBase, Infragistics.Win.CalcEngine.IFormulaProvider
CalcSettings オブジェクトは、UltraCalcManager 特定のコントロールを処理する方法を決定するプロパティを定義します。
計算ネットワークで任意のコントロールを使用するために、そのコントロールに対して CalcSettings を作成する必要があります。これは、新しい CalcSettings を作成し、UltraCalcManager.SetCalcSettings メソッドまたは UltraCalcManager.GetCalcSettingsを呼び出してネットワークへ追加することにより完了します。これにより、コントロールに既存の CalcSetting を自動的に取得、または CalcSetting が存在しない場合は作成します。
PropertyName を CalcSettings に必ず設定し、UltraCalcManager に計算に使用するコントロールのプロパティを知らせます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports Infragistics.Win.CalcEngine Imports Infragistics.Win.UltraWinCalcManager Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Ensure that the form contains an UltraCalcManager and two textboxes, ' one named textBox1 and the other named textBox2. Dim calcSettings As CalcSettings = New CalcSettings() ' This formula will multiply the value of textBox2 by 2. calcSettings.Formula = "2 * [//textBox2]" calcSettings.PropertyName = "Text" Me.ultraCalcManager1.SetCalcSettings(Me.TextBox1, calcSettings) calcSettings = New CalcSettings() calcSettings.PropertyName = "Text" ' Treat the values of the textBox2 as double. Text property of TextBox is ' a string type and since textBox2 is a source of value to a formula, indicate ' to the calc-manager that the value should be treated as a double rather ' than as a string. calcSettings.TreatAsType = GetType(Double) Me.ultraCalcManager1.SetCalcSettings(Me.TextBox2, calcSettings) 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 Form1_Load(object sender, System.EventArgs e) { // Ensure that the form contains an UltraCalcManager and two textboxes, // one named textBox1 and the other named textBox2. CalcSettings calcSettings = new CalcSettings( ); // This formula will multiply the value of textBox2 by 2. calcSettings.Formula = "2 * [//textBox2]"; calcSettings.PropertyName = "Text"; this.ultraCalcManager1.SetCalcSettings( this.textBox1, calcSettings ); calcSettings = new CalcSettings( ); calcSettings.PropertyName = "Text"; // Treat the values of the textBox2 as double. Text property of TextBox is // a string type and since textBox2 is a source of value to a formula, indicate // to the calc-manager that the value should be treated as a double rather // than as a string. calcSettings.TreatAsType = typeof( double ); this.ultraCalcManager1.SetCalcSettings( this.textBox2, calcSettings ); }