Scrollbars - changing style when added later

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Scrollbars - changing style when added later

Post by greggorob64 » Thu May 05, 2016 5:18 pm

Hello. I originally added my scrollbars to my chart during the initialization of my chart. I'm doing all I can to improve startup time, so I modified my project to only create and add my scrollbar until the user needs them (they zoom in).

They changed appearance from this

Image

to this:

Image

How do I get them back to their original style? I'm not sure why the style changed?

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Scrollbars - changing style when added later

Post by ArctionPasi » Thu May 05, 2016 7:10 pm

Maybe ColorTheme property setting overrides the color settings?
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Scrollbars - changing style when added later

Post by greggorob64 » Thu May 05, 2016 8:04 pm

That's definately the cause.

The old way (with loading scrollbars immediately)

1) program starts
2) add scrollbars
3) apply theme


the new way (lazy loading the scrollbars)
1) program starts
2) apply theme
(some time passes)
3) add scrollbars

I don't want to have to re-apply the theme to the entire chart, but is that my only option? I don't know how to apply theme to just the scrollbars.

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Scrollbars - changing style when added later

Post by ArctionPasi » Mon May 09, 2016 5:39 pm

Applying ColorTheme sets the colors of objects that currently exist in the chart. For objects to be created in the future, it has no effect.
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Scrollbars - changing style when added later

Post by greggorob64 » Tue May 10, 2016 12:40 pm

I dug into the source code, and I pulled the 'set scrollbar colors' part of 'set theme' to its own public method (which set theme now calls), and was able to get it working. Was hoping I wouldn't have to change the code, but it seems the only way to get screen items to be the correct color when added at runtime.

Easy fix though :)


Also, if source code stuff is something I shouldn't be discussing on the forum, let me know and I'll take it down.

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Scrollbars - changing style when added later

Post by ArctionPasi » Tue May 10, 2016 12:49 pm

Great you got it solved :shock: Excellent work.

Discussing source code is perfectly OK in this level. Showing actual LC source code here would be too revealing though.
LightningChart Support Team, PT