protected void _content_LayoutChanged(object sender, LayoutingEventArgs e) { ILayoutable tc = Content.Parent as ILayoutable; if (tc == null) { return; } Rectangle r = this.ScreenCoordinates(this.Slot); if (e.LayoutType.HasFlag(LayoutingType.Width)) { if (popDirection.HasFlag(Alignment.Right)) { if (r.Right + Content.Slot.Width > tc.ClientRectangle.Right) { Content.Left = r.Left - Content.Slot.Width; } else { Content.Left = r.Right; } } else if (popDirection.HasFlag(Alignment.Left)) { if (r.Left - Content.Slot.Width < tc.ClientRectangle.Left) { Content.Left = r.Right; } else { Content.Left = r.Left - Content.Slot.Width; } } else { if (Content.Slot.Width < tc.ClientRectangle.Width) { if (r.Left + Content.Slot.Width > tc.ClientRectangle.Right) { Content.Left = tc.ClientRectangle.Right - Content.Slot.Width; } else { Content.Left = r.Left; } } else { Content.Left = 0; } } } if (e.LayoutType.HasFlag(LayoutingType.Height)) { if (Content.Slot.Height < tc.ClientRectangle.Height) { if (PopDirection.HasFlag(Alignment.Bottom)) { if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom) { Content.Top = r.Top - Content.Slot.Height; } else { Content.Top = r.Bottom; } } else if (PopDirection.HasFlag(Alignment.Top)) { if (r.Top - Content.Slot.Height < tc.ClientRectangle.Top) { Content.Top = r.Bottom; } else { Content.Top = r.Top - Content.Slot.Height; } } else { Content.Top = r.Top; } } else { Content.Top = 0; } } }
void positionContent(LayoutingType lt) { ILayoutable tc = Content.Parent; if (tc == null) { return; } Rectangle r = this.ScreenCoordinates(this.Slot); if (lt == LayoutingType.X) { if (popDirection.HasFlag(Alignment.Right)) { if (r.Right + Content.Slot.Width > tc.ClientRectangle.Right) { Content.Left = r.Left - Content.Slot.Width; } else { Content.Left = r.Right; } } else if (popDirection.HasFlag(Alignment.Left)) { if (r.Left - Content.Slot.Width < tc.ClientRectangle.Left) { Content.Left = r.Right; } else { Content.Left = r.Left - Content.Slot.Width; } } else { if (Content.Slot.Width < tc.ClientRectangle.Width) { if (r.Left + Content.Slot.Width > tc.ClientRectangle.Right) { Content.Left = tc.ClientRectangle.Right - Content.Slot.Width; } else { Content.Left = r.Left; } } else { Content.Left = 0; } } } else if (lt == LayoutingType.Y) { if (Content.Slot.Height < tc.ClientRectangle.Height) { if (PopDirection.HasFlag(Alignment.Bottom)) { if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom) { Content.Top = r.Top - Content.Slot.Height; } else { Content.Top = r.Bottom; } } else if (PopDirection.HasFlag(Alignment.Top)) { if (r.Top - Content.Slot.Height < tc.ClientRectangle.Top) { Content.Top = r.Bottom; } else { Content.Top = r.Top - Content.Slot.Height; } } else { Content.Top = r.Top; } } else { Content.Top = 0; } } }