The GraphicsProxy adds too much space between each line for multi-line strings. I'm using version 17.2.20172.2006.
Passing in string "a\r\nb" ends up looking like "a\r\n\r\nb" (Shown in PDF). The method in question is below. Any ideas?
0434.TestGraphicsProxy.pdf
public void DrawString(string s, System.Drawing.Font font, System.Drawing.Brush brush, float x, float y, System.Drawing.StringFormat format) { if (s == null) throw new ArgumentNullException("s"); if (font == null) throw new ArgumentNullException("font"); if (brush == null) throw new ArgumentNullException("brush"); _graphics.Font = GetFont(font); _graphics.Brush = GetBrush(brush); float h = _memoryGraphics.MeasureString(s, font).Height; CharBuffer cb = new CharBuffer(); foreach (char ch in s) { if (ch == '\r') continue; if (ch == '\n') { if (cb.Count > 0) { _graphics.DrawString(x, y, cb.ToString()); cb.Clear(); } y += h; } else { cb.Add(ch); } } if (cb.Count > 0) _graphics.DrawString(x, y, cb.ToString()); }
Hello Martin,
Thank you for posting to our forum.
I followed the steps you suggested and was unable to reproduce the behavior you're describing.
I have created a sample of the document engine for a single text element. To the text element, i applied the textpattern which has a property called interval which manages the space. When I do not set the interval I was not getting any exact line space in the text but when I set it , (as demonstrated in the sample ) it does provide the extra line space, which is expected.
So I would like to know if you did set the interval property and that is why getting extra line space?
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, then the change in behavior is due to differences in your environment from mine and these differences can be anything from operating system version to the specific version of the Infragistics DLL versions used. My test was performed using version 17.2.20172.2006. Please provide more details about your machine and version of the assemblies that you are referencing so that I can modify the environment that I am testing in to match yours.
If the project does show the product feature working correctly, then more information will be needed to reproduce the issue in a sample that can be used for debugging. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing. This can be done by either making the sample that I provided more like your application or by isolating the behavior from your application by removing dependencies on any third parties or databases.
Please let me know if I can provide any further assistance.
Sincerely,Divya JainAssociate Software Developer
WindowsFormsApp.zip
Hi Divya,
I'm not using the Section to add text to the report. I am using the GraphicsProxy created via Canvas.CreateGraphics(). I attached a sample reproducing the problem.
Thanks for your help.
7658.TestGraphicsProxy.zip