Hi Panos,
The problem is generally caused (as stated by Christo), by the image filters used in certain types of shadow and it is a problem with the MS Print Preview. In detail the problem is that GDI+ does not have a good way to render image filters so we do it ourselves using custom image processing - this greatly improves the looks of the component, but has a drawback when rendering large images (which is the case in printers where a typical image on the screen is stretched by factor of 6 (on a 600dpi printer) thereby increasing the rendering complexity for filters by a factor of 36. This is partially overcome in the latest SP of the componet, but some more work remains - MS have done a very poor job with the extended metafiles and we'll have to find a way not to use them.
For the time being I would recommend you to turn off image filters prior printing. This can easily be achieved using the following code (sorry about the formatting Word is a mess):
using Nevron.Diagram.Filters;
using Nevron.Diagram.Extensions;
using Nevron.Diagram.WinForm;
using Nevron.Diagram;
using Nevron.GraphicsCore;
private void PrintPreviewButton_Click(object sender, EventArgs e)
{
MemoryStream stream = new MemoryStream();
// save to stream
NPersistencyManager manager = new NPersistencyManager();
manager.PersistentDocument.Sections.Add(new NPersistentSection("Document", nDrawingDocument1));
manager.SaveToStream(stream, Nevron.Serialization.PersistencyFormat.Binary, null);
// load from stream
stream.Seek(0, SeekOrigin.Begin);
manager.LoadFromStream(stream, Nevron.Serialization.PersistencyFormat.Binary, null);
NDrawingDocument printDrawing = manager.PersistentDocument.Sections[0].Object as NDrawingDocument;
NShadowStyle shadowStyle;
NFillStyle fillStyle;
// traverse nodes etc.
foreach (INStyleable shape in printDrawing.Descendants(NFilters.TypeINStyleable, -1))
{
NStyle style = shape.Style;
if (style == null)
continue;
shadowStyle = style.ShadowStyle;
if (shadowStyle != null)
{
// make sure shadow style does not use filters
shadowStyle.Type = ShadowType.Solid;
shadowStyle.Color = Color.FromArgb((int)(shadowStyle.Color.A * 0.8), shadowStyle.Color);
}
fillStyle = style.FillStyle;
if (fillStyle != null)
{
// make sure fill style does not use filters
fillStyle.ImageFiltersStyle = null;
}
}
// do not forget to turn of shadow and image filters on document level
shadowStyle = printDrawing.Style.ShadowStyle;
if (shadowStyle != null)
{
// make sure shadow style does not use filters
shadowStyle.Type = ShadowType.Solid;
shadowStyle.Color = Color.FromArgb((int)(shadowStyle.Color.A * 0.8), shadowStyle.Color);
}
fillStyle = printDrawing.Style.FillStyle;
if (fillStyle != null)
{
fillStyle.ImageFiltersStyle = null;
}
NPrintManager printManager = new NPrintManager(printDrawing);
printManager.ShowPrintPreview();
}
The idea of the code is first to create a clone of the document, and then to modify it so that all shadows are made solid (instead of linear / gaussian blurred). This will increase the performance dramatically. BTW if you download the latest SP of the component it can display the document with image filters, but again it will be slow.
Hope I helped – let me know if you have any questions or meet any problems.
Best Regards,
Bob