Format a decimal cell so that numbers are aligned to decimal point

3 posts, 1 answers
  1. Andrea
    Andrea avatar
    73 posts
    Member since:
    Oct 2012

    Posted 04 Mar 2013 Link to this post

    Hello,

    I was requested to port an access 2002 data centric application to winforms .net 4.0 .

    Users do not like the way I'm showing decimal numbers, they do not want to see not significative zeroes and they want numbers to be aligned to decimal separator, not to right margin. What they want is what you can see in accatched picture (old microsoft access program).

    It is possible to obtain such output, perhaps I have to manually draw the cells? If I have to draw the cell, how can I apply the same formatting to cell editor?

    Many Thanks


  2. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    717 posts

    Posted 05 Mar 2013 Link to this post

    Hello Andrea,

    Thank you for writing.

    You can use the CellPaint event of RadGridView to draw the text of the cells yourself. You can also specify a format string for the decimal column which would show the data in the format you want, without insignificant digits. You can set the TextAlignment of the grid spin editor to Center, but you will no be able to align it according to the decimal separator. I have attached an example project where I have implemented all of the above.

    I hope this will be useful. Should you have further questions, I would be glad to help.

    All the best,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

    Interested, but can’t attend? Register anyway and we’ll send you the recording.
  3. Andrea
    Andrea avatar
    73 posts
    Member since:
    Oct 2012

    Posted 05 Mar 2013 Link to this post

    Thank you for using your time to produce this sample project, good to know that I can paint on cells using custom code.

    All the best.
    Andrea



Back to Top