Hi,
I would like to control the font used by all of the controls in our application. Using a style file I have been able to set the base style role's fontName, this seems to work ok. I would rather not hard code the font name in the file and instead determine it at runtime and set this value accordingly. I could modify the style file prior to loading it if I have to but I was hoping for a better way. Should I muck with the StyleManager api to do this? I have found any examples of this.
Thanks for your help,
Bill
Hi Bill,
I think what you would have to load is load your StyleLibrary into memory and then modify the base UI Role in code.
But how you would do this depends on whether you want to load a library from a file first, or just create a new library. And do you want to save the changed setting to a file or just do all of this in code?
Hi Mike,
I would like to be able to do it all in code. Is it possible or do I need to load an isl file? Either way, can you show my how to modify the base UI in code?
Thanks again,
I would think that a derived grid would pick up the application styling just as a normal grid does, unless something you are doing to the grid is overriding the appearance resolution somewhere.
Without knowing more about exactly what your derived grid is doing, though, it's hard to say.
I want to ask a related question in this thread.
I tried the above code in our application, and it works fine for all the controls, except one contol that is derived from UltraGrid.Inside this derived control, there does not seem to have anything related to Font change. It does not pick up the Font I set, but still use the default font.
Do you have any idea what could be the issue? Is there a way I can check whether the app style is set on the control?
Thanks.
Well, if you only want to do this for some controls, it will be tricky. I think you will either have to use a StyleSetName or StyleLibraryName so that those controls you want to adjust are using a different StyleSet or Library than the rest of the controls in the application. I don't see any easier way to do it.
I believe that would change the font size of all the controls application wide, I only want to do that on certain controls. What I would like to do is have a base font and size that all controls would use like Tahoma 8. This information will be user customizable. Under certain situations I want to relax the font size requirement on a control by control basis. So, I am looking for a way to tell a control to stop using the font size that is coming from appstylist and instead use the one i am providing.
Attached is an example of what I am doing. In the print screen the grids font size changes when the user moves the slider. The only way I came up with to handle this situation is to swap the styleset in and out on the grid like this:
{
}
else
where the "Zoom" style set is the same as the base style set without a font size setting
Thanks for any ideas,
Why not change the font size in the currently loaded style library?