TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
i gt prob with this code
Feb 23 2003 10:58 PM
not realli understand the code in the linked list in this program http://www.c-harpcorner.com/1/pbrush.asp can you tell me wat is this code is about? using System; using System.Runtime.Serialization; namespace workflowTool { ///
/// Summary description for LinkedList. ///
public class LinkedList { internal class Node { internal object m_ObjectToStore; internal Node m_Next; internal Node m_Previous; public Node(object objectToStore) { m_ObjectToStore = objectToStore; } } Node m_First; internal uint m_uiNumOfObjects; // These members are used to optimize enumeration. Another way could have been to // iterate till required node is found (which is costly). internal long m_lLastAccessed; internal Node m_LastAccessed; public LinkedList() { // // TODO: Add constructor logic here // m_First = null; m_uiNumOfObjects = 0; m_lLastAccessed = -1; } public void AddToEnd(object objToAdd) { if (m_First == null) { m_First = new Node(objToAdd); m_First.m_Next = m_First; m_First.m_Previous = m_First; ++m_uiNumOfObjects; return; } Node newNode = new Node(objToAdd); // Get the previous node. Node last = m_First.m_Previous; newNode.m_Next = last.m_Next; newNode.m_Previous = last.m_Previous; last.m_Next = newNode; m_First.m_Previous = newNode; ++m_uiNumOfObjects; } public void Clear() { m_First = null; m_uiNumOfObjects = 0; m_lLastAccessed = -1; } public uint Count { get { return m_uiNumOfObjects; } } public object this[uint uiIndex] { get { if (m_LastAccessed == null) { m_LastAccessed = m_First; m_lLastAccessed = 0; return m_First.m_ObjectToStore; } if (uiIndex < 0 || uiIndex >= m_uiNumOfObjects) { throw new IndexOutOfRangeException(); } ++m_lLastAccessed; m_LastAccessed = m_LastAccessed.m_Next; return m_LastAccessed.m_ObjectToStore; } } } } /**************************************************************************** public void OnMouseDown(object source, MouseEventArgs evtArgs) { // Here the draw action has started. if(count==0) { m_Start = new Point(evtArgs.X, evtArgs.Y); m_ShapeBeingDrawn = true; //this.MouseUp += new MouseEventHandler(OnMouseUp); //this.MouseMove += new MouseEventHandler(OnMouseMove); childObj.gObj.setSelect(false); childObj.gObj.setCount(-1); s[arrSize]=new Point(evtArgs.X, evtArgs.Y); arrSize=arrSize+1; //this.label1.Text=arrSize.ToString(); } } public void OnMouseUp(object source, MouseEventArgs evtArgs) { try { Shape shapeDrawn = GetShape(source, evtArgs); if (m_ShapesList == null) { m_ShapesList = new LinkedList(); } m_PreviousShape = null; m_ShapesList.AddToEnd(shapeDrawn); m_ShapeBeingDrawn = false; } catch(Exception e) { MessageBox.Show(e.Message); } } public void OnMouseMove(object source, MouseEventArgs evtArgs) { if (!m_ShapeBeingDrawn) { return; } if (m_PreviousShape != null) { m_PreviousShape.Draw(this); } m_PreviousShape = GetShape(source, evtArgs); m_PreviousShape.Draw(this); } /**************************************************************************** this.MouseDown += new MouseEventHandler(OnMouseDown); this.MouseUp += new MouseEventHandler(OnMouseUp); this.MouseMove += new MouseEventHandler(OnMouseMove);
Reply
Answers (
1
)
[Dx9 - Direct3D] World/View/Projection Matrices *The Horror!*
how to draw an arrow