Jump to content
Software FX Community

PrintDialog.PrintVisual() and Chart.UseEffects


wekelly
 Share

Recommended Posts

I could not get my chart to print. I narrowed it down to the Chart.UseEffects property. In the following, when UseEffects is false, the chart does not print. When UseEffects is true, the chart prints.

using System;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Input;

using ChartFX.WPF;

class Program

{

  [sTAThread]

  static void Main(string[] args)

  {

  bool isPrintSuccessful = false;

  Window w = new Window();

  Chart c = new Chart() { UseEffects = isPrintSuccessful };

  w.Content = c;

  // ctrl-p to print

  w.CommandBindings.Add(new CommandBinding(ApplicationCommands.Print, OnPrint));

  new Application().Run(w);

  }

  static void OnPrint(object sender, EventArgs e)

  {

  PrintDialog dlg = new PrintDialog();

  if (dlg.ShowDialog().Value)

  dlg.PrintVisual(sender as Window, "My Chart");

  }

}

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...