0

我在打印它之前绘制了我的列表视图,我可以使用 StringAlignment.Far 将列向右对齐,但它会将所有列绘制到右侧,我可以将我的第一个描述列绘制到左侧并将价格列绘制到右侧吗?

           if (Controls[i].GetType() == this.listView1.GetType())
            {
                StringFormat stringFormat = new StringFormat();
                stringFormat.Alignment = StringAlignment.Far;
                stringFormat.LineAlignment = StringAlignment.Far;
                for (int row = 0; row < listView1.Items.Count; row++)
                {
                    int nextColumnPosition = listView1.Bounds.X;
                    for (int col = 0; col < listView1.Items[row].SubItems.Count; col++)
                    {
                        g.DrawString(listView1.Items[row].SubItems[col].Text, listView1.Items[row].Font, Brushes.Black, (nextColumnPosition + 3) * scalex, (listView1.Items[row].Bounds.Y + listView1.Bounds.Y) * scaley, stringFormat);
                        nextColumnPosition += listView1.Columns[col].Width;

                    }
                }
            }  
4

0 回答 0