Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Retrive custom colors in color item?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Retrive custom colors in color item?

 Post Reply Post Reply
Author
Message
TimStowe View Drop Down
Newbie
Newbie
Avatar

Joined: 03 November 2005
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote TimStowe Quote  Post ReplyReply Direct Link To This Post Topic: Retrive custom colors in color item?
    Posted: 19 January 2006 at 7:45pm
If the user selects custom colors in a color item of the property grid, is it possible to retreive those custom color values?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 20 January 2006 at 7:41am
Here is one way:

Private Sub wndPropertyGrid_ValueChanged(ByVal Item As XtremePropertyGrid.IPropertyGridItem)

    If (Item.Type = PropertyItemColor) Then

        'Pad color hex value to 6 characters
        Dim clr As String
        clr = Hex(Item.Value)
        While Len(clr) < 6
             clr = "0" & clr
        Wend
   
        'Note: VB stores color values BBGGRR, this displays format as RRGGBB
        Debug.Print "color in hex = #" & Right(clr, 2) & Mid(clr, 3, 2) & Left(clr, 2)

        Debug.Print Val("&H" & Mid(Format(clr, "000000"), 5, 2))
        Debug.Print Val("&H" & Mid(Format(clr, "000000"), 3, 2))
        Debug.Print Val("&H" & Mid(Format(clr, "000000"), 1, 2))

    End If
   
End Sub


Or you can do something like this:

Private Sub wndPropertyGrid_AfterEdit(ByVal Item As XtremePropertyGrid.IPropertyGridItem, NewValue As String, Cancel As Boolean)
    If (Item.Type = PropertyItemColor) Then
        Debug.Print "New RGB color "; NewValue
    End If
End Sub
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.