この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

Control.ImeModeChanged イベント

ImeMode プロパティが変更された場合に発生します。

名前空間:  System.Windows.Forms
アセンブリ:  System.Windows.Forms (System.Windows.Forms.dll 内)
public event EventHandler ImeModeChanged

このイベントは ImeMode プロパティがプログラムの変更によって、またはユーザーとの対話によって変更された場合に発生します。

Input Method Manager をサポートしないコントロールは、このイベントを発生させません。

イベント処理の詳細については、「イベントの利用」を参照してください。

Text プロパティの値が変更されたときに実行されるイベント ハンドラーのコード例を次に示します。 Control クラスには、PropertyNameChanged という名前のパターンを持つメソッドがいくつかあります。これらは、対応する PropertyName の値が変更されたときに生成されます。ここで、PropertyName は対応するプロパティの名前を表します。

通貨型のデータを表示する TextBoxForeColor を変更するコード例を次に示します。 テキストを 10 進数に変換し、値が負の場合は ForeColorColor.Red に変更し、正の場合は Color.Black に変更する例を次に示します。 この例では、TextBox を格納する Form が存在している必要があります。


private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
   try
   {
      // Convert the text to a Double and determine if it is a negative number.
      if(double.Parse(currencyTextBox.Text) < 0)
      {
         // If the number is negative, display it in Red.
         currencyTextBox.ForeColor = Color.Red;
      }
      else
      {
         // If the number is not negative, display it in Black.
         currencyTextBox.ForeColor = Color.Black;
      }
   }
   catch
   {
      // If there is an error, display the text using the system colors.
      currencyTextBox.ForeColor = SystemColors.ControlText;
   }
}


.NET Framework

サポート対象: 4、3.5、3.0、2.0、1.1、1.0

.NET Framework Client Profile

サポート対象: 4、3.5 SP1

Windows 7, Windows Vista SP1 以降, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core はサポート対象外), Windows Server 2008 R2 (SP1 以降で Server Core をサポート), Windows Server 2003 SP2

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