Hey,
I have set my application up to allow the user to select a portion of a diagram and then prompt them to either 1) copy the elements within the selection, 2) delete all items within the selection, or 3) zoom the view to the selection bounds. I do this by first first replacing the default mouse tool with my custom one:
m_modelerView.ReplaceMouseTool(typeof(GoToolRubberBanding), m_selectionTool);
The new mouse tool looks like this:
public class LRProcessModellerSelectionTool : GoToolRubberBanding
{
…
public override void DoRubberBand(Rectangle box)
{
RectangleF docRect = this.View.ConvertViewToDoc(box);
ZoomToRect(docRect);
}
}
I have the rectangle I want but when I try to zoom the view to that rectangle it does not work… can you let me know what I am doing wrong with how I am attempting to zoom?
private void ZoomToRect(RectangleF rect)
{
DiagramView.Document.Bounds = rect;
DiagramView.RescaleToFit();
}
Thanks!