Getting a PropertyGrid to display a value in Hex
-
I feel like this should be obvious, but I haven't found it yet. Does anyone know how to get a Property Grid to display an int or byte property value in hex?
"We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager
-
I feel like this should be obvious, but I haven't found it yet. Does anyone know how to get a Property Grid to display an int or byte property value in hex?
"We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager
-
Call ToString("X") on your int/byte variable to return a string representation of its value in hexadecimal format.
Paul Marfleet
To be a bit more precise, do this kind of conversion in a TypeConverter (a converter derived from Int32Converter for example) ConvertFrom/ConvertTo methods and attach this converter to your property thanks to the TypeConverterAttribute.
Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker
-
To be a bit more precise, do this kind of conversion in a TypeConverter (a converter derived from Int32Converter for example) ConvertFrom/ConvertTo methods and attach this converter to your property thanks to the TypeConverterAttribute.
Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker
Thanks for the help. I was hoping that I could set a property on the PropertyGrid to show all of the objects integer types as hex (like in the watch display in the debugger), but I'll proceed with the TypeConverter. Regards.
"We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager