Can not set location on horizontal line


Author
Message
Jason Irby
Jason Irby
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
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
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 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


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