Profile Picture

Can not set location on horizontal line

Posted By Jason Irby 8 Years Ago
Author
Message
Jason Irby
Posted 8 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 59, Visits: 77

I have a NLineShape that I am trying to move by programatically.
It has a start location and has a width, but because it is exactly horizontal the bounds height is 0;

When I try and do 

myLine.Location = new NPointF(10.0f,10.0f);

It throws an exception complaining that the new bounds can not have a 0 height or width.
If the line is NOT exactly horizontal by even a pixel, this error does not occur.

Can I change the horizontal lines location without it throwing that exception?

Thanks in advance,
Jason 




Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi,

The best way to move a shape is to use its Translate method. For example, to move a line shape 40 pixels down, you can use the following line of code:

// Move the line shape
lineShape.Translate(0, 40);

// Repaint the view
document.SmartRefreshAllViews();


Alternatively, you can change the StartPoint and EndPoint of the line shape.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic