Bonjour,
Je me suis fais une petite application de reporting utilisant des graphics. Tout fonctionne très bien mais la qualité d'affichage et d'impression est très discutable. Les lettres sont un peu floues, comme trouées, comme si on était en mode économie d'encre, ce qui n'est pas le cas. Comment obtenir des belles lettres claires et bien définies?
Voici le code de création de la page:
Et un exemple de code qui plaque du texte sur la page:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 Public Shared Sub PageMaker() Page += 1 'On incrémente le nombre de page 'On redimensionne les tableaux ReDim Preserve objbitmap(Page) ReDim Preserve objGraphics(Page) 'Creation d'objet avec Set la mise en page objbitmap(Page) = New Bitmap(1275, 1665) objbitmap(Page).SetResolution(150, 150) 'Association Bitmap-Graphic et Remplissage en blanc objGraphics(Page) = Graphics.FromImage(objbitmap(Page)) objGraphics(Page).FillRectangle(Brushes.White, 0, 0, objbitmap(Page).Width, objbitmap(Page).Height) 'Caractéristique de qualité du GRAPHICS objGraphics(Page).SmoothingMode = Drawing2D.SmoothingMode.HighQuality objGraphics(Page).TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias objGraphics(Page).CompositingQuality = Drawing2D.CompositingQuality.HighQuality frmSReport.NBXNoPage.Maximum = Page + 1 End Sub
J'ai bien essayé de jouer avec les paramètres Smoothingmode, TextRenderingHint et CompositingQuality, mais je n'arrive pas a trouver la bonne combinaison, ou il me manque quelque chose. J'ai augmenté ma résolution mais ce n'est pas vraiment mieux. Pouvez-vous m'aider?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 Shared Sub FDrawer(ByVal page As Integer, ByVal Name As String, ByVal POSX As Integer, ByVal POSY As Integer, ByVal AlignFAR As Boolean, ByVal SIZE As Integer, ByVal APOSX As Integer, ByVal APOSY As Integer, ByVal TEXT As String, ByVal WIDTH As Integer) 'dimension et ajustement du texte If SIZE = 0 Then SIZE = 15 If Name.Length > WIDTH Then WIDTH = Name.Length TEXT = Mid(TEXT, 1, WIDTH) ' Creation font et brush. Dim drawFont As New Font("Arial", SIZE) Dim FdrawBrush As New SolidBrush(Color.Black) Dim FdrawFormat As New StringFormat 'Alignement If AlignFAR Then FdrawFormat.Alignment = StringAlignment.Far Else FdrawFormat.Alignment = StringAlignment.Near End If 'Creation du point d'entrée du texte Dim FDrawpoint As New PointF(POSX, POSY) ' Drawing objGraphics(page).DrawString(TEXT, drawFont, FdrawBrush, FDrawpoint, FdrawFormat) End Sub
merci
Partager