如何从ListView WinForms中删除空格

时间:2016-01-17 22:38:58

标签: c# winforms listview slider items

您好我遇到了一个奇怪的“错误?”可能不是一个bug,而是listView中每个元素之间的空格。好的,这是我用来创建它的代码,还有一个实际问题的图片:

    public void UpdateStatistics(int fHands, int pHands, int lHands, int wHands)
    {
        listStatistics.Clear();
        listStatistics.Visible = Properties.Settings.Default.Statistics;
        listStatistics.View = View.Details;
        listStatistics.GridLines = true;

        listStatistics.Columns.Add("Properties", -2, HorizontalAlignment.Left);
        listStatistics.Columns.Add("Fold's", -2, HorizontalAlignment.Left);
        listStatistics.Columns.Add("Played Hands", -2, HorizontalAlignment.Left);
        listStatistics.Columns.Add("Lost Hands", -2, HorizontalAlignment.Left);
        listStatistics.Columns.Add("Won Hands", -2, HorizontalAlignment.Left);

        var itemsToAdd = returnStatistics(fHands, pHands, lHands, wHands);
        listStatistics.Items.AddRange(new[] { itemsToAdd });
    }
    ListViewItem returnStatistics(int fHands, int pHands, int lHands, int wHands)
    {
        int[] retStat = { fHands, pHands, lHands, wHands };
        ListViewItem item1 = new ListViewItem("Totals", 0);
        for (int j = 0; j < retStat.Length; j++)
        {
            int k = j;
            item1.SubItems.Add(retStat[k].ToString());
        }
        return item1;
    }

0 个答案:

没有答案