CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1

    Windows Common Dialog Color Component- RGB?

    I am using the Widows common dialogs control and I dont understand the integer that is returned from showcolor. The integer is not in RGB format or anything else that I can decipher. After reviewing the vbhelp it told me to set the flag &h0(not 100% sure but thats not imp.) anyway... does anyone know how to convert the returned integer into rgb or at least tell me how to read it. Thanks



  2. #2
    Guest

    Re: Windows Common Dialog Color Component- RGB?

    Hi,

    I'll try to explain this with an example.

    'setting up default color
    cdlDialog.Color = vbRed
    cdlDialog.Flags = cdlCCRGBInit 'Flags see end of page
    cdlDialog.ShowColor 'Brings up the Color Window
    form1.backcolor = cdlDialog.Color 'cdlDialog.Color = the selected color
    Exit Sub


    Flags:
    Constants value
    cdlCCRGBInit 1 Defaultcolor
    cdlCCFullOpen 2 Show the entire dialogwindow
    cdlCCPreventFullOpen 4 Disable the button 'define ... colors'
    cdlCCShowHelp 8 Show the 'Help' button in the color window


    So I hope this could have helped you, good luck.

    Cannibal


  3. #3
    Join Date
    Jun 1999
    Location
    England
    Posts
    86

    Re: Windows Common Dialog Color Component- RGB?

    Hi, I am writing my own version of this control an included is the individual components of the the value returned.

    To get each value you try this.

    Red = (ColorValue MOD 256)
    Green = ((ColorValue AND &HFF00FF00) / 256&)
    Blue = (ColorValue AND &HFF0000) /65536



  4. #4

    Re: Windows Common Dialog Color Component- RGB?

    thanks, but it was an anceint post.


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

Featured