我正在尝试设计条形码以实施到我的报告中。我正在使用本指南来完成Code 128 Barcode in SSRS。我对VB.Net的经验很少,我在第7行的自定义代码中收到一条错误消息,提示说未声明名称'objGraphic'。我也欢迎在报告中实施条形码的其他选择,最好是免费的。
Function PaintBox(ByVal level As String) As System.Drawing.Bitmap
Dim objBitmap As System.Drawing.Bitmap
objBitmap = New System.Drawing.Bitmap(3,3)
GenCode128.Code128Rendering.MakeBarcodeImage(level, 1, True)
objGraphic.DrawLine(System.Drawing.Pens.Gray,0,0,width,height)
Return objBitmap End Function
Function PaintBoxBmp(ByVal level As String) As Byte()
Dim bmpImage As System.Drawing.Bitmap
bmpImage = PaintBox(level)
Dim stream As System.IO.MemoryStream = New IO.MemoryStream
Dim bitmapBytes As Byte() bmpImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
bitmapBytes = stream.ToArray
stream.Close()
bmpImage.Dispose()
Return bitmapBytes
End Function
答案 0 :(得分:0)
Function PaintBox(ByVal level As String) As System.Drawing.Bitmap
Dim objBitmap As System.Drawing.Bitmap
objBitmap = GenCode128.Code128Rendering.MakeBarcodeImage(level, 1, True)
Return objBitmap
End Function
Function PaintBoxBmp(ByVal level As String) As Byte()
Dim bmpImage As System.Drawing.Bitmap
bmpImage = PaintBox(level)
Dim stream As System.IO.MemoryStream = New IO.MemoryStream
Dim bitmapBytes As Byte()
bmpImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)
bitmapBytes = stream.ToArray
stream.Close()
bmpImage.Dispose()
Return bitmapBytes
End Function