NPrinterManager - PrintOnSinglePage


Author
Message
Mohamed Koker
Mohamed Koker
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)
Group: Forum Members
Posts: 2, Visits: 1
Hi All,

I upgraded to version 12.12.17.12 recently and found the following code no longer compiles:

NPrintManager printManager = new NPrintManager(document);
printManager.PrintOnSinglePage = true;

I would be grateful for any help in getting this code to compile.

Thanks in advance

-Mohamed
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi,

This is a complete working sample that substitudes the print preview command.

using System;

using System.Windows.Forms;

using Nevron.Diagram;

using Nevron.Diagram.Extensions;

using Nevron.Diagram.WinForm;

using Nevron.Diagram.WinForm.Commands;

namespace WindowsFormsApplication15

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

NDrawingView view = new NDrawingView();

view.Dock = DockStyle.Fill;

Controls.Add(view);

view.Document = new NDrawingDocument();

NDiagramCommandBarsManager manager = new NDiagramCommandBarsManager();

manager.ParentControl = this;

manager.View = view;

MyPrintPreviewCommand.UpdateCmdBarManager(manager);

}

}

public class MyPrintPreviewCommand : NPrintPreviewCommand

{

public override void Execute()

{

if (Commander == null)

return;

NDrawingDocument document = Commander.Document;

if (document == null)

return;

NPrintManager manager = new NPrintManager(document);

manager.Layout = Nevron.GraphicsCore.PagedLayout.FitToPages;

try

{

manager.ShowPrintPreview();

}

catch (Exception ex)

{

MessageBox.Show("Failed to show the print preview dialog. Exception was: " + ex.Message);

}

}

public static void UpdateCmdBarManager(NDiagramCommandBarsManager cmdBarManager)

{

NDiagramCommand oldCommand = cmdBarManager.Commander.Commands.GetCommandFromId((int)DiagramCommand.PrintPreview);

cmdBarManager.Commander.Commands.Remove(oldCommand);

cmdBarManager.Commander.Commands.Add(new MyPrintPreviewCommand());

cmdBarManager.Recreate();

}

}

}

Parhaps there is another reason for the code not to work in your enviroment.

 



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search