Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
AppStyles on forecolor on labels
posted

Hi

We are using StyleManager to 'style' our controls on a winform, this is great and makes it much easier for new forms, however we have 100's of existing forms I'm currently editing as they have been coded to use the style set in the winform properties of the control. (the setting "ControlThenApplication" is set in the style sheet as we wan't to have the ability to "override" the style set in the ISL file.

On loads of our forms where we display the data from the DB to the user we generally use labels - we have two labels, one for the title/caption and one for the data.

E.G

ForenameNameHere

SurnameNameHere

the Caption Labels take the style from the style sheet, however we have to hardcode that the value labels are "Green". Which means if we use a different style sheet, they will still be green.

Is there a better way to set all these value labels to a different forecolor from the caption label within the style file???

Thanks

 

Parents
  • 34430
    Verified Answer
    Offline posted

    Hello Harag,

    In order to set the text color of certain labels in your .isl file and have it be picked up from there rather than having to hard code it, I would recommend creating a Resource in AppStylist that has the styling that you are looking to apply to these particular labels and give it a unique name that you can use to identify that resource.

    In your application, the labels that you are using will have an Appearance.StyleResourceName property. If you set this property on your element to the name of your Resource in the .isl file, it will override the default styling that you have provided for those particular label elements.

    I have attached a sample project and sample .isl file to demonstrate. I hope this helps.

    Please let me know if you have any other questions or concerns on this matter.

    WinFormsLabelStylingDemo.zip

    Sincerely,
    Andrew
    Software Developer

Reply Children
No Data