jzdecourcy Posted March 25, 2008 Report Share Posted March 25, 2008 I have a simple radial gauge with a custom background image that looks fine in the browser (IE 6+), but when viewed in print preview or actually printed the labels for the main scale become "blotchy". Is there some trick to configuring a gauge for optimum printability? Quote Link to comment Share on other sites More sharing options...
maximop Posted April 9, 2008 Report Share Posted April 9, 2008 Unfortunately, there is no way to optimize the look for the gauge labels; however, as a workaround, you could export the gauge to a memory stream, and draw the image directly to the Print Object in the PrintPage() Event using GDI+. You could provide a button in your application for PrintPreview, for example, which will fire this PrintPage() event thus showing the gauge image with much better quality. Below, please find a code snippet on how to implement this solution: public partial class _Default : System.Web.UI.Page { private MemoryStream ms;protected void Page_Load(object sender, EventArgs e) {ms = new MemoryStream(); RadialGauge1.MainValue = 75; RadialGauge1.MainScale.Min = 0;RadialGauge1.MainScale.MinAlwaysDisplayed = true; RadialGauge1.MainScale.Max = 100; RadialGauge1.MainScale.MaxAlwaysDisplayed = true;RadialGauge1.Export(ImageFormat.Jpeg, ms); ms.Position = 0; PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);System.Windows.Forms.PrintPreviewDialog ppd = new System.Windows.Forms.PrintPreviewDialog(); ppd.Document = pd; ppd.ShowDialog(); } void pd_PrintPage(object sender, PrintPageEventArgs e) {e.Graphics.DrawImage(System.Drawing.Image.FromStream(ms), new Point(25, 25)); } } 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.