提问人:Waqar Vickey 提问时间:11/15/2022 更新时间:11/15/2022 访问量:90
BC30311 “矩形”类型的值无法转换为“矩形”错误 VB.net
BC30311 Value of type 'Rectangle' cannot be converted to 'Rectangle' error in VB.net
问:
我已经看过很多教程来获取打印dataGridView并下载一个运行良好的项目,但是当我尝试将其放入自己的项目中时,我遇到了错误 BC30311 “Rectangle”类型的值不能转换为“Rectangle”
Private bitmap As Bitmap
Private Sub BtnPrintCS_Click(sender As Object, e As EventArgs) Handles BtnPrintCS.Click
'Resize DataGridView to full height.
Dim height As Integer = DataLockersList.Height
DataLockersList.Height = DataLockersList.RowCount * DataLockersList.RowTemplate.Height
'Dim widDoc As Integer = Me.DataLockersList.Width
'Dim higDoc As Integer = Me.DataLockersList.Height
'Dim rectangle1 As New Rectangle(0, 0, widDoc, higDoc)
'Create a Bitmap and draw the DataGridView on it.
bitmap = New Bitmap(Me.DataLockersList.Width, Me.DataLockersList.Height)
DataLockersList.DrawToBitmap(bitmap, New Rectangle(0, 0, Me.DataLockersList.Width, Me.DataLockersList.Height))
'Resize DataGridView back to original height.
DataLockersList.Height = height
'Show the Print Preview Dialog.
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.PrintPreviewControl.Zoom = 1
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
'Print the contents.
e.Graphics.DrawImage(bitmap, 0, 0)
End Sub
答: 暂无答案
评论