[DevExpress Support Team: CLONED FROM K18374: How to change one skin element in all available skins]
Looking at above example
if I am not mistaken, to change only title bar color I should be able to do it programmatically for any skin using
SkinElement element = currentSkin[skinElementName];
.
.
It would be of great help if you could provide code snippet which will change form title bar back color to, for example, black (the same color as "hybridapp" is using)
How to change title bar color programmatically?
Answers approved by DevExpress Support
Hi Zeljko,
You're right, it's possible to change any skin element programmatically, so all your modifications will be applied throughout our skins collection. Here is the required code for the SkinFormCaption element:
C#protected override void OnShown(EventArgs e) {
base.OnShown(e);
Skin currentSkin = FormSkins.GetSkin(this.LookAndFeel);
SkinElement element = currentSkin[FormSkins.SkinFormCaption];
element.Image.Image = null;
element.Color.BackColor = Color.Red;
element.Color.BackColor2 = Color.Green;
this.LookAndFeel.UpdateStyleSettings();
}
Take special note that I'm setting skin element's Image to null. Otherwise, my custom appearance settings will be not taken into account since everything will be painted as a custom bitmap.
Try this solution and let me know if it works for you.
Hello,
I am happy to hear that my assistance was helpful to you. Feel free to contact us if you have additional questions.
hi :
thanks for your help.
I have a question:
In the above case, all the form styles in the program have been changed after I applied the LookAndFeel.UpdateStyleSettings() method.I don't want this.
I just want to change the form caption background color in a specific form (such as login form).
In order to achieve this effect, I temporarily set FormBorderStyle = FormBorderStyle.None, but this is obviously not the final solution. is there any other way? thank you.
I look forward to your reply
Best regards.
Hello,
I created a separate ticket on your behalf: T1023630: How to change the appearance for only specific form. We placed it in our processing queue and will process it shortly.