|
-
Nov 29th, 2011, 08:18 PM
#1
Thread Starter
Junior Member
[RESOLVED] Writing a forecolor value to a string
Hey,
I've set the colour of a label using the ColorDialog and I want to read the chosen colour value into a string, using the following code:
Code:
ColorDialog1.ShowDialog()
label1.ForeColor = ColorDialog1.Color
For example, I have chosen, say, blue as the colour.. How would I read this value into a string, or the hex code for this colour?
Thanks in advance,
PlaystationMasterBoy
-
Nov 29th, 2011, 08:19 PM
#2
Re: Writing a forecolor value to a string
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 29th, 2011, 08:23 PM
#3
Thread Starter
Junior Member
Re: Writing a forecolor value to a string
Fabulous. A*
Thanks a lot.
-
Nov 29th, 2011, 08:42 PM
#4
Thread Starter
Junior Member
Re: Writing a forecolor value to a string
How would I then set the forecolor of a different control to equal that that I have written to the varialble. For example, I have written:
Code:
ColorDialog1.ShowDialog()
label1.ForeColor = ColorDialog1.Color
and...
Code:
colour1 = ColorDialog1.Color.Name
How would I then set the forecolor of a different element to the same?
I've tired..
Code:
Button9.ForeColor = colour1
Thanks
-
Nov 29th, 2011, 08:46 PM
#5
Re: Writing a forecolor value to a string
vb Code:
Button9.ForeColor = color.fromname(colour1)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 29th, 2011, 08:48 PM
#6
Thread Starter
Junior Member
Re: Writing a forecolor value to a string
 Originally Posted by .paul.
vb Code:
Button9.ForeColor = color.fromname(colour1)
Thanks. That's a lifesaver.
-
Nov 29th, 2011, 08:51 PM
#7
Re: [RESOLVED] Writing a forecolor value to a string
it'd probably be easier to declare colour1 as color:
vb Code:
dim colour1 as color
colour1 = ColorDialog1.Color
...
Button9.ForeColor = colour1
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Tags for this Thread
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
|