Пример #1
0
 private void OnControlRemoved(BehaviorControl c)
 {
     if (ControlAdded != null)
     {
         ControlRemoved(c);
     }
 }
Пример #2
0
        /// <summary>
        /// Gets the Behavior control that is located at the specified point and allows mouse wheel events.
        /// </summary>
        /// <param name="point">A Point that contains the coordinates where you want to look for a control.
        ///	Coordinates are expressed relative to the upper-left corner of the control's client area.</param>
        /// <returns>Behavior control at the specified point.</returns>
        internal BehaviorControl GetMouseWheelBehaviorControlAtPoint(Point point)
        {
            //	Enumerate the Behavior controls, in Z order, to locate one at the virtual point.
            for (int index = Controls.Count - 1; index >= 0; index--)
            {
                //	Access the Behavior control.
                BehaviorControl BehaviorControl = Controls[index];

                //	If the Behavior control is visible, and the point is within its virtual
                //	bounds, then recursively call it sit is under the point.
                if (BehaviorControl.Visible && BehaviorControl.VirtualBounds.Contains(point))
                {
                    //	Translate the point to be relative to the location of the Behavior control.
                    point.Offset(BehaviorControl.VirtualLocation.X * -1, BehaviorControl.VirtualLocation.Y * -1);

                    //	Recursively search for the right mouse wheel Behavior control.
                    BehaviorControl childMouseWheelBehaviorControl = BehaviorControl.GetMouseWheelBehaviorControlAtPoint(point);
                    if (childMouseWheelBehaviorControl != null)
                    {
                        return(childMouseWheelBehaviorControl);
                    }
                }
            }

            //	The point is not inside a child Behavior control of this Behavior control
            //	that allows mouse wheel events.  So it's inside this Behavior control.  If this
            //	Behavior control allows mouse wheel events, return it.  Otherwise, return null.
            return(AllowMouseWheel ? this : null);
        }
        /// <summary>
        /// Gets the lightweight control that is located at the specified client point and allows
        /// mouse wheel events.
        /// </summary>
        /// <param name="point">A point that contains the coordinates where you want to look for a
        /// control. Coordinates are expressed relative to the upper-left corner of the control's
        /// client area.</param>
        /// <returns>The BehaviorControl at the specified client point that allows mouse wheel
        /// events.  If there is no BehaviorControl at the specified client point that allows
        /// mouse wheel events, the GetBehaviorControlAtClientPoint method returns a null
        /// reference.</returns>
        private BehaviorControl GetMouseWheelBehaviorControlAtClientPoint(Point point)
        {
            //	Map the client point to a virtual client point.
            point = ClientPointToVirtualClientPoint(point);

            //	Enumerate the lightweight controls, in Z order, to locate one at the virtual point.
            for (int index = Controls.Count - 1; index >= 0; index--)
            {
                //	Access the lightweight control.
                BehaviorControl BehaviorControl = Controls[index];

                //	If the lightweight control is visible, and the virtual client point is inside
                //	it, translate the virtual client point to be relative to the location of the
                //	lightweight control and recursively ask the lightweight control to return the
                //	lightweight control at the virtual client point that supports mouse wheel
                //	events.  This will find the innermost lightweight control, at the top of the
                //	Z order that contains the virual client point and supports mouse wheel events.
                if (BehaviorControl.Visible && BehaviorControl.VirtualBounds.Contains(point))
                {
                    //	Translate the virtual point to be relative to the location of the lightweight control.
                    point.Offset(BehaviorControl.VirtualLocation.X * -1, BehaviorControl.VirtualLocation.Y * -1);

                    //	Recursively get the lightweight control at the translated point that
                    //	supports mouse wheel events.
                    return(BehaviorControl.GetMouseWheelBehaviorControlAtPoint(point));
                }
            }

            //	The client point is not inside any lightweight control that allows mouse wheel
            //	events.
            return(null);
        }
