| GrapeCity MultiRow for Windows Forms 11.0J > InputManCellの使い方 > GcNumberCell > ドロップダウン電卓 | 
GcNumberCellには、ドロップダウンで表示できるドロップダウン電卓が搭載されています。本項ではドロップダウン電卓について解説します。
ドロップダウン電卓は、メモリ機能付きの四則演算を搭載し視覚的な数値入力を可能にする入力補助機能です。電卓の外観スタイルはカスタマイズが可能で、DropDownCalculatorプロパティが参照するDropDownCalculatorオブジェクトで設定できます
ドロップダウン電卓全体スタイルと表示領域のスタイルを変更するために以下のプロパティが用意されています。
Outputプロパティは、文字色、背景色、文字スタイルを設定し、OutputHeightプロパティは、表示領域の高さを調整します。また、ShowOutputプロパティを使えば、表示領域そのものの表示と非表示を切り替えることが可能です。
ドロップダウン電卓のButtonTextプロパティを使えば、デフォルトで設定されているボタン表示をすべて変更できます。
ButtonTextプロパティが参照するButtonTextCollectionクラスには、ボタンを識別するための名前であるキーと、そのボタンに表示する文字が組になって保存されます。このButtonTextCollectionクラスには、カスタマイズされたボタン表示だけが保存されます。デフォルトで設定されているボタン表示は、このコレクションには含まれていません。
次のサンプルコードは、ButtonTextプロパティを使って、デフォルトで「*」に設定されている乗算ボタンの表示を「×」に変更する例を示しています。
Imports GrapeCity.Win.MultiRow Imports InputManCell = GrapeCity.Win.MultiRow.InputMan Dim GcNumberCell1 As New InputManCell.GcNumberCell() GcNumberCell1.Name = "GcNumberCell1" GcNumberCell1.DropDownCalculator.ButtonText.Add("*", "×") GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {GcNumberCell1})
using GrapeCity.Win.MultiRow; using InputManCell = GrapeCity.Win.MultiRow.InputMan; InputManCell.GcNumberCell gcNumberCell1 = new InputManCell.GcNumberCell(); gcNumberCell1.Name = "gcNumberCell1"; gcNumberCell1.DropDownCalculator.ButtonText.Add("*", "×"); gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { gcNumberCell1 });

ボタンのスタイルは、以下の表に示した種類ごとに設定できます。
| プロパティ | ボタンの種類 | ボタンのキー | 
|---|---|---|
| EditButtons | 編集ボタン | BS | 
| MathButtons | 演算ボタン | /, *, -, +, SQRT, %, ,1/x, = | 
| MemoryButtons | メモリボタン | MC, MR, MS, M+ | 
| MemoryStatus | メモリインジケータ | キーはありません。 | 
| NumericButtons | 数値ボタン | 0〜9, +/-, .(ピリオド) | 
| ResetButtons | リセットボタン | C, CE | 
ボタンのスタイルを設定するには、CalculatorButtonStyle オブジェクトを使用して、上記のプロパティに直接設定します。
次のコードは、演算ボタンのスタイルを設定する例です。
Imports GrapeCity.Win.MultiRow Imports InputManCell = GrapeCity.Win.MultiRow.InputMan Dim GcNumberCell1 As New InputManCell.GcNumberCell() Dim colorBC As Color = Color.Blue Dim colorFC As Color = Color.Red Dim newTE As GrapeCity.Win.Editors.TextEffect = GrapeCity.Win.Editors.TextEffect.Inset GcNumberCell1.DropDownCalculator.MathButtons = New InputManCell.CalculatorButtonStyle(colorFC, colorBC, newTE) GcNumberCell1.DropDownCalculator.FlatStyle = FlatStyle.Flat GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {GcNumberCell1})
using GrapeCity.Win.MultiRow; using InputManCell = GrapeCity.Win.MultiRow.InputMan; InputManCell.GcNumberCell gcNumberCell1 = new InputManCell.GcNumberCell(); Color colorBC = Color.Blue; Color colorFC = Color.Red; GrapeCity.Win.Editors.TextEffect newTE = GrapeCity.Win.Editors.TextEffect.Inset; gcNumberCell1.DropDownCalculator.MathButtons = new InputManCell.CalculatorButtonStyle(colorFC, colorBC, newTE); gcNumberCell1.DropDownCalculator.FlatStyle = FlatStyle.Flat; gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { gcNumberCell1 });
ドロップダウン電卓は、キーボードで操作することができます。以下にその操作方法をまとめます。
| ボタン | 操作 | 説明 | 
|---|---|---|
| <0〜9> | [0〜9] | 数字を挿入します。 | 
| <+/-> | [F9] | 数値の符号を切り替えます。 | 
| <.> | [.]または[,] | 小数点を挿入します。 | 
| <+> | [+] | 加算を行います。 | 
| <-> | [-] | 減算を行います。 | 
| <*> | [*] | 乗算を行います。 | 
| </> | [/] | 除算を行います。 | 
| <√> | [@] | 平方根を算出します。 | 
| <%> | [%] | 除算の結果を百分率で表示します。 | 
| <1/x> | [r] | 逆数を計算します。 | 
| <=> | [=]または[Enter] | 計算を実行します。 | 
| <MC> | [Ctrl]+[L] | メモリ内の数値をクリアします。 | 
| <MR> | [Ctrl]+[R] | メモリ内の数値を呼び出します。 | 
| <MS> | [Ctrl]+[M] | 数値をメモリ内に格納します。 | 
| <M+> | [Ctrl]+[P] | メモリ内の数値に加算します。 | 
| <BS> | [BS] | 最後の桁をクリアします。 | 
| <CE> | [Del] | 現在の数値をクリアします。 | 
| <C> | [Ctrl]+[Del]または[Esc] | 計算をクリアします。 |