protected override void OnBeforeOffsetChanged(OffsetEventArgs offsetArgs)
 {
     if (_PositionAlg != null)
     {
         _PositionAlg (this, offsetArgs);
     }
 }
        public override void Offset(System.Drawing.Point offset)
        {
            OffsetEventArgs offsetArgs = new OffsetEventArgs (offset);

            OnBeforeOffsetChanged (offsetArgs);
            _Centre.Offset (offsetArgs.Offset.X, offsetArgs.Offset.Y);
            DoOffsetChanged (offsetArgs);
        }
		private void vertical_ContactPoint (IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			if (glyph is IOperationContactPointGlyph)
			{
				int expectedXPos = _Bounds.X + _Bounds.Width / 2;
				int currentXPos = glyph.Bounds.X + glyph.Bounds.Width / 2;
				offsetEventArgs.Offset = new Point (expectedXPos - currentXPos, offsetEventArgs.Offset.Y);
			}
		}
		private void horizontal_ContactPoint (IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			if (glyph is IOperationContactPointGlyph)
			{
				int expectedYPos = _Bounds.Y + _Bounds.Height / 2;
				int currentYPos = glyph.Bounds.Y + glyph.Bounds.Height / 2;
				offsetEventArgs.Offset = new Point (offsetEventArgs.Offset.X, expectedYPos - currentYPos);
			}
		}
 protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
 {
     int index = _ContactPoints.IndexOf (glyph);
     switch (index)
     {
         case 0:
         {
             _From.Offset (offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
         } break;
         case 1:
         {
             _To.Offset (offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
         } break;
     }
 }
		protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			Point offset = offsetEventArgs.Offset;
			int index = _ContactPoints.IndexOf (glyph);
			if (glyph is IOperationPortGlyph)
			{
				_Bounds.Offset (offset);
				foreach (IGlyph contactPoint in ContactPoints)
				{
					if (contactPoint is IOperationContactPointGlyph)
					{
						ReOffsetContactPoint (contactPoint, offset);
					}
				}
			} 
			else 
			{
				switch (index)
				{
					case 0: 
					{
						_Bounds.X += offset.X; 
						_Bounds.Width -= offset.X; 
						_Bounds.Height += offset.Y;
						ReOffsetContactPoint (2, offset); 
						ReOffsetContactPoint (3, offset);
					} break;
					case 1: 
					{
						_Bounds.Width += offset.X; 
						_Bounds.Height += offset.Y; 
						ReOffsetContactPoint (2, offset);
						ReOffsetContactPoint (3, offset);
					} break;
					case 2: 
					{ 
						_Bounds.Y += offset.Y; 
						_Bounds.Height -= offset.Y; 
						_Bounds.Width += offset.X; 
						ReOffsetContactPoint (0, offset);
						ReOffsetContactPoint (1, offset);
					} break;
					case 3: 
					{
						_Bounds.Height += offset.Y; 
						_Bounds.Width += offset.X; 
						ReOffsetContactPoint (0, offset);
						ReOffsetContactPoint (1, offset);
					} break;
				}
			}
		}
 protected abstract void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs);
 protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
 {
     Point offset = offsetEventArgs.Offset;
     int index = _ContactPoints.IndexOf (glyph);
     switch (index)
     {
         case 0:
         {
             _Bounds.X += offset.X;
             _Bounds.Width -= offset.X;
             _Bounds.Height += offset.Y;
             ReOffsetContactPoint (2, offset);
             ReOffsetContactPoint (3, offset);
         } break;
         case 1:
         {
             _Bounds.Width += offset.X;
             _Bounds.Height += offset.Y;
             ReOffsetContactPoint (2, offset);
             ReOffsetContactPoint (3, offset);
         } break;
         case 2:
         {
             _Bounds.Y += offset.Y;
             _Bounds.Height -= offset.Y;
             _Bounds.Width += offset.X;
             ReOffsetContactPoint (0, offset);
             ReOffsetContactPoint (1, offset);
         } break;
         case 3:
         {
             _Bounds.Height += offset.Y;
             _Bounds.Width += offset.X;
             ReOffsetContactPoint (0, offset);
             ReOffsetContactPoint (1, offset);
         } break;
     }
 }
 protected virtual bool OnOffsetChanged(OffsetEventArgs offsetArgs)
 {
     return true;
 }
 protected virtual void OnBeforeOffsetChanged(OffsetEventArgs offsetArgs)
 {
 }
 protected void DoOffsetChanged(OffsetEventArgs offsetArgs)
 {
     if (OnOffsetChanged (offsetArgs))
     {
         if (OffsetChanged != null)
         {
             OffsetChanged (this, offsetArgs);
         }
     }
 }