il fatto è che io devo generare X numeri di immagini.
Anche se non risiedono da nessuna parte(fisicamente), le posso mettere dentro a cristal report? come?
codice:
Public Sub PrintEANBarCode(ByVal strEANCode As String, _
ByVal objPicBox As PictureBox, _
Optional ByVal sngX1 As Single = (-1), _
Optional ByVal sngY1 As Single = (-1), _
Optional ByVal sngX2 As Single = (-1), _
Optional ByVal sngY2 As Single = (-1), _
Optional ByVal FontForText As Font = Nothing)
Dim K As Single
Dim sngPosX As Single
Dim sngPosY As Single
Dim sngScaleX As Single
Dim strEANBin As String
Dim strFormat As New StringFormat()
'*
'* Convert the code on its binary representation
'*
strEANBin = EAN2Bin(strEANCode)
'*
'* Define the font to be printed
'*
If (FontForText Is Nothing) Then
FontForText = New Font("Courier New", 10)
End If
'*
'* Defines the boundaries to the barcode
'*
If sngX1 = (-1) Then sngX1 = 0
If sngY1 = (-1) Then sngY1 = 0
If sngX2 = (-1) Then sngX2 = objPicBox.Width
If sngY2 = (-1) Then sngY2 = objPicBox.Height
'*
'* Defines the boundaries of the barcode
'*
sngPosX = sngX1
sngPosY = sngY2 - CSng(1.5 * FontForText.Height)
'*
'* Clears the area
'*
objPicBox.CreateGraphics.FillRectangle(New System.Drawing.SolidBrush(objPicBox.BackColor), sngX1, sngY1, sngX2 - sngX1, sngY2 - sngY1)
'*
'* Calculates the scale
'*
sngScaleX = (sngX2 - sngX1) / strEANBin.Length
'*
'* Draw the BarCode
'*
For K = 1 To Len(strEANBin)
If Mid(strEANBin, K, 1) = "1" Then
objPicBox.CreateGraphics.FillRectangle(New System.Drawing.SolidBrush(objPicBox.ForeColor), sngPosX, sngY1, sngScaleX, sngPosY)
End If
sngPosX = sngX1 + (K * sngScaleX)
Next K
'*
'* Draw the human-friendly code
'*
strFormat.Alignment = StringAlignment.Center
strFormat.FormatFlags = StringFormatFlags.NoWrap
objPicBox.CreateGraphics.DrawString(strEANCode, FontForText, New System.Drawing.SolidBrush(objPicBox.ForeColor), CSng((sngX2 - sngX1) / 2), CSng(sngY2 - FontForText.Height), strFormat)
End Sub
questa funzione crea in automatico l'img e la infila dentro ad una Picture...come dovrei cambiare per metterla dentro ad un report?