コード例 #1
0
		protected ComplexLine(SerializationInfo info, StreamingContext context): base(info,context)
		{
			SuspendEvents = true;
			mSegments = (Segments) info.GetValue("Segments",typeof(Segments));
			if (Serialize.Contains(info,"AllowExpand")) mAllowExpand = info.GetBoolean("AllowExpand");
			
			SuspendEvents = false;
		}
コード例 #2
0
		public ComplexLine(Port start,Port end): base(start,end)
		{
			mSegments = new Segments();
			Segment segment = new Segment(Start,End);
			Segments.Add(segment);
			segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid);

			AllowExpand = true;
		}
コード例 #3
0
		public ComplexLine(ComplexLine prototype): base (prototype)
		{
			mSegments = new Segments();
			Segment segment = new Segment(Start, End);
			Segments.Add(segment);
			segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid);

			//Set up segments
			for (int i = 0; i < prototype.Segments.Count-1; i++)
			{
				segment = AddSegment(i+1,new Origin((PointF) prototype.Points[i+1])); 
				segment.Start.Marker = prototype.Segments[i+1].Start.Marker;
			}
			DrawPath();

			AllowExpand = prototype.AllowExpand;
		}
コード例 #4
0
        public ComplexLine(ComplexLine prototype) : base(prototype)
        {
            mSegments = new Segments();
            Segment segment = new Segment(Start, End);

            Segments.Add(segment);
            segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid);

            //Set up segments
            for (int i = 0; i < prototype.Segments.Count - 1; i++)
            {
                segment = AddSegment(i + 1, new Origin((PointF)prototype.Points[i + 1]));
                segment.Start.Marker = prototype.Segments[i + 1].Start.Marker;
            }
            DrawPath();

            AllowExpand = prototype.AllowExpand;
        }
コード例 #5
0
        public virtual void RemoveSegment(int position)
        {
            //Valid the position
            if (position < 1)
            {
                throw new ArgumentException("Position must be greater than zero.", "position");
            }
            if (position > Segments.Count)
            {
                throw new ArgumentException("Position can be greater than the total number of segments.", "position");
            }

            Origin end = Segments[position].End;

            Segments.RemoveAt(position);
            Segments[position - 1].SetEnd(end);

            DrawPath();
            OnElementInvalid();
        }
コード例 #6
0
		protected internal void SetSegments(Segments segments)
		{
			if (mSegments != null)
			{
				foreach (Segment segment in mSegments)
				{
					segment.SegmentInvalid -= new EventHandler(segment_SegmentInvalid);
				
					if (segment.End != End) segment.End.OriginInvalid -=new EventHandler(Origin_OriginInvalid);
				}
			}

			mSegments = segments;
			foreach (Segment segment in segments)
			{
				segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid);
				
				if (segment.End != End) segment.End.OriginInvalid +=new EventHandler(Origin_OriginInvalid);
			}
		}