|
-
Feb 24th, 2013, 06:58 AM
#1
Thread Starter
Lively Member
[RESOLVED] Background color
I have an array holding certain color values (ie whitesmoke, samon etc) which is obtained from an external text file. A bit like a style sheet. anyway, these values are loaded into an array and used to change the style of the application. The only issue is im getting a few errors.
Code:
Me.BackColor = Color.StyleConfig(0)
Does not work.
I am drunk, you are ugly. But in the morning I will be sober.
Sir Winston Churchill
-
Feb 24th, 2013, 08:10 AM
#2
Re: Background color
So you're getting a few errors. If only there was a way for us to know what those errors are.
-
Feb 24th, 2013, 09:22 AM
#3
Thread Starter
Lively Member
Re: Background color
sorry, it says
'styleConfig' is not a member of system.drawing.color
I am drunk, you are ugly. But in the morning I will be sober.
Sir Winston Churchill
-
Feb 24th, 2013, 09:30 AM
#4
Thread Starter
Lively Member
Re: Background color
sorted it.
Code:
Me.BackColor = Color.FromName(StyleConfig(0))
I am drunk, you are ugly. But in the morning I will be sober.
Sir Winston Churchill
-
Feb 24th, 2013, 09:49 AM
#5
Re: [RESOLVED] Background color
Nice. It wouldn't hurt to check that the colour it returns is a valid colour before using it, though. Look to the Color.IsKnownColor Property, which returns a Boolean.
Code:
Dim bckColour As Color = Color.FromName(styleConfig(0))
If bckColour.IsKnownColor Then
Me.BackColor = bckColour
Else
MessageBox.Show("Unknown colour: " & styleConfig(0))
End If
-
Feb 24th, 2013, 10:49 AM
#6
Thread Starter
Lively Member
Re: [RESOLVED] Background color
 Originally Posted by Inferrd
Nice. It wouldn't hurt to check that the colour it returns is a valid colour before using it, though. Look to the Color.IsKnownColor Property, which returns a Boolean.
Code:
Dim bckColour As Color = Color.FromName(styleConfig(0))
If bckColour.IsKnownColor Then
Me.BackColor = bckColour
Else
MessageBox.Show("Unknown colour: " & styleConfig(0))
End If
Good point. Thanks for that.
I am drunk, you are ugly. But in the morning I will be sober.
Sir Winston Churchill
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|