Results 1 to 8 of 8

Thread: [2008] How to change BackColor with RGB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    30

    [2008] How to change BackColor with RGB

    Code:
    PictureBox1.BackColor = New BackColor(RGB(TextBox1.Text, TextBox2.Text, TextBox3.Text))
    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"

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] How to change BackColor with RGB

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    30

    Re: [2008] How to change BackColor with RGB

    Could you give an example?

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] How to change BackColor with RGB

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    30

    Re: [2008] How to change BackColor with RGB

    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.

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] How to change BackColor with RGB

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,419

    Re: [2008] How to change BackColor with RGB

    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?

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,419

    Re: [2008] How to change BackColor with RGB

    vb Code:
    1. 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width