Ejemplo n.º 1
0
        public static void EmbedInto(this Control child, Control parent, EmbedType type, EmbededCallback embededCallback, bool isFixed = false, bool isSizable = false)
        {
            if (child != null && parent != null)
            {
                EmbedableTag tag = EmbedableTag.GetInstance(parent);
                tag.NewlyEmbededControls.Add(child);
                tag.Parent = parent;
                Control container = tag.ContentRegion;

                if (type == EmbedType.Fill || type == EmbedType.None)
                {
                    child.EmbedInto(container, type == EmbedType.Fill);
                    return;
                }


                #region Generate SplitContainer according to the EmbedType
                SplitContainer splitter;
                SplitterPanel  fillPanel;
                SplitterPanel  contentPanel;
                GenerateSplitter(parent, type, tag, out splitter, out fillPanel, out contentPanel, isSizable);
                #endregion
                if (splitter != null)
                {
                    splitter.IsSplitterFixed = isFixed;
                }
                fillPanel.Controls.Add(child);
                container.Controls.Add(splitter);
                splitter.Dock     = DockStyle.Fill;
                tag.ContentRegion = contentPanel;

                #region Adjust fill panel size
                AdjustFillPanel(child, type, splitter);
                #endregion
                if (child is ScreenRegion)
                {
                    child.Show();
                }
                if (embededCallback != null)
                {
                    embededCallback(child);
                }
            }
        }
Ejemplo n.º 2
0
 public static void Embed(this Control parent, Control child, EmbedType type, EmbededCallback embededCallback = null)
 {
     EmbedInto(child, parent, type, embededCallback);
 }