Results 1 to 6 of 6

Thread: common dialog

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506

    common dialog

    how do i set the .Color property of the common dialog? sounds simple but i dont know what format it uses..
    cheers

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    VB Code:
    1. CD.color = RGB(r, g, b)
    2. CD.color = vbGreen

    There are many ways.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    cheers but i got 1 more problem :P is this the only way to retrieve the colours from the dialog:
    VB Code:
    1. Red = cdlColour.Color And &HFF
    2. Green = (cdlColour.Color \ &H100) And &HFF
    3. Blue = cdlColour.Color \ &H10000

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    No. This is a much more convenient way:
    VB Code:
    1. Private Type mLong
    2.     L As Long
    3. End Type
    4. Private Type mRGB
    5.     R As Byte
    6.     G As Byte
    7.     B As Byte
    8.     RESERVED As Byte
    9. End Type
    10. Private Function GetRGB(Co As Long) As mRGB
    11. Dim Q As mLong
    12.  
    13.     Q.L = Co
    14.     LSet GetRGB = Q
    15.  
    16. End Function
    17. '// USAGE:
    18. Dim Q As mRGB
    19. Q = GetRGB(cdlColour.Color)
    20. Msgbox Q.R
    21. Msgbox Q.G
    22. Msgbox Q.B
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    thats a bit complex and i havent got a clue what it does :P aint there any other more simple ways of gettin it done?
    cheers

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    No, this is pretty complicated. It has to be. Sure, if you were in C/C++, you could just shift bits to get the answer. But we can't. If you stick in mine, all you need is two lines of code to get it the RGB value. And it's fast
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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