Freigeben über


DataGrid.BackColor-Eigenschaft

Ruft die Hintergrundfarbe der geraden Datenblattzeilen ab oder legt diese fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Overrides Property BackColor As Color
'Usage
Dim instance As DataGrid
Dim value As Color

value = instance.BackColor

instance.BackColor = value
public override Color BackColor { get; set; }
public:
virtual property Color BackColor {
    Color get () override;
    void set (Color value) override;
}
/** @property */
public Color get_BackColor ()

/** @property */
public void set_BackColor (Color value)
public override function get BackColor () : Color

public override function set BackColor (value : Color)

Eigenschaftenwert

Eine Color, die die Farbe der Zeilen im Datenblatt darstellt. Der Standardwert ist die Systemfarbe für Fenster (Window).

Hinweise

Die BackColor-Eigenschaft bestimmt die Farbe der Zeilen im Datenblatt, während die BackgroundColor die Farbe des Bereichs unterhalb der Zeilen bestimmt, der nur angezeigt wird, wenn ein Bildlauf an das Ende des Datenblatts durchgeführt wird oder das Datenblatt nur wenige Zeilen enthält.

In der Standardeinstellung sind sowohl die BackColor-Eigenschaft als auch die AlternatingBackColor-Eigenschaft auf dieselbe Farbe festgelegt. Das Festlegen der BackColor-Eigenschaft betrifft nur gerade Zeilen. Das Festlegen der AlternatingBackColor betrifft nur ungerade Zeilen.

Beispiel

Im folgenden Codebeispiel werden die BackColor-Eigenschaft und die BackgroundColor-Eigenschaft auf unterschiedliche Werte festgelegt.

Private Sub SetBackColorAndBackgroundColor()
   ' Set the BackColor and BackgroundColor properties.
   dataGrid1.BackColor = System.Drawing.Color.Blue
   dataGrid1.BackgroundColor = System.Drawing.Color.Red
End Sub 
private void SetBackColorAndBackgroundColor(){
   // Set the BackColor and BackgroundColor properties.
   dataGrid1.BackColor = System.Drawing.Color.Blue;
   dataGrid1.BackgroundColor = System.Drawing.Color.Red;
}
private:
   void SetBackColorAndBackgroundColor()
   {
      // Set the BackColor and BackgroundColor properties.
      dataGrid1->BackColor = System::Drawing::Color::Blue;
      dataGrid1->BackgroundColor = System::Drawing::Color::Red;
   }
private void SetBackColorAndBackgroundColor()
{
    // Set the BackColor and BackgroundColor properties.
    dataGrid1.set_BackColor(System.Drawing.Color.get_Blue());
    dataGrid1.set_BackgroundColor(System.Drawing.Color.get_Red());
} //SetBackColorAndBackgroundColor

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

DataGrid-Klasse
DataGrid-Member
System.Windows.Forms-Namespace
BackgroundColor