如何解决RDLC报告中的“反转或翻转文本”
| 好的,我学到了更多知识,并改写了我的问题。我需要将RDLC报告上的文本翻转或翻转180度(因此显示为上下颠倒)。我有一些自定义的VB代码,该代码接受文本,将其转换为位图,然后将画布翻转180度。这样的效果使文本看起来有点..抖动...或模糊。它不再是一种尖锐的字体。我遇到的问题是我正在使用特殊的TTF条形码字体,该字体创建了扫描仪可以读取的内容。当我翻转条形码字体时,由于条形码行之间的距离太近且扫描仪无法读取,因此模糊性不好。这是代码:Function LoadImage(ByVal sImageText as String,iRotationAngle as Integer,ByVal sFontName as String,iFontSize as Integer)
Dim bmpImage As New Drawing.Bitmap(1,1)
Dim iWidth As Integer = 0
Dim iHeight As Integer = 0
\'// Create the Font object for the image text drawing.
Dim MyFont As New Drawing.Font(sFontName,iFontSize) \',System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point)
\'// Create a graphics object to measure the text\'s width and height.
Dim MyGraphics As Drawing.Graphics = Drawing.Graphics.FromImage(bmpImage)
\'// This is where the bitmap size is determined.
iWidth = MyGraphics.MeasureString(sImageText,MyFont).Width
iHeight = MyGraphics.MeasureString(sImageText,MyFont).Height
\'// Create the bmpImage again with the correct size for the text and font.
bmpImage = New Drawing.Bitmap(bmpImage,New Drawing.Size(iWidth,iHeight))
\'// Add the colors to the new bitmap.
MyGraphics = Drawing.Graphics.FromImage(bmpImage)
MyGraphics.Clear(Drawing.Color.White)
MyGraphics.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
MyGraphics.TranslateTransform(iWidth,iHeight)
MyGraphics.RotateTransform(iRotationAngle)
MyGraphics.DrawString(sImageText,MyFont,New Drawing.SolidBrush(Drawing.Color.Black),0)
MyGraphics.Flush()
Dim stream As IO.MemoryStream = New IO.MemoryStream
Dim bitmapBytes As Byte()
\'Create bitmap
bmpImage.Save(stream,System.Drawing.Imaging.ImageFormat.Bmp)
bitmapBytes = stream.ToArray
stream.Close()
bmpImage.Dispose()
Return bitmapBytes
End Function
我真的不知道为什么没有内置的方式来翻转文本。它会让我从左到右反转它。荒谬。
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。