I've tried a lot of different ways, and this one is the closest, but it gives the error "Type 'BackColor' is not defined" for "New BackColor(RGB"Code:PictureBox1.BackColor = New BackColor(RGB(TextBox1.Text, TextBox2.Text, TextBox3.Text))
Printable View
I've tried a lot of different ways, and this one is the closest, but it gives the error "Type 'BackColor' is not defined" for "New BackColor(RGB"Code:PictureBox1.BackColor = New BackColor(RGB(TextBox1.Text, TextBox2.Text, TextBox3.Text))
Check what type the BackColor property is, using the intellisense.
Now that you know it is of type Color, you understand that you must assign a Color to it. The Color structure has a method called FromArgb, that you'll need to make use of.
Could you give an example?
What I've said should really be sufficient. If you just type in Color.FromArgb( in your code intellisense will tell you all you need to know about the method. Should you still be confused there's always MSDN to help you out. Its always a good thing to learn how to use.
I've seen more helpful advise from a PAWN scripting forum. You are very annoying. You expect beginners to know what you mean in a language that they don't understand.
What the hell is MSDN, what the hell does FromArgb mean, and how the hell does the code snippet go togeather? Is it "PictureBox1.BackColor.FromArgb(RGB(TextBox1.Text, TextBox2.Text, TextBox3.Text))" or is it "PictureBox1.BackColor.FromArgb = New BackColor.FromArgb(RGB(TextBox1.Text, TextBox2.Text, TextBox3.Text))" or what the hell is it?!
If you don't understand what I mean, don't try to help me, because it won't work. I don't understand the structure of windows programing yet.
Well you certainly do not need to get personal about it. But thats fine, now I know how you feel, I shallnt be helping you no more.
color.fromargb
from alpha red green blue
alpha = 0-255 - color transparency
red = red 0-255
green = green 0-255
blue = blue 0-255
does that help?
vb Code:
PictureBox1.BackColor = Color.FromArgb(cint(TextBox1.Text), cint(TextBox2.Text), cint(TextBox3.Text))
as atheist said, use the code editors intellisense to check the overloads, by typing Color.FromArgb( you'll be presented with a list of possible overloads, from which you can choose the most applicable one.