473,396 Members | 2,018 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,396 software developers and data experts.

How do I remove a line segment from a PathGeometry in wpf

I have a .net 3.0 wpf app and using c# I need to do 2 things:

1) Get the last point in the path, or get the last linesegment in the path
where I could then get the last point.

2) Remove the last linesegment in the path

How can I do this?

any comments would be great. Thanks!

--
mo*******@newsgroup.nospam
Jun 27 '08 #1
8 5399
On Thu, 01 May 2008 21:20:39 -0700, moondaddy <mo*******@newsgroup.nospam>
wrote:
I have a .net 3.0 wpf app and using c# I need to do 2 things:

1) Get the last point in the path, or get the last linesegment in the
path
where I could then get the last point.

2) Remove the last linesegment in the path

How can I do this?
I'm just guessing, but looking at the docs (which is always a great place
to start when you have a question :) ), it looks to me as though you can
get a PathFigureCollection from your PathGeometry via the Figures
property. The collection offers the usual collection operations, such as
retrieving specific elements and adding or removing elements from the
collection.

Seems like that'd be a good place to start.

Pete
Jun 27 '08 #2
Thank Pete for your reply!

Hi Moondaddy,

What Pete has suggested is correct. The following is a sample code snippet
to remove the last segment from a PathFigure.

private void button1_Click(object sender, RoutedEventArgs e)
{
PathGeometry pg = this.path1.Data as PathGeometry;
// remove the last segment from the first PathFigure within the
PathFigureCollection of the PathGeometry
pg.Figures[0].Segments.RemoveAt(pg.Figures[0].Segments.Count -
1);
}

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 27 '08 #3
Thanks Linda that looks good. I see something I'm not familiar with.

Why do you use "as PathGeometry"? and not this:

PathGeometry pg = this.path1.Data;

Thanks again!
"Linda Liu[MSFT]" <v-****@online.microsoft.comwrote in message
news:AU**************@TK2MSFTNGHUB02.phx.gbl...
Thank Pete for your reply!

Hi Moondaddy,

What Pete has suggested is correct. The following is a sample code snippet
to remove the last segment from a PathFigure.

private void button1_Click(object sender, RoutedEventArgs e)
{
PathGeometry pg = this.path1.Data as PathGeometry;
// remove the last segment from the first PathFigure within the
PathFigureCollection of the PathGeometry
pg.Figures[0].Segments.RemoveAt(pg.Figures[0].Segments.Count -
1);
}

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.


Jun 27 '08 #4
See your previous posting for a complete sample that illustrates how to draw
a rounded rectangle using PathGeometry.

Willy.

"moondaddy" <mo*******@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thanks Linda that looks good. I see something I'm not familiar with.

Why do you use "as PathGeometry"? and not this:

PathGeometry pg = this.path1.Data;

Thanks again!
"Linda Liu[MSFT]" <v-****@online.microsoft.comwrote in message
news:AU**************@TK2MSFTNGHUB02.phx.gbl...
>Thank Pete for your reply!

Hi Moondaddy,

What Pete has suggested is correct. The following is a sample code
snippet
to remove the last segment from a PathFigure.

private void button1_Click(object sender, RoutedEventArgs e)
{
PathGeometry pg = this.path1.Data as PathGeometry;
// remove the last segment from the first PathFigure within
the
PathFigureCollection of the PathGeometry
pg.Figures[0].Segments.RemoveAt(pg.Figures[0].Segments.Count -
1);
}

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.



Jun 27 '08 #5
Hi Moondaddy,

Thanks for your prompt reply!

The Path.Data property is of type Geometry, which is an abstract base
class.

In our scenario, the type of the path1.Data property is actually
PathGeometry, which is derived from the type Geometry. So I use the "as"
operator in C# to convert this property to the type PathGeometry.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 27 '08 #6
Hi Moondaddy,

I am reviewing this post in the newsgroup and would like to know the status
of this issue.

If you have any other question, please feel free to let me know.

Thank you for using our Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 27 '08 #7
Thanks for your explanation as it helps me understand what's going on. it
works now.

"Linda Liu[MSFT]" <v-****@online.microsoft.comwrote in message
news:9b****************@TK2MSFTNGHUB02.phx.gbl...
Hi Moondaddy,

I am reviewing this post in the newsgroup and would like to know the
status
of this issue.

If you have any other question, please feel free to let me know.

Thank you for using our Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

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


Jun 27 '08 #8
Hi Moondaddy,

Thank you for your response!

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance.

Have a nice day!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 27 '08 #9

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

Similar topics

65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
7
by: Jacky Luk | last post by:
Does anyone know of a downloadable Line ActiveX control which allows me to plot straight lines on a VC++.NET form? Thanks Jack
1
by: rabirashmi | last post by:
I am finding it very difficult to implement the Bentley-Ottmann Line Segment Intersection Algorithm using C. Can any body help me
2
by: Chris9 | last post by:
I need to remove line breaks from a large ASCII table, but get a MemoryError. The data is an ASCII grid: the header takes up the first 6 lines followed by 22000 rows of data. I want to remove the...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.