Results 1 to 5 of 5

Thread: DirectX: surface.setForeColor

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Question DirectX: surface.setForeColor

    I want to set the fore color of a surface in DirecX. But the parameter is a Long. Is it possible to calculate form RGB to Long Color??? Or how do I know what number the color Green is in Long???

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    That would be 0000FF00h, but the Long value should be the same format as the windows COLORREF values, which in VB are too represented as Long. You can create those with the RGB function (I think)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Do you or anyone else know how to that ("You can create those with the RGB function")?

    And what exactly do you mean by Windows COLORREF values??I'm not following you 100% here...

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's C++ talk

    A COLORREF is just a Long, but it indicates that windows interprets it in a special way (as a color).

    There is a VB function named RGB (I think, maybe it's Rgb, or some completly other name) that creates a Long from three Byte values.
    So you would do
    VB Code:
    1. Dim clr As Long
    2. clr = Rgb 0, 255, 0 'Green

    But I've never really used VB so I'm not sure.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Feeling a bit stupid now. Should have figured out that that was the way to do it...Have had a rough day, I think I will go to bed now...

    Thank you CornedBee, you saved my day....

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