Control.BackColor プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Control.BackColor プロパティの意味・解説 

Control.BackColor プロパティ

コントロール背景色取得または設定します

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

解説解説
使用例使用例

コントロールBackColor および ForeColor を既定システム カラー設定するコード例次に示しますコントロールに子コントロールがある場合コード再帰的自分自身呼び出します。このコード例では、Form少なくとも 1 つの子コントロール存在している必要があります。ただし、Panel または GroupBox のような、独自の子コントロールがある子コンテナ コントロールの方が、再帰の例として適してます。

' Reset all the controls to the user's default Control color. 
Private Sub ResetAllControlsBackColor(control
 As Control)
   control.BackColor = SystemColors.Control
   control.ForeColor = SystemColors.ControlText
   If Me.HasChildren Then
      ' Recursively call this method for each child control.
      Dim childControl As Control
      For Each childControl In
  control.Controls
         ResetAllControlsBackColor(childControl)
      Next childControl
   End If
End Sub
// Reset all the controls to the user's default Control color. 
private void ResetAllControlsBackColor(Control
 control)
{
   control.BackColor = SystemColors.Control;
   control.ForeColor = SystemColors.ControlText;
   if(this.HasChildren)
   {
      // Recursively call this method for each child control.
      foreach(Control childControl in control.Controls)
      {
         ResetAllControlsBackColor(childControl);
      }
   }
}
   // Reset all the controls to the user's default Control color.
private:
   void ResetAllControlsBackColor( Control^ control )
   {
      control->BackColor = SystemColors::Control;
      control->ForeColor = SystemColors::ControlText;
      if ( this->HasChildren )
      {
         // Recursively call this method for each child control.
         IEnumerator^ myEnum = control->Controls->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            Control^ childControl = safe_cast<Control^>(myEnum->Current);
            ResetAllControlsBackColor( childControl );
         }
      }
   }
// Reset all the controls to the user's default Control color. 
private void ResetAllControlsBackColor(Control
 control)
{
    control.set_BackColor(SystemColors.get_Control());
    control.set_ForeColor(SystemColors.get_ControlText());
    if (this.get_HasChildren()) {
        for (int iCtr=0; iCtr < control.get_Controls().get_Count();
 iCtr++) {
            // Recursively call this method for each child control.
            Control childControl = control.get_Controls().get_Item(iCtr);
            ResetAllControlsBackColor(childControl);
        }
    }
} //ResetAllControlsBackColor
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.BackColor プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.BackColor プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.BackColor プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

「Control.BackColor プロパティ」の関連用語

Control.BackColor プロパティのお隣キーワード
検索ランキング

   

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



Control.BackColor プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS