Profile Picture

Can not set location on horizontal line

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

Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)Forum Member (39 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 54, Visits: 60

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 4 Years Ago
View Quick Profile
Supreme Being

Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 2,888, Visits: 3,074
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