Пример #4
0
        /// <summary>
        /// Brings the Behavior control to the front of the z-order.
        /// </summary>
        /// <param name="value"></param>
        public void BringToFront(BehaviorControl value)
        {
            //	Remove the Behavior control from the list.
            List.Remove(value);

            //	Add the Behavior control back to the list, now as the front control in the z-order.
            List.Add(value);

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
        /// <summary>
        /// Raises the MouseWheel event.
        /// </summary>
        /// <param name="e">A MouseEventArgs that contains the event data.</param>
        protected virtual void OnMouseWheel(MouseEventArgs e)
        {
            //	Find the lightweight control at the mouse position.
            BehaviorControl mouseWheelLightweightControl = GetMouseWheelBehaviorControlAtClientPoint(new Point(e.X, e.Y));

            //	If we have a mouse wheel lightweight control, raise its MouseWheel event.  Otherwise,
            //	call the base class's method to raise the MouseWheel event on this control.
            if (mouseWheelLightweightControl != null)
            {
                mouseWheelLightweightControl.RaiseMouseWheel(TranslateMouseEventArgsForBehaviorControl(e, mouseWheelLightweightControl));
            }
        }
Пример #6
0
        /// <summary>
        /// Removes a specific <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> from the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to remove from the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .</param>
        /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
        public void Remove(BehaviorControl value)
        {
            //	Remove the Behavior control.
            List.Remove(value);

            //	Set the Behavior control container of the Behavior control.
            value.ContainerControl = null;

            OnControlRemoved(value);

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
 /// <summary>
 /// Recursively lays out all lightweight controls in this lightweight control.
 /// </summary>
 /// <param name="BehaviorControlContainerControl"></param>
 private void aLayoutBehaviorControls(IBehaviorControlContainerControl BehaviorControlContainerControl)
 {
     //	If there are lightweight controls to layout, enumerate them.
     if (BehaviorControlContainerControl.Controls != null)
     {
         //	Enumerate the child lightweight controls and layout each one.
         foreach (BehaviorControl BehaviorControl in BehaviorControlContainerControl.Controls)
         {
             //	Recursively layout all the lightweight controls in the lightweight control,
             //	then layout the lightweight control.
             aLayoutBehaviorControls(BehaviorControl);
             BehaviorControl.PerformLayout();
         }
     }
 }
        public ResizableElementBehavior(IHtmlEditorComponentContext editorContext)
            : base(editorContext)
        {
            _dragBufferControl         = new BehaviorControl();
            _dragBufferControl.Visible = false;

            _resizerControl = new ResizerControl();
            _resizerControl.SizerModeChanged += new SizerModeEventHandler(resizerControl_SizerModeChanged);
            _resizerControl.Resized          += new EventHandler(resizerControl_Resized);
            _resizerControl.Visible           = false;

            Controls.Add(_dragBufferControl);
            Controls.Add(_resizerControl);

            _dragDropController = new SmartContentDragAndDropSource(editorContext);
        }
Пример #9
0
        /// <summary>
        /// Inserts a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> into the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> at the specified index.
        /// </summary>
        /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
        /// <param name=' value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to insert.</param>
        /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.Add'/>
        public void Insert(int index, BehaviorControl value)
        {
            //	Insert.
            List.Insert(index, value);

            OnControlAdded(value);

            //	Set the Behavior control container of the Behavior control to the owner of
            //	this Behavior control collection.
            value.ContainerControl = owner;

            //	Force the Behavior control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
Пример #10
0
        /// <summary>
        /// Clears the Behavior control collection.
        /// </summary>
        public new void Clear()
        {
            //	Make a working copy of the Behavior control list.
            BehaviorControl[] BehaviorControls = new BehaviorControl[Count];
            CopyTo(BehaviorControls, 0);

            //	Remove each Behavior control.
            foreach (BehaviorControl BehaviorControl in BehaviorControls)
            {
                OnControlRemoved(BehaviorControl);
                BehaviorControl.ContainerControl = null;
                BehaviorControl.Dispose();
            }

            //	Force the owner to apply layout logic to child controls.
            owner.PerformLayout();
        }
        public ResizableElementBehavior(IHtmlEditorComponentContext editorContext)
            : base(editorContext)
        {
            _dragBufferControl = new BehaviorControl();
            _dragBufferControl.Visible = false;

            _resizerControl = new ResizerControl();
            _resizerControl.SizerModeChanged += new SizerModeEventHandler(resizerControl_SizerModeChanged);
            _resizerControl.Resized += new EventHandler(resizerControl_Resized);
            _resizerControl.Visible = false;

            Controls.Add(_dragBufferControl);
            Controls.Add(_resizerControl);

            _dragDropController = new SmartContentDragAndDropSource(editorContext);

        }
        /// <summary>
        /// Adds a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> with the specified value to the
        /// <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to add.</param>
        /// <returns>The index at which the new element was inserted.</returns>
        /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.AddRange'/>
        public int Add(BehaviorControl value)
        {
            //	Add.
            int index = List.Add(value);

            //	Set the Behavior control container of the Behavior control to the owner of
            //	this Behavior control collection.
            value.ContainerControl = owner;

            OnControlAdded(value);

            //	Force the Behavior control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();

            //	Return index.
            return index;
        }
Пример #13
0
        /// <summary>
        /// Adds a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> with the specified value to the
        /// <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to add.</param>
        /// <returns>The index at which the new element was inserted.</returns>
        /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.AddRange'/>
        public int Add(BehaviorControl value)
        {
            //	Add.
            int index = List.Add(value);

            //	Set the Behavior control container of the Behavior control to the owner of
            //	this Behavior control collection.
            value.ContainerControl = owner;

            OnControlAdded(value);

            //	Force the Behavior control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();

            //	Return index.
            return(index);
        }
        /// <summary>
        /// Update the mouse lightweight control.  Detects whether the mouse lightweight control
        /// has changed, and raises the appropriate events if it has.
        /// </summary>
        private void UpdateMouseBehaviorControl(Point point)
        {
            //	Find the lightweight control at the mouse position.
            BehaviorControl BehaviorControl = GetMouseBehaviorControlAtClientPoint(point);

            //	If the mouse lightweight control is changing, make the change.
            if (BehaviorControl != MouseBehaviorControl)
            {
                //	If we have a mouse lightweight control, raise its MouseLeave event.
                //	Otherwise, call the base class's method to raise the MouseLeave event on
                //	this control.
                if (MouseBehaviorControl != null)
                {
                    if (MouseBehaviorControl.ContainerControl != null)
                    {
                        MouseBehaviorControl.RaiseMouseLeave(EventArgs.Empty);
                    }
                }
                else
                {
                    OnMouseLeave(EventArgs.Empty);
                }

                //	Set the mouse lightweight control.
                MouseBehaviorControl = BehaviorControl;

                //	If we have a mouse lightweight control, raise its MouseEnter event.
                //	Otherwise, call the base class's method to raise the MouseEnter event on
                //	this control.
                if (MouseBehaviorControl != null)
                {
                    MouseBehaviorControl.RaiseMouseEnter(EventArgs.Empty);
                }
                else
                {
                    OnMouseEnter(EventArgs.Empty);
                }
            }
        }
Пример #15
0
        /// <summary>
        /// Gets the Behavior control that is located at the specified point.
        /// </summary>
        /// <param name="point">A Point that contains the coordinates where you want to look for a control.
        ///	Coordinates are expressed relative to the upper-left corner of the control's client area.</param>
        /// <returns>Behavior control at the specified point.</returns>
        internal BehaviorControl GetBehaviorControlAtPoint(Point point)
        {
            //	Enumerate the Behavior controls, in Z order, to locate one at the virtual point.
            for (int index = Controls.Count - 1; index >= 0; index--)
            {
                //	Access the Behavior control.
                BehaviorControl BehaviorControl = Controls[index];

                //	If the Behavior control is visible, and the point is within its virtual
                //	bounds, then recursively search for the right control.
                if (BehaviorControl.Visible && BehaviorControl.VirtualBounds.Contains(point))
                {
                    //	Translate the point to be relative to the location of the Behavior control.
                    point.Offset(BehaviorControl.VirtualLocation.X * -1, BehaviorControl.VirtualLocation.Y * -1);

                    //	Recursively search for the right Behavior control.
                    return(BehaviorControl.GetBehaviorControlAtPoint(point));
                }
            }

            //	The point is not inside a child Behavior control of this Behavior control,
            //	so it's inside this Behavior control.
            return(this);
        }
Пример #16
0
 /// <summary>
 /// Gets a value indicating whether the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> contains the specified <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to locate.</param>
 /// <returns><see langword='true'/> if the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> is contained in the collection; otherwise, <see langword='false'/>.</returns>
 /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.IndexOf'/>
 public bool Contains(BehaviorControl value)
 {
     return(List.Contains(value));
 }
Пример #17
0
 /// <summary>
 /// Returns the index of a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> in the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to locate.</param>
 /// <returns>The index of the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> of <paramref name='value'/> in the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/>, if found; otherwise, -1.</returns>
 /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.Contains'/>
 public int IndexOf(BehaviorControl value)
 {
     return(List.IndexOf(value));
 }
 /// <summary>
 ///	Initializes a new instance of <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> containing any array of <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> objects.
 /// </summary>
 /// <param name='value'>
 /// A array of <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> objects with which to intialize the collection
 /// </param>
 public BehaviorControlCollection(BehaviorControl[] value)
 {
     AddRange(value);
 }
 /// <summary>
 /// <para>Copies the elements of an array to the end of the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/>.</para>
 /// </summary>
 /// <param name='value'>An array of type <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> containing the objects to add to the collection.</param>
 /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.Add'/>
 public void AddRange(BehaviorControl[] value)
 {
     for (int i = 0; i < value.Length; i++)
         this.Add(value[i]);
 }
        /// <summary>
        /// Removes a specific <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> from the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to remove from the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .</param>
        /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
        public void Remove(BehaviorControl value)
        {
            //	Remove the Behavior control.
            List.Remove(value);

            //	Set the Behavior control container of the Behavior control.
            value.ContainerControl = null;

            OnControlRemoved(value);

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
        /// <summary>
        /// Inserts a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> into the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> at the specified index.
        /// </summary>
        /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
        /// <param name=' value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to insert.</param>
        /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.Add'/>
        public void Insert(int index, BehaviorControl value)
        {
            //	Insert.
            List.Insert(index, value);

            OnControlAdded(value);

            //	Set the Behavior control container of the Behavior control to the owner of
            //	this Behavior control collection.
            value.ContainerControl = owner;

            //	Force the Behavior control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
        /// <summary>
        /// Update the mouse lightweight control.  Detects whether the mouse lightweight control
        /// has changed, and raises the appropriate events if it has.
        /// </summary>
        private void UpdateMouseBehaviorControl(Point point)
        {
            //	Find the lightweight control at the mouse position.
            BehaviorControl BehaviorControl = GetMouseBehaviorControlAtClientPoint(point);

            //	If the mouse lightweight control is changing, make the change.
            if (BehaviorControl != MouseBehaviorControl)
            {
                //	If we have a mouse lightweight control, raise its MouseLeave event.
                //	Otherwise, call the base class's method to raise the MouseLeave event on
                //	this control.
                if (MouseBehaviorControl != null)
                {
                    if (MouseBehaviorControl.ContainerControl != null)
                        MouseBehaviorControl.RaiseMouseLeave(EventArgs.Empty);
                }
                else
                    OnMouseLeave(EventArgs.Empty);

                //	Set the mouse lightweight control.
                MouseBehaviorControl = BehaviorControl;

                //	If we have a mouse lightweight control, raise its MouseEnter event.
                //	Otherwise, call the base class's method to raise the MouseEnter event on
                //	this control.
                if (MouseBehaviorControl != null)
                    MouseBehaviorControl.RaiseMouseEnter(EventArgs.Empty);
                else
                    OnMouseEnter(EventArgs.Empty);
            }
        }
        /// <summary>
        /// Translates the specified MouseEventArgs for the specified lightweight control.
        /// </summary>
        /// <param name="e">MouseEventArgs to translate.</param>
        /// <returns>Translated MouseEventArgs.</returns>
        private MouseEventArgs TranslateMouseEventArgsForBehaviorControl(MouseEventArgs e, BehaviorControl BehaviorControl)
        {
            //	Map the client point to a virtual point.
            Point virtualPoint = BehaviorControl.PointToVirtualClient(new Point(e.X, e.Y));

            //	Return a new MouseEventArgs with the translated point.
            return(new MouseEventArgs(e.Button, e.Clicks, virtualPoint.X, virtualPoint.Y, e.Delta));
        }
 /// <summary>
 /// Gets a value indicating whether the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> contains the specified <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to locate.</param>
 /// <returns><see langword='true'/> if the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> is contained in the collection; otherwise, <see langword='false'/>.</returns>
 /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.IndexOf'/>
 public bool Contains(BehaviorControl value)
 {
     return List.Contains(value);
 }
        /// <summary>
        /// Clears the Behavior control collection.
        /// </summary>
        public new void Clear()
        {
            //	Make a working copy of the Behavior control list.
            BehaviorControl[] BehaviorControls = new BehaviorControl[Count];
            CopyTo(BehaviorControls, 0);

            //	Remove each Behavior control.
            foreach (BehaviorControl BehaviorControl in BehaviorControls)
            {
                OnControlRemoved(BehaviorControl);
                BehaviorControl.ContainerControl = null;
                BehaviorControl.Dispose();
            }

            //	Force the owner to apply layout logic to child controls.
            owner.PerformLayout();
        }
 private void controls_ControlRemoved(BehaviorControl c)
 {
     c.VirtualLocationChanged -= new EventHandler(c_VirtualLocationChanged);
     c.VirtualSizeChanged -= new EventHandler(c_VirtualSizeChanged);
     c.VisibleChanged -= new EventHandler(c_VisibleChanged);
 }
        /// <summary>
        /// Translates the specified MouseEventArgs for the specified lightweight control.
        /// </summary>
        /// <param name="e">MouseEventArgs to translate.</param>
        /// <returns>Translated MouseEventArgs.</returns>
        private MouseEventArgs TranslateMouseEventArgsForBehaviorControl(MouseEventArgs e, BehaviorControl BehaviorControl)
        {
            //	Map the client point to a virtual point.
            Point virtualPoint = BehaviorControl.PointToVirtualClient(new Point(e.X, e.Y));

            //	Return a new MouseEventArgs with the translated point.
            return new MouseEventArgs(e.Button, e.Clicks, virtualPoint.X, virtualPoint.Y, e.Delta);
        }
        /// <summary>
        /// Brings the Behavior control to the front of the z-order.
        /// </summary>
        /// <param name="value"></param>
        public void BringToFront(BehaviorControl value)
        {
            //	Remove the Behavior control from the list.
            List.Remove(value);

            //	Add the Behavior control back to the list, now as the front control in the z-order.
            List.Add(value);

            //	Force the owner of this Behavior control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
 /// <summary>
 /// Copies the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the specified index.
 /// </summary>
 /// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> .</para></param>
 /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
 /// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/> is greater than the available space between <paramref name='index'/> and the end of <paramref name='array'/>.</para></exception>
 /// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
 /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is less than <paramref name='array'/>'s lowbound. </exception>
 /// <seealso cref='System.Array'/>
 public void CopyTo(BehaviorControl[] array, int index)
 {
     List.CopyTo(array, index);
 }
 private void OnControlRemoved(BehaviorControl c)
 {
     if (ControlAdded != null)
     {
         ControlRemoved(c);
     }
 }
 private void controls_ControlRemoved(BehaviorControl c)
 {
     c.VirtualLocationChanged -= new EventHandler(c_VirtualLocationChanged);
     c.VirtualSizeChanged     -= new EventHandler(c_VirtualSizeChanged);
     c.VisibleChanged         -= new EventHandler(c_VisibleChanged);
 }
 /// <summary>
 /// Returns the index of a <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> in the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> to locate.</param>
 /// <returns>The index of the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControl'/> of <paramref name='value'/> in the <see cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection'/>, if found; otherwise, -1.</returns>
 /// <seealso cref='OpenLiveWriter.PostEditor.PostHtmlEditing.Behaviors.BehaviorControlCollection.Contains'/>
 public int IndexOf(BehaviorControl value)
 {
     return List.IndexOf(value);
 }