473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

WPF - How to edit points in a PolylineCollection.

I'm creating a sample project where I will adorn a Polyline with thumbs so I
can resize it by dragging its ends (and points) around. This is similar to
some projects I've posted using a ResizingAdorner class.

I've successfully adorned one end of the Polyline with a thumb so far. Now
when I drag the thumb I need to edit the point in the Polyline where the
thumb is attached (located). This is the first point in the collection. I
haven't found any way to access that point and change it's X/Y values. All
work is being done programmatically in c# and not xaml.

Can someone advise me here?

Also, do you know of any code samples or sample projects which resize and
move Polylines around? I'm trying to create something similar to the right
angle connectors in Visio.

Thanks.
--
mo*******@noemail.noemail
Jan 19 '07 #1
2 3634
Hi moondaddy,

Polyline has a property named Points which is of type PointCollection. You
need to know which point the Thumb is adorned to move the point around. I
think you could attach a property to Thumb and save the point index there.
When the Thumb is moved around, then you could retrieve the index and use
the index to determine which point to move. A point has x and y coordinates.

Sorry I didn't find any examples on such functionality.

Hope this helps.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 19 '07 #2
Thanks Walter.

I'm pretty close to this solution now. My obstacle is how to access that
point in the collection. rather than attaching a property to thumb, I
subclassed it so I could add a bunch of extra functionality which includes
the point.

OK I just got it. After a good nights sleep, this is what I learned.

I was trying to access the point in the collection from something like an
item 'collection.items(0)'. the problem is that I'm still trying to write
like VB. I just realized I can get to the item like this:
collection[0]=pt. (... still new to c# & wpf). I'm storing both the point
and its collection index in the subclassed thumb which makes this easy to
use.

You have been a huge help on this project. Have a great weekend!
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:oT**************@TK2MSFTNGHUB02.phx.gbl...
Hi moondaddy,

Polyline has a property named Points which is of type PointCollection. You
need to know which point the Thumb is adorned to move the point around. I
think you could attach a property to Thumb and save the point index there.
When the Thumb is moved around, then you could retrieve the index and use
the index to determine which point to move. A point has x and y
coordinates.

Sorry I didn't find any examples on such functionality.

Hope this helps.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jan 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kyler Laird | last post by:
I'm trying to do some georeferencing - using points of known location (ground control points, GCPs) on an image to develop a polynomial that can be used to approximate the locations of other...
15
by: bengee | last post by:
Hi Does anyone know of a way to edit "live" javascript (that i have no control over) in IE? Example, i visit a website and see a webpage in IE containing Javascript. Can i edit that...
2
by: bob | last post by:
Hello, I'm trying to use the datagrid control to edit normal objects, like a collection of 2D points. I've used DataGridTableStyle and DataGridColumnStyle to get it show the two properties, X...
27
by: Richard Blewett [DevelopMentor] | last post by:
I've just seen on Eric Gunnerson's blog that C# is getting Edit and Continue in Whidbey. That will please alot of people - although me, I have mixed feelings about it ;-) ...
2
by: Sin | last post by:
Hello everyone, I'm totally stumped at how little info I can find in MSDN or on the web concerning this. It's almost as if only microsoft personel hold the key to these secrets or something!!! ...
13
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after...
8
by: bevanward | last post by:
Hi all I have a large data set of points situated in 3d space. I have a simple primary key and an x, y and z value. What I would like is an efficient method for finding the group of points...
3
by: Wiebe Tijsma | last post by:
Hi, I'm looking for a way to be able to edit the source files in VS2005 while debugging. I don't mean edit-and-continue, and I really don't care if the debugger points to the wrong line after...
10
by: setar | last post by:
How can I edit an xml file which has 250MB? I tried to use UltraEdit, Visual Studio, Eclipse, Stylus Studio and XMLSpy editors but these programs can't read this file because it is too big. SmEdit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.