如何在将int更改为小数后更改PdfSharp控制器

时间:2014-10-10 00:59:04

标签: c# model-view-controller pdfsharp

我将int改为十进制?我现在在我的PdfSharp控制器中出现错误

gfx.DrawString(job.JobRetainage.ToString("C",
              new System.Globalization.CultureInfo("en-US")), BodyFont, XBrushes.Black,
             new XRect(460, 160, page.Width, page.Height),
             XStringFormats.TopLeft);

错误消息

  

方法tostring没有重载需要2个参数

1 个答案:

答案 0 :(得分:2)

试试这个:

gfx.DrawString(job.JobRetainage.Value.ToString("C",
          new System.Globalization.CultureInfo("en-US")), BodyFont, XBrushes.Black,
         new XRect(460, 160, page.Width, page.Height),
         XStringFormats.TopLeft);

您还需要检查null或使用GetValueOrDefault()