How to rotate an image in a report

internship01
Member Posts: 6
Hi everybody,
I need to rotate an image, in my case is a barcode.
I tried to create the following function in Custom Code section into the report:
Public Sub RotateFlip (
rotateFlipType As System.Drawing.RotateFlipType
)
End Sub
Dim PictureBox As System.Windows.Forms.PictureBox
Public Function RotateImage(ByVal Barcode As System.Drawing.Bitmap)
If Barcode IsNot Nothing Then
Barcode.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipY)
End If
End Function
But it doesn't work.
I need to rotate an image, in my case is a barcode.
I tried to create the following function in Custom Code section into the report:
Public Sub RotateFlip (
rotateFlipType As System.Drawing.RotateFlipType
)
End Sub
Dim PictureBox As System.Windows.Forms.PictureBox
Public Function RotateImage(ByVal Barcode As System.Drawing.Bitmap)
If Barcode IsNot Nothing Then
Barcode.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipY)
End If
End Function
But it doesn't work.
0
Best Answer
-
assign the barcode image to the picturebox
add line: PictureBox1.Image = barcode;
under line: Barcode.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipY)
PictureBox1 should be an image control in the report.best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/1
Answers
-
assign the barcode image to the picturebox
add line: PictureBox1.Image = barcode;
under line: Barcode.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipY)
PictureBox1 should be an image control in the report.best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/1 -
Thanks archer89, I added the line you told me.
Since I have two barcodes, I added also a pictureBox parameter to the function as you can see below:
Public Sub RotateFlip (
rotateFlipType As System.Drawing.RotateFlipType
)
End Sub
Public Function RotateImage(ByVal Barcode As System.Drawing.Bitmap,ByVal PictureBox As System.Windows.Forms.PictureBox)
If Barcode IsNot Nothing Then
Barcode.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)
PictureBox.Image = Barcode
End If
End Function
Then I call then function in the expression of the image in the following way:
=Code.RotateImage(Fields!gItem__Blob.Value,ReportItems!Item_BarCode2.Value)
Where "Item_BarCode2" is the name of the PictureBox into the report's layout.
But it still appears a red X instead of my rotated barcode.
Do you know where is the problem?
Thanks again
Regards0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions