我收到错误消息,因为我只想打印listview中的所选项目。如何选择然后在打印对话框中打印? '项目'不是System.Windows.Forms.ListView.SelectedListViewItemCollection'的成员。
print('f(x) at root is: ', f(x0))
答案 0 :(得分:0)
属性SelectedItems
是无需尝试使用.items
For Each lvi As ListViewItem In Me.ListView1.SelectedItems
e.Graphics.DrawString(lvi.SelectedItems(0).SubItems(1).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 100, H)
Next
答案 1 :(得分:0)
你可以试试这个:
For Each lvi As ListViewItem In Me.ListView1.SelectedItems
e.Graphics.DrawString(lvi.SubItems(1).Text, New Drawing.Font("Times New Roman", 10), Brushes.Black, 100, H)
Next
为了让您了解代码中的错误,Me.ListView1.SelectedItems.Items
已更改为Me.ListView1.SelectedItems
而lvi.SelectedItems(0).SubItems(1).Text
已更改为lvi.SubItems(1).Text