질문 :
Reporting Services에서 맨 아래에서 맨 위, 가로 가운데 정렬 된 텍스트부터 시작하여 세로가 있어야합니다.C#/VB.NET : 앤티 앨리어스 품질을 향상시키는 방법
유일한 방법은 코드에서 이미지를 만들고이 이미지를 제목 열로 설정하는 것입니다.
아래 코드를 참조하십시오.
기본적으로 앤티 앨리어싱 품질이 매우 엉터리라는 점에서 문제가 없습니다.
개선 할 수있는 방법이 있습니까? ,
수직 텍스트가 어떻게 든 창백한, 검은 가득 차지 않은
을 또한 배경 색상에 모든 텍스트 주위가 번지 :
는 아래 스크린 샷을 참조하십시오. 뿐만 아니라이 왼쪽에있는 텍스트보다 대담 나타납니다,하지만 모두 내가
System.Drawing.Text.TextRenderingHint의 다른 모든 값을 시도했습니다
대담 형식 굴림, 크기 8을 가지고있다. * 등 잘 전혀 안티 - 별칭으로 전혀
하지만 적어도 하나는 가장 진절머리 나는 것 같다. 나는 또한 아무 소용이, 이미지 형식을 변경 시도했다 :
Function LoadImage2(ByVal sImageText As String, ByVal sImageTextMax As String) As System.Drawing.Image
sImageTextMax = sImageTextMax.PadRight(15)
Dim iFontSize As Integer = 8 '//Change this as needed
Dim bmpImage As New System.Drawing.Bitmap(1, 1)
Dim iWidth As Integer = 0
Dim iHeight As Integer = 0
Dim bgColor As System.Drawing.Color = System.Drawing.Color.LemonChiffon ' LightGray
Dim TextColor As System.Drawing.Color = System.Drawing.Color.Black
Dim fsFontStyle As System.Drawing.FontStyle = System.Drawing.FontStyle.Bold
'// Create the Font object for the image text drawing.
Dim MyFont As New System.Drawing.Font("Arial", iFontSize, fsFontStyle, System.Drawing.GraphicsUnit.Point)
'// Create a graphics object to measure the text's width and height.
'Graphics(MyGraphics = Graphics.FromImage(bmpImage))
Dim MyGraphics As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bmpImage)
'// This is where the bitmap size is determined.
iWidth = MyGraphics.MeasureString(sImageTextMax, MyFont).Width
iHeight = MyGraphics.MeasureString(sImageTextMax, 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))
'inches = pixels/dpi
'pixel = inches * dpi
'1 centimeter = 0.393700787 inch
'pixel = cm * 0.393700787 * dpi
' vice-versa, because 270° turn
iHeight = 1 * 0.393700787 * bmpImage.HorizontalResolution 'x DPI
iWidth = 2.25 * 0.393700787 * bmpImage.VerticalResolution 'y DPI
bmpImage = New System.Drawing.Bitmap(bmpImage, New System.Drawing.Size(iHeight, iWidth))
'// Add the colors to the new bitmap.
MyGraphics = System.Drawing.Graphics.FromImage(bmpImage)
MyGraphics.Clear(bgColor)
MyGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias
MyGraphics.TranslateTransform(0, iWidth)
MyGraphics.RotateTransform(270)
Dim iTextStartX As Single = 2
Dim iTextStartY As Single = CSng(iHeight)/CSng(2.0) - CSng(iFontSize)/CSng(2.0)
iTextStartY -= 2
MyGraphics.DrawString(sImageText, MyFont, New System.Drawing.SolidBrush(TextColor), iTextStartX, iTextStartY)
MyGraphics.Flush()
Return bmpImage
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.PictureBox1.Image = LoadImage2("test", "")
End Sub
' This piece is only needed in reporting service itselfs
Function LoadImage(ByVal strText As String) As Byte()
Dim ThisImageFormat As System.Drawing.Imaging.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
Dim bitmapBytes As Byte()
Dim bmpImage As System.Drawing.Image = LoadImage2(strText, "")
bmpImage.Save(stream, ThisImageFormat)
bitmapBytes = stream.ToArray
stream.Close()
bmpImage.Dispose()
Return bitmapBytes
End Function
이것은 도움이 될 수 있으며 텍스트를 렌더링 할 때 이미지를 사용하지 않는 것이 좋습니다. http://msdn.microsoft.com/en-us/library/da9f790s.aspx – Rodaine