Profile Picture

Getting NDrawingDocument bounds

Posted By Joseph King 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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



Joseph King
Posted 14 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 14 Years Ago
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.



Similar Topics


Reading This Topic