CSharp/C# >> WPF - Is Path Closed

by sternr » Wed, 10 Sep 2008 14:34:51 GMT

Hey,
I'm writing a small paint-like app.
Using the following code I allow the client to use the "pen" object:

_geometry = new PathGeometry();
_figure = new PathFigure();
_path = new Path();
_geometry.Figures.Add(_figure);
_path.Data = _geometry;
_path.StrokeThickness = 4;
_path.Stroke = new SolidColorBrush(Colors.Red);
_path.Stretch = Stretch.UniformToFill;
_figure.StartPoint = e.MouseDevice.GetPosition(this);
_segment = new PolyLineSegment();
_figure.Segments.Add(_segment);
grdControls.Children.Add(_path);

And I add points on the MouseMove event using:
_segment.Points.Add(e.MouseDevice.GetPosition(this));

My question is, how can I know if the shape created by _path is
closed.
What is closed? en example a square or a circle with no holes in it.

How can I do it?

Thanks ahead

--sternr

Similar Threads

1. How to add a path inside of a border using c# and wpf

2. WPF - Closing Application - CSharp/C#

3. Help with template friend and ostream, I think I am close

I searched but couldn't find anything _quite_ like this.  I have some
code I inherited that needs some work.  Basically I have a template
that is instantiated in the c++ code and so only the headers are
distributed.   That works great, the only problem is that I cant get
the friend ostream inserter operator to work correctly.  Basically
it never is instantiated so it never shows up in the library.   Here is
a (close to) minimum example demonstrating the problem.  I want
to be able to do this without having all the code in the header since
I know what instances I will need.  Thanks in advance -- I believe
I am close on this, but just can't quite get it.

// Foo.hh
using namespace::std;
#include <iostream>

template<int> class Foo;
template<int mp>
std::ostream & operator<< (std::ostream&, const Foo<mp> &);

template<int mp>
class Foo {
   public:
      char x[mp];
      Foo();
      friend std::ostream & operator<< <>(std::ostream&,const Foo<mp> &);
};

// end of Foo.hh

// Foo.cc

#include "Foo.hh"

template<int mp>
Foo<mp>::Foo()
{
   int i;
   for (i=0;i<mp;i++);
      x[i] = i;
}

template<int mp>
std::ostream & operator<< (std::ostream&, const Foo<mp> &)
{
   cout << "Nothing" << endl;
}

template class Foo<2>;

// end of Foo.cc


If I try to link this code when trying to use cout with an instance of 
Foo<2>:

/tmp/test/Main.cc:8: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& operator<< <(int)2>(std::basic_ostream<char,
std::char_traits<char> >&, Foo<(int)2> const&)'

And to confirm an nm on the object file Foo.o gives me:

nm --demangle Foo.o
00000054 t global constructors keyed to _ZN3FooILi2EEC1EvFoo.ccAPePOb
00000000 t __static_initialization_and_destruction_0(int, int)
00000000 W Foo<2>::Foo()
00000000 W Foo<2>::Foo()
         U std::ios_base::Init::Init()
         U std::ios_base::Init::~Init()
00000000 b std::__ioinit
         U __cxa_atexit
         U __dso_handle
         U __gxx_personality_v0
00000040 t __tcf_0



4. Help with template friend and ostream g++, I think I am close

5. Help - Am I going down the garden path?

Couple of questions for all of you.

My web pages are currently using my web services to fetch all of there data 
as xml.  The xml is placed in a MSXM4 object then rendered client side with 
xslt.  This works fine, now getting the data back.

I would like to update the client side xml with the changed values from the 
form, easy enough.  Then send that data back to the web service.  So here 
are my questions

1. Can I use the XMLHTTP object in JScript to create a post back to to a web 
service?
2. If I wish to embed the xml into the XMLHTTP.send method call do I need to 
start using soap?
3. If I am using soap do I need to create a proxy of the webservice in order 
for the WSDL to be created?
4. If I am using soap, can I embed a document that the user has requested to 
be updated.  Can this be placed within the soap packet along with other xml?

Not looking for how you do it simply want to find out if I am on the right 
path or not with some links.  Been reading all weekend both books and 
on-line and nothing seems to give a clear answer or example.  The reason I 
am using web services to post my data is because at a later date the 
services will be made available to 3rd party vendors, right once use many 
idea!

Any thoughts would be appreciated.

Cheers
Keith

PS: Running .NET framework 1.1 on Win2k 


6. loosing Collection properties when I am Closing MS Visual Studio IDE

7. WPF-How to add color to Tree View created dynamically in WPF

I am trying to add color to tree View in WPF.

I am trying to use following line but it does not work:

item.Foreground =  System.Drawing.Color.Red;



 -------------------------------------------------------------------------------------------------TreeViewItem item = new TreeViewItem();item.Tag ="10"item.Header = "Test1"//FOLLOWING LINE DOES NOT WORKtem.Foreground =  System.Drawing.Color.Red;item.Items.Add("*");tree.Items.Add(item);ThanksDNB

8. To WPF or not to WPF, that is the question - CSharp/C#