|
Group: Forum Members
Posts: 10,
Visits: 2
|
I found the answer by myself.
private NDrawingView diagramView = null; private NDiagramCommander commander = null;
diagramView = new NDrawingView () commander = new NDiagramCommander ()
commander.View = diagramView;
...
If i now want to put a "ZoomIn Button" on my GUI, i just send the command to the diagram in my OnClick for my Button:
public void ZoomIn() { NZoomInCommand command = new NZoomInCommand(); commander.Commands.Add(command); command.Execute(); }
The good is, all the Undo and Redo functions built in the diagram component works as well.
Some more Wrapper-Methods i build:
public void ZoomTo(ushort percent) { NZoomPercentCommand command = new NZoomPercentCommand(); commander.Commands.Add(command); command.Execute(percent.ToString()); }
public void ZoomWidth() { NZoomPercentCommand command = new NZoomPercentCommand(); commander.Commands.Add(command); command.Execute("Width"); }
public void ZoomHeight() { NZoomPercentCommand command = new NZoomPercentCommand(); commander.Commands.Add(command); command.Execute("Height"); }
public void ZoomFit() { NZoomPercentCommand command = new NZoomPercentCommand(); commander.Commands.Add(command); command.Execute("Fit"); }
public void Undo() { NUndoCommand command = new NUndoCommand(); commander.Commands.Add(command); command.Execute(); }
public void Redo() { NRedoCommand command = new NRedoCommand(); commander.Commands.Add(command); command.Execute(); }
public void AlignRight() { NAlignRightsCommand command = new NAlignRightsCommand(); commander.Commands.Add(command); command.Execute(); }
And so on ...
Kind Regards, Dieter
|