MultiRowのセルに入力された値のふりがなを取得することはできますか?

文書番号 : 37415     文書種別 : 使用方法     登録日 : 2014/07/11     最終更新日 : 2015/05/15
文書を印刷する
対象製品
InputMan for Windows Forms 7.0J
詳細
IMEコンポーネントのふりがな取得機能は、MultiRow for Windows Forms 7.0Jのセルに対しても有効です。IMEコンポーネントのResultStringイベントでセルに入力された漢字のふりがなを取得し、別のセルに表示することができます。

なお、OutputModeプロパティのIntelligenceに該当する機能を実現することはできません。

※下記サンプルコードを実行するには、フォームにあらかじめGcMultiRowコントロールとGcImeコンポーネントを配置します。

[Visual Basic]
Imports GrapeCity.Win.MultiRow
Imports GrapeCity.Win.Editors

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Dim textBoxCell1 As New TextBoxCell()
  textBoxCell1.Name = "textBoxCell1"
  Dim textBoxCell2 As New TextBoxCell()
  textBoxCell2.Name = "textBoxCell2"

  GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {textBoxCell1, textBoxCell2})

End Sub

Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
  Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow)
  If gcMultiRow.CurrentCell.Name = "textBoxCell1" Then
    GcIme1.SetKanaMode(e.Control, KanaMode.KatakanaHalf)
    GcIme1.SetCausesImeEvent(e.Control, True)
  End If
End Sub

Private Sub GcIme1_ResultString(ByVal sender As System.Object, ByVal e As GrapeCity.Win.Editors.ResultStringEventArgs) Handles GcIme1.ResultString
  If TypeOf e.SourceControl Is TextBoxEditingControl Then
    Dim textBoxEditingControl As TextBoxEditingControl = TryCast(e.SourceControl, TextBoxEditingControl)
    If textBoxEditingControl.GcMultiRow.CurrentCell.Name = "textBoxCell1" Then
      textBoxEditingControl.GcMultiRow.CurrentRow.Cells("textBoxCell2").Value = String.Concat(textBoxEditingControl.GcMultiRow.CurrentRow.Cells("textBoxCell2").Value, e.ReadString)
    End If
  End If
End Sub


[C#]
using GrapeCity.Win.MultiRow;
using GrapeCity.Win.Editors;

private void Form1_Load(object sender, EventArgs e)
{
  TextBoxCell textBoxCell1 = new TextBoxCell();
  textBoxCell1.Name = "textBoxCell1";
  TextBoxCell textBoxCell2 = new TextBoxCell();
  textBoxCell2.Name = "textBoxCell2";

  gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { textBoxCell1, textBoxCell2 });
  gcMultiRow1.EditingControlShowing += new EventHandler<EditingControlShowingEventArgs>(gcMultiRow1_EditingControlShowing);

  gcIme1.ResultString += new EventHandler<ResultStringEventArgs>(gcIme1_ResultString);
}

private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
  GcMultiRow gcMultiRow = sender as GcMultiRow;
  if (gcMultiRow.CurrentCell.Name == "textBoxCell1")
  {
    gcIme1.SetKanaMode(e.Control, KanaMode.KatakanaHalf);
    gcIme1.SetCausesImeEvent(e.Control, true);
  }
}

private void gcIme1_ResultString(object sender, ResultStringEventArgs e)
{
  if (e.SourceControl is TextBoxEditingControl)
  {
    TextBoxEditingControl textBoxEditingControl = e.SourceControl as TextBoxEditingControl;
    if (textBoxEditingControl.GcMultiRow.CurrentCell.Name == "textBoxCell1")
    {
      textBoxEditingControl.GcMultiRow.CurrentRow.Cells["textBoxCell2"].Value = string.Concat(textBoxEditingControl.GcMultiRow.CurrentRow.Cells["textBoxCell2"].Value, e.ReadString);
    }
  }
}



関連情報