Percent TypeConverter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a TypeConverter that converts Doubles to percent values in a PropertyGrid? The Windows.Forms.Form.Opacity property seems to use the TypeConverter that I want.

Thank you,
Lance
 
View this thread from Jay Harlow and Charles Law. It might help.

-------------

Hi Jay

Thanks for confirming what I was beginning to suspect.

Using the example that I just used to Armin, I would then have

<code>
Public Structure MyValueClass

Public Function ToPercent() As Double
End Function

Public Function ToAbsolute() As Integer
End Function

End Structure

Dim d As Double
Dim i As Integer

d = mc.Value.ToPercent()
i = mc.Value.ToAbsolute()
</code>

showing that I must explicitly call ToAbsolute rather than just write

i = mc.Value

Charles


message
 
Thanks for the help, but that isn't quite what I'm looking for. I need a TypeConverter class rather than a technique that converts a value. I could create my own TypeConverter class, but I want to make sure that there isn't a standard percent TypeConverter before doing so.

Lance
 
Thanks for the help, but that isn't quite what I'm looking for. I need a TypeConverter class rather than a technique for converting the value. I could create my own TypeConverter, but I want to make sure that there isn't a standard TypeConverter for converting percents before doing so.

Lance
 
Check out the OpacityConverter class
That's what the opacity property uses

/claes

ljlevend said:
Is there a TypeConverter that converts Doubles to percent values in a
PropertyGrid? The Windows.Forms.Form.Opacity property seems to use the
TypeConverter that I want.
 
That's exactly what I was looking for. Thanks!

Claes Bergefall said:
Check out the OpacityConverter class
That's what the opacity property uses

/claes


PropertyGrid? The Windows.Forms.Form.Opacity property seems to use the
TypeConverter that I want.
 
Back
Top