Results 1 to 5 of 5

Thread: .BackColor Comparison?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    16

    Exclamation .BackColor Comparison?

    Hey all....

    If someone comes up with the answer to this quick, I'd like to know how to search for strange problems like this in the MSDN...

    A simple comparison operation. I want to perform a certain operation if a label's BackColor property is set to a certain color, ie. Color.Transparent. So logically I do the following:

    label.BackColor = Color.Transparent

    '.... some code ....

    If (label.BackColor = Color.Transparent) Then
    '...
    End If

    But I get an error stating that the '=' operator isn't defined by System.Drawing.Colors. This isn't making much sense. Not too sure how I can get the logic to work without some dumb workarounds if I can't compare colors. Anyone?

    Regards,
    Brian

  2. #2
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280
    Just curious, why are you comparing a number in RGB format (or hexadecimal format depending of the control) with a boolean variable.

    Anyways, that has happened to me too, except under more normal circumstances Weird.....

  3. #3
    Zaei
    Guest
    An RGB Color value is a Long Value. A Hexidecimal value is simply a way of representing a number. They are both the same. In the case of colors, The hex value is easier to read.

    Z.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    16
    Color.Transparent isn't a Boolean variable.... as I showed in the code, you can set the Transparent 'color' (system-defined), but you can't compare it after to see if that color took effect.

    There must be some way of comparing the value of .BackColor....

    Brian

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    16

    VB.NET

    This is being done in VB.NET by the way... odd that I forgot to mention that before. I had no problems with this sort of operation in VB 6, but I'm aware things are a lot different in this situation.

    Brian

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