我用陣列產生圖示資料並將它拖曳至picturebox中但無法將拖曳的結果列印出來,把程式post如下:
Private Sub Command1_Click()
Printer.PaintPicture Picture1.Image, 0, 0, Picture1.Width, Picture1.Height
Printer.EndDoc
End Sub
Private Sub Form_Load()
ListView1.Icons = ImageList1
Dim i As Integer
For i = 1 To ImageList1.ListImages.Count
ListView1.ListItems.Add , , ImageList1.ListImages(i).Key, i
Next i
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Static n As Integer
n = n + 1
Load Image1(n)
With Image1(n)
.Top = 200
.Left = 2500
.Width = 500
.Visible = True
.ZOrder 0
End With
Dim i As Integer
i = ListView1.SelectedItem.Index
Image1(n).Picture = ImageList1.ListImages(i).ExtractIcon
Image1(n).DragMode = 1 '拖曳方法為自動
End Sub
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Set Source.Container = Picture1 '以picture1為容納器
Source.Move X, Y
End Sub