Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Invert Color

Invert Color

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xstoneheartx
    wrote on last edited by
    #1

    i want to invert a color..for example...inveret color.blue how can i do it?

    C G X 4 Replies Last reply
    0
    • X xstoneheartx

      i want to invert a color..for example...inveret color.blue how can i do it?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The inverse of blue is 0xFFFF00. To invert a colour you need to invert the red, green and blue components individually. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      N 1 Reply Last reply
      0
      • C Christian Graus

        The inverse of blue is 0xFFFF00. To invert a colour you need to invert the red, green and blue components individually. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        N Offline
        N Offline
        Nadroj
        wrote on last edited by
        #3

        i was going to suggest that too, Christian. i couldnt figure out how, could you give some detail please? just out of curiousity thanks ------------------------ Jordan. III

        C 1 Reply Last reply
        0
        • N Nadroj

          i was going to suggest that too, Christian. i couldnt figure out how, could you give some detail please? just out of curiousity thanks ------------------------ Jordan. III

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          To be honest, I don't use VB at all. If it's VB.NET, then you take the Color variable, and you say myColor.Red = 255-myColor.Red myColor.Green = 255-myColor.Green myColor.Blue = 255-myColor.Blue Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

          N 1 Reply Last reply
          0
          • C Christian Graus

            To be honest, I don't use VB at all. If it's VB.NET, then you take the Color variable, and you say myColor.Red = 255-myColor.Red myColor.Green = 255-myColor.Green myColor.Blue = 255-myColor.Blue Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

            N Offline
            N Offline
            Nadroj
            wrote on last edited by
            #5

            ok thx ya, i think i tried sumthing similar to that and it didnt work. i guess i can go back and retry with this later. cheers ------------------------ Jordan. III

            1 Reply Last reply
            0
            • X xstoneheartx

              i want to invert a color..for example...inveret color.blue how can i do it?

              G Offline
              G Offline
              Guerven
              wrote on last edited by
              #6

              'Here is a color inverting code. hope this will help 'place a button and 3 textboxes ' then cut and paste this codes Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged Try Button1.BackColor = Color.FromArgb(TextBox1.Text, TextBox2.Text, TextBox3.Text) Catch End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try TextBox1.Text = 255 - TextBox1.Text TextBox2.Text = 255 - TextBox2.Text TextBox3.Text = 255 - TextBox3.Text Catch End Try End Sub :eek: Marvin N. Guerrero - did the chicken came first than the egg. it depends! uphill the chicken would be first, downhill the egg would simply roll.

              1 Reply Last reply
              0
              • X xstoneheartx

                i want to invert a color..for example...inveret color.blue how can i do it?

                X Offline
                X Offline
                xstoneheartx
                wrote on last edited by
                #7

                Thanx to all You Can see a code for getting R ,G ,B from a color and inverting a color in this address: http://www.vb-helper.com/index\_graphics.html#color XstoneheartX

                1 Reply Last reply
                0
                • X xstoneheartx

                  i want to invert a color..for example...inveret color.blue how can i do it?

                  X Offline
                  X Offline
                  xstoneheartx
                  wrote on last edited by
                  #8

                  Best solution to my Question! Public Function InvertColor(ByVal C As Color) As Color Return (Color.FromArgb(255 - C.R, 255 - C.G, 255 - C.B)) End Function

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups