How could I create a custome Shape class


Author
Message
Hamdy Ghanem
Hamdy Ghanem
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1
I want to add more property for every shape
So I tried to create a cusom class that inherited from Nshape
but I failed because the Nshape has no new construction and is created by factory
How could I implement this functionality
Reply
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,

Here's a sample implementation of a class you can use as a Tag property for your shapes:

 

[Serializable]

public class NShapeExt : ICloneable

{

      public NShapeExt()

      {

            m_bMyProperty1 = true;

            m_sMyProperty2 = String.Empty;

      }

 

      public bool MyProperty1

      {

            get

            {

                  return m_bMyProperty1;

            }

            set

            {

                  m_bMyProperty1 = value;

            }

      }

      public string MyProperty2

      {

            get

            {

                  return m_sMyProperty2;

            }

            set

            {

                  m_sMyProperty2 = value;

            }

      }

 

      public object Clone()

      {

            NShapeExt shapeExt = new NShapeExt();

            shapeExt.m_bMyProperty1 = m_bMyProperty1;

            shapeExt.m_sMyProperty2 = m_sMyProperty2;

            return shapeExt;

      }

 

      private bool m_bMyProperty1;

      private string m_sMyProperty2;

}



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