Exemple #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Small helping Methods                                                     //
        ///////////////////////////////////////////////////////////////////////////////
        #region HELPER

        /// <summary>
        /// Thread safe set of the bounds of the pictures parent of this form.
        /// </summary>
        /// <param name="newBounds">A <see cref="Rectangle"/> with the new bounds.</param>
        protected void ThreadSafeSetBounds(Rectangle newBounds)
        {
            if (this.Picture == null || this.Picture.Parent == null)
            {
                return;
            }

            if (this.Picture.Parent.InvokeRequired)
            {
                SetRectangleCallback d = new SetRectangleCallback(this.ThreadSafeSetBounds);
                this.Picture.Parent.Invoke(d, new object[] { newBounds });
            }
            else
            {
                this.Picture.Parent.Bounds = newBounds;
            }
        }
Exemple #2
0
    ///////////////////////////////////////////////////////////////////////////////
    // Small helping Methods                                                     //
    ///////////////////////////////////////////////////////////////////////////////
    #region HELPER

    /// <summary>
    /// Thread safe set of the bounds of the pictures parent of this form.
    /// </summary>
    /// <param name="newBounds">A <see cref="Rectangle"/> with the new bounds.</param>
    protected void ThreadSafeSetBounds(Rectangle newBounds)
    {
      if (this.Picture == null || this.Picture.Parent == null)
      {
        return;
      }

      if (this.Picture.Parent.InvokeRequired)
      {
        SetRectangleCallback d = new SetRectangleCallback(this.ThreadSafeSetBounds);
        this.Picture.Parent.Invoke(d, new object[] { newBounds });
      }
      else
      {
        this.Picture.Parent.Bounds = newBounds;
      }
    }