Control.RightToLeftChanged イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Control.RightToLeftChanged イベントの意味・解説 

Control.RightToLeftChanged イベント

RightToLeft プロパティの値が変更され場合発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Event RightToLeftChanged As
 EventHandler
Dim instance As Control
Dim handler As EventHandler

AddHandler instance.RightToLeftChanged, handler
public event EventHandler RightToLeftChanged
/** @event */
public void add_RightToLeftChanged (EventHandler
 value)

/** @event */
public void remove_RightToLeftChanged (EventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

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

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

Private Sub currencyTextBox_TextChanged(sender
 As Object, _ 
  e As EventArgs) Handles currencyTextBox.TextChanged
   Try
      ' Convert the text to a Double and determine if it is a negative
 number.
      If Double.Parse(currencyTextBox.Text)
 < 0 Then
         ' 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
      End If
   Catch
      ' If there is an error, display the text using the system colors.
      currencyTextBox.ForeColor = SystemColors.ControlText
   End Try
End Sub 
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;
   }
}
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 ( Exception^ ) 
      {
         // If there is an error, display the text using the system
 colors.
         currencyTextBox->ForeColor = SystemColors::ControlText;
      }
   }
private void currencyTextBox_TextChanged(Object
 sender, EventArgs e)
{
    try {
        // Convert the text to a Double and determine if it is a 
        // negative number.
        if (System.Double.Parse(currencyTextBox.get_Text()) <
 0) {
            // If the number is negative, display it in Red.
            currencyTextBox.set_ForeColor(Color.get_Red());
        }
        else {
            // If the number is not negative, display it in Black.
            currencyTextBox.set_ForeColor(Color.get_Black());
        }
    }
    catch (System.Exception exp) {
        // If there is an error, display the text using the system colors.
        currencyTextBox.set_ForeColor(SystemColors.get_ControlText());
    }
} //currencyTextBox_TextChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Control.RightToLeftChanged イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Control.RightToLeftChanged イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS