Getting NDrawingDocument bounds


Author
Message
Joseph King
Joseph King
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 1, Visits: 1

I have an instance of NDrawingDocument in which I have placed a number of objects and then used a layout manager to arrange them. The last thing I would like to do, before displaying the drawing to the user, is place a legend in the bottom right corner of my drawing. Unfortunately I am unable to find the bottom right corner. When I get the Bounds property for the NDrawingDocument instance it is not even close to the bottom right corner. It is in the bottom right quandrant but nowhere near the bottom right corner.

Any ideas on what I am doing wrong?

j.
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,

The document bounds are not the bounds of the viewport, that is the rectangle from the document space shown by the view. Placing a sticky shape at the bottom of the viewport can be achieved by subscribing for the view transformation changed event and repositioning the shape. For example:

NShape shape;
NDrawingView drawingView;

private void Form1_Load(object sender, EventArgs e)
{
drawingView = new NDrawingView();
drawingView.Dock = DockStyle.Fill;
Controls.Add(drawingView);

NDrawingDocument drawingDocument = new NDrawingDocument();
drawingView.Document = drawingDocument;

shape = new NRectangleShape(0, 0, 100, 100);
drawingDocument.ActiveLayer.AddChild(shape);

drawingView.TransformationsChanged += new EventHandler(view_TransformationsChanged);
}

void view_TransformationsChanged(object sender, EventArgs e)
{
NRectangleF bounds = shape.Bounds;
bounds.X = drawingView.Viewport.Right - shape.Bounds.Width;
bounds.Y = drawingView.Viewport.Bottom - shape.Bounds.Height;
shape.Bounds = bounds;
}

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