Question

I have a problem with my text quality after printing ! it's not smooth and antialiases!

This is the story :

I create a graphic from a bitmap (Graphics.FromImage(MyBitmap)) and I think it's the start point of my problem because I can't use PrintPageEvenArg(e) , but I have no other choice!

after that I begin writing some text on this graphic:

by reading the answers of similar Questions in this site and some others , I made some changes on my graphics properties such as smoothingMode , TextRenderingHint , ... that U see in continue... but unfortunately none of them helped me !

  SolidBrush sb = new SolidBrush(Color.White);
  graphics.FillRectangle(sb,oRectangle); //it was suggested to be done before antialiases inorder to get effects

  graphics.TextRenderingHint = TextRenderingHint.AntiAlias; //I also tried ClearTypeGridFit
  graphics.SmoothingMode = 
        System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
  graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
  graphics.CompositingQuality = CompositingQuality.HighQuality;
  graphics.CompositingMode = CompositingQuality.SourceOver;

  graphics.DrawString(strValue, boxStyle.Font, sb, oRectangle, StringFormat);

by antialising I got better smooth edge but I see a lot of extra pixel near my text and my text color seems to become lighter so I can say that by smoothing edge my text quality even got worse !

plz help me ! Thanx in advance :)

Was it helpful?

Solution

Try to use this solution (GraphicsPath). In my project it works very good.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top