Represents an area which can be anchored to other Frames.
コード例 #1
0
ファイル: Frame.cs プロジェクト: TomGillen/Myre
 /// <summary>
 /// Initializes a new instance of the <see cref="Frame"/> class.
 /// </summary>
 /// <param name="graphics">The graphics device.</param>
 /// <param name="parent">The parent.</param>
 public Frame(GraphicsDevice graphics, Frame parent)
 {
     if (graphics == null)
         throw new ArgumentNullException("graphics");
     this.device = graphics;
     this.Parent = parent;
 }
コード例 #2
0
ファイル: Frame.cs プロジェクト: TomGillen/Myre
        /// <summary>
        /// Sets the the specified point on this frame to be at the same position
        /// as the corresponding point on the parent frame.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="x">The x offset.</param>
        /// <param name="y">The y offset.</param>
        /// <param name="anchorFrame">The frame this frame is anchored to.</param>
        /// <param name="anchoredTo">The point on the anchorFrame to anchor to.</param>
        public void SetPoint(Points point, int x, int y, Frame anchorFrame, Points anchoredTo)
        {
            foreach (var side in anchors)
            {
                if (point.Selected(side.Key))
                {
                    Anchor anchor = side.Value;
                    anchor.Start = side.Key;
                    anchor.End = anchoredTo;
                    anchor.AnchorControl = anchorFrame;
                    anchor.Offset = new Vector2(x, y);
                }
            }

            anchoredPoints |= point;

            Frame parent = anchorFrame ?? this.Parent;
            if (parent != null && !parent.anchorChildren.Contains(this))
                parent.anchorChildren.Add(this);

            UpdateAnchors();
        }
コード例 #3
0
ファイル: Frame.cs プロジェクト: TomGillen/Myre
 /// <summary>
 /// Sets the the specified point on this frame to be at the same position
 /// as the corresponding point on the parent frame.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="anchorFrame">The frame this frame is anchored to.</param>
 /// <param name="anchoredTo">The point on the anchorFrame to anchor to.</param>
 public void SetPoint(Points point, Int2D offset, Frame anchorFrame, Points anchoredTo)
 {
     SetPoint(point, offset.X, offset.Y, anchorFrame, anchoredTo);
 }