Retrive custom colors in color item? |
Post Reply |
Author | |
TimStowe
Newbie Joined: 03 November 2005 Status: Offline Points: 18 |
Post Options
Thanks(0)
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?
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |