Help displaying fractions!

  • Thread starter Thread starter Mark Steele
  • Start date Start date
M

Mark Steele

Newbie requests your help in displaying fractions!

I would like to take a number that contains a fractional portion and display
it nicely on the screen.
An example would be to take the number '19 3/8'. I want the '19' to display
normally, then the '3' would be in approximately 3/4 the font size and
sitting higher up on the line - almost superscript. The '8' would also be in
3/4 the font size and sitting lower in the line - almost subscript.
I'm looking for something that looks like what you might hand write on a
piece of paper or on a chalkboard.

My guess is that I'll have to write this myself, but I thought I'd ask first
in case there exists a formatter/displayer that already does this so I don't
have to re-invent the wheel.

Thanks,
-Mark
 
Mark,

You do not tell in what kind of application you would want to do this,
nor do you tell if you want to do this in a certain control type on a
winform
application.

If you are working on a console application then I am afraid that this is
out
of the question. With WinForm applications you would have to override a
given OnPaint (for a control you would have to derive a new class and use
custom painting) and draw the number & fraction with on a Graphics
object using the GDI+ (System.Drawing) classes.

Hope this helps,

//Andreas
 
Back
Top