Reputation: 1
I am making an application using Krypton and I just wondered how you would change the color of a Krypton Panel, I have tried to use BackColor, however this does not work and it does not change the color. The code I am using is:
var newPanel = new KryptonPanel();
newPanel.Name = "newPanel";
newPanel.Width = 500;
newPanel.Height = 200;
newPanel.Location = new Point(0, (panelCount == 0 ? 0 : lastPanel.Location.Y) + (panelCount == 0 ? 0 : newPanel.Height) + 0);
newPanel.BackColor = Color.Aqua;
drivesPnl.Controls.Add(newPanel);
If anyone could help with this, it would be greatly appreciated.
Upvotes: 0
Views: 1285
Reputation: 19651
Most Krypton controls provide more options for colors and other visualization properties which can be customized for different states of the control (normal, disabled, pressed, tracking, etc.) *
As a result, the BackColor
property (along with other standard WinForms properties) have no effect on the control and you won't even find them in the Properties Window (because they're replaced with the new options mentioned above).
To change the back color of a KryptonPanel
control for all states, you should use the following:
newPanel.StateCommon.Color1 = Color.Aqua;
Or you can change it manually at design-time using the Properties Window by expanding the StateCommon
group and selecting a color for Color1
.
* The supported states might differ from one control to another. E.g., a KryptonPanel
doesn't have StateTracking
or StatePressed
.
Upvotes: 0