PixelFarm.Drawing.RectangleF.Offset C# (CSharp) Method

Offset() public method

Offset Method
Moves the RectangleF a specified distance.
public Offset ( PointF pos ) : void
pos PointF
return void
        public void Offset(PointF pos)
        {
            Offset(pos.X, pos.Y);
        }

Same methods

RectangleF::Offset ( float x, float y ) : void

Usage Example

示例#1
0
 void dbugAddToProperContainer(CssBox box)
 {
     var rectChild = new RectangleF(box.LocalX, box.LocalY,
         box.InnerContentWidth,
         box.InnerContentHeight);
     CssBox parent = box.ParentBox;
     bool found = false;
     while (parent != null)
     {
         var rectParent = new RectangleF(0, 0, parent.VisualWidth, parent.VisualHeight);
         if (rectParent.Contains(rectChild))
         {
             found = true;
             //add to here
             float bfx, bfy;
             box.GetGlobalLocation(out bfx, out bfy);
             float rfx, rfy;
             parent.GetGlobalLocation(out rfx, out rfy);
             //diff
             float nx = bfx - rfx;
             float ny = bfy - rfy;
             box.SetLocation(nx, ny);
             parent.AppendToAbsoluteLayer(box);
             break;
         }
         else
         {
             rectChild.Offset(parent.LocalX, parent.LocalY);
             parent = parent.ParentBox;
         }
     }
     if (!found)
     {
         //add to root top 
         float bfx, bfy;
         box.GetGlobalLocation(out bfx, out bfy);
         float rfx, rfy;
         this._rootBox.GetGlobalLocation(out rfx, out rfy);
         //diff
         float nx = bfx - rfx;
         float ny = bfy - rfy;
         box.SetLocation(nx, ny);
         this._rootBox.AppendToAbsoluteLayer(box);
     }
 }