GTK#使用Mono&amp ;;设置TreeViewColumn中浮点列的精度。 F#

时间:2014-04-11 09:32:15

标签: f# mono treeview gtk cellrenderer

我使用GTK#和内置gtk.TreeView来创建数据网格。我有一个填充浮动的列。现在他们显示为120.00000。我想让这些浮点数只显示两位数的精度:

不是这个 - > 120.00000

这 - > 120.00

        let tree = new Gtk.TreeView ()


        // Create a column for the price name
        let priceColumn = new Gtk.TreeViewColumn ()
        do  priceColumn.Title <- "Price";
        do  priceColumn.Expand <- true
        do  priceColumn.Alignment <- 0.5f  

        let priceNameCell = new Gtk.CellRendererText ()
        do  priceNameCell.Alignment <- Pango.Alignment.Center  
        do  priceNameCell.Xalign <- 0.5f  

        do  priceColumn.PackStart (priceNameCell, true)
        do  priceColumn.AddAttribute (priceNameCell, "text", 1)

如何设置此属性?

0 个答案:

没有答案