Retrive custom colors in color item?
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=3537
Printed Date: 23 November 2024 at 1:16pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Retrive custom colors in color item?
Posted By: TimStowe
Subject: Retrive custom colors in color item?
Date 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?
|
Replies:
Posted By: SuperMario
Date 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
|
|