jrgu69 Posted June 20, 2013 Report Share Posted June 20, 2013 I have installed a ChartFX license an operating system Windows XP, which generated a graph using vb.net and show this in a PDF. In this case the graphs are displayed correctly, correct size. But to generate this same chart on a Windows 7 32-bit, the graphics s is larger, outside the range of measures indicated. This also for operating systems Windows Server 2003, Windows Server 2008 R2. pdf_wrong.png image show the correct size of chart (green line) and the wrong size (red line). The error also occurs when printing, not only when generating a PDF. I appreciate your help. Greetings Quote Link to comment Share on other sites More sharing options...
AndreG Posted June 20, 2013 Report Share Posted June 20, 2013 To change the DPI of the chart you would need to create a Graphics object from a high resolution Bitmap and then use the Paint method to paint the chart to the Graphics. Here is the code you are looking for (for 300 DPI, for example). Rectangle r = new Rectangle (0, 0, (chart1.Width * 300) / 96, (chart1.Height * 300) / 96); Bitmap bmp = new Bitmap (r.Width, r.Height); bmp.SetResolution(300, 300); Graphics g = Graphics .FromImage(bmp); chart1.Paint(g, r, PaintStyles .Background | PaintStyles .Border | PaintStyles .Print); bmp.Save( @"c:\temp\cfxdpi.bmp" ); g.Dispose(); bmp.Dispose(); You can save the file in different formats: bmp.Save( @"c:\temp\cfx.jpg" , ImageFormat .Jpeg); bmp.Save( @"c:\temp\cfx.gif" , ImageFormat .Gif); bmp.Save( @"c:\temp\cfx.tif" , ImageFormat .Tiff); Then try printing the image file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.