Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
To set a Web server control property such as the BackColor property to a color, you assign a reference to the Color object.
To set Web server control properties to a color
Call the Color object's FromArgb method, passing it a numeric value (RGB) or the FromName passing it the name of a color as string. Alternatively, you can assign the color using a static method that references a predefined color name, as in the following example:
Button1.BackColor = System.Drawing.Color.FromName("Red") ' White in RGB. Button1.BackColor = System.Drawing.Color.FromArgb(255, 255, 255) Button1.BackColor = System.Drawing.Color.Red ' HTML 4.0 Color Button1.BackColor = System.Drawing.Color.MediumSeaGreenButton1.BackColor = System.Drawing.Color.FromName("Red"); // White in RGB. Button1.BackColor = System.Drawing.Color.FromArgb(255, 255, 255); Button1.BackColor = System.Drawing.Color.Red; // HTML 4.0 color. Button1.BackColor = System.Drawing.Color.MediumSeaGreen;
See Also
Tasks
How to: Set ASP.NET Server Control Style Properties Programmatically