Control.OnDockChanged メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Control.OnDockChanged メソッドの意味・解説 

Control.OnDockChanged メソッド

DockChanged イベント発生させます

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

Protected Overridable Sub
 OnDockChanged ( _
    e As EventArgs _
)
Dim e As EventArgs

Me.OnDockChanged(e)
protected virtual void OnDockChanged (
    EventArgs e
)
protected:
virtual void OnDockChanged (
    EventArgs^ e
)
protected void OnDockChanged (
    EventArgs e
)
protected function OnDockChanged (
    e : EventArgs
)

パラメータ

e

イベント データ格納している EventArgs。

解説解説
使用例使用例

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

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

Protected Overrides Sub
 OnTextChanged(e As System.EventArgs)
   Try
      ' Convert the text to a Double and determine
      ' if it is a negative number.
      If Double.Parse(Me.Text)
 < 0 Then
         ' If the number is negative, display it in Red.
         Me.ForeColor = Color.Red
      Else
         ' If the number is not negative, display it in Black.
         Me.ForeColor = Color.Black
      End If
   Catch
      ' If there is an error, display the
      ' text using the system colors.
      Me.ForeColor = SystemColors.ControlText
   End Try

   MyBase.OnTextChanged(e)
End Sub
protected override void OnTextChanged(System.EventArgs
 e)
{
   try
   {
      // Convert the text to a Double and determine
      // if it is a negative number.
      if(double.Parse(this.Text) < 0)
      {
         // If the number is negative, display it in Red.
         this.ForeColor = Color.Red;
      }
      else
      {
         // If the number is not negative, display it in Black.
         this.ForeColor = Color.Black;
      }
   }
   catch
   {
      // If there is an error, display the 
      // text using the system colors.
      this.ForeColor = SystemColors.ControlText;
   }
   
   base.OnTextChanged(e);
}
protected:
   virtual void OnTextChanged( System::EventArgs^ e ) override
   {
      try
      {
         // Convert the text to a Double and determine
         // if it is a negative number.
         if ( Double::Parse( this->Text
 ) < 0 )
         {
            // If the number is negative, display it in Red.
            this->ForeColor = Color::Red;
         }
         else
         {
            // If the number is not negative, display it in Black.
            this->ForeColor = Color::Black;
         }
      }
      catch ( Exception^ ) 
      {
         // If there is an error, display the
         // text using the system colors.
         this->ForeColor = SystemColors::ControlText;
      }

      TextBox::OnTextChanged( e );
   }
protected void OnTextChanged(System.EventArgs
 e)
{
    try {
        // Convert the text to a Double and determine
        // if it is a negative number.
        if (System.Double.Parse(this.get_Text())
 < 0) {
            // If the number is negative, display it in Red.
            this.set_ForeColor(Color.get_Red());
        }
        else {
            // If the number is not negative, display it in Black.
            this.set_ForeColor(Color.get_Black());
        }
    }
    catch (System.Exception exp) {
        // If there is an error, display the 
        // text using the system colors.
        this.set_ForeColor(SystemColors.get_ControlText());
    }
    super.OnTextChanged(e);
} //OnTextChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

Control.OnDockChanged メソッドのお隣キーワード
検索ランキング

   

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



Control.OnDockChanged メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS