I wonder if anyone can help me figure this out?
I have a Marquee which scrolls text on TV screens and is working ok. Thing is that I need the end user to be able to change certain aspects of it through a Windows Form. I've been trying to use the Visual Studio Settings (which save to an AppConfig.XML file) to save the users' settings.
The text, font name and font size all save and restore perfectly, but for some reason the font colour, which is a System.Drawing.Color type, is always wrong.
When I open the AppConfig.XML or AppConfig.EXE.XML files in an external editor, the colour variable is correct, but the program seems to be getting its data from somewhere else for only this one object....
This is the code I'm using on the form:
Dim FontName As String = My.Settings.ScrollFontName
Dim FontSize As Integer = My.Settings.ScrollFontSize
Dim FS As New Font(FontName, CInt(FontSize / 2), FontStyle.Regular)
Dim FontColour As System.Drawing.Color = My.Settings.ScrollColour
ScrollerSetupLbl.ForeColor = FontColour
ScrollerSetupLbl.Font = FS
ScrollerSetupLbl.ScrollLeftToRight = False
ScrollerSetupLbl.MarqueeText = My.Settings.ScrollText
(In case you're wondering about why I'm dividing the font size in half, the scrollbar on the setup form is half the height of the scrollbar on the main screen.)
This is the AppConfig XML file:
="1.0"="utf-8"
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Secure_Kiosk.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<Secure_Kiosk.My.MySettings>
<setting name="ScrollFontName" serializeAs="String">
<value>Arial</value>
</setting>
<setting name="ScrollFontSize" serializeAs="String">
<value>36</value>
</setting>
<setting name="ScrollColour" serializeAs="String">
<value>DarkBlue</value>
</setting>
<setting name="ScrollText" serializeAs="String">
<value>Test text here</value>
</setting>
</Secure_Kiosk.My.MySettings>
</userSettings>
</configuration>
Note that the "ScrollColour" value is "DarkBlue". I've also tried "Black", "Gold" and "White", all of which are recognised colours for the System.Drawing.Color type, but it always just displays "Red", which was the first colour I tried when I was testing it. For some reason it seems "stuck" on that one regardless.
I've also tried saving a String type variable in the settings, and converting to a System.Drawing.Color type in the form code and got exactly the same thing. The first colour I set "sticks" and won't change. Even manually editing the config files doesn't work.
Any ideas?
Thanks.