当前位置: 首页>>代码示例>>C#>>正文


C# TabPage.Hide方法代码示例

本文整理汇总了C#中TabPage.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# TabPage.Hide方法的具体用法?C# TabPage.Hide怎么用?C# TabPage.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TabPage的用法示例。


在下文中一共展示了TabPage.Hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeselectPage

        protected virtual void DeselectPage(TabPage page)
        {
            page.Selected = false;

            // Hide any associated control
            if (page.Control != null)
            {
                // Should we remember which control had focus when leaving?
                if (_recordFocus)
                {
                    // Record current focus location on Control
                    if (page.Control.ContainsFocus)
                        page.StartFocus = FindFocus(page.Control);
                    else
                        page.StartFocus = null;
                }

                page.Control.Hide();
            }
            else
            {
                // Should we remember which control had focus when leaving?
                if (_recordFocus)
                {
                    // Record current focus location on Control
                    if (page.ContainsFocus)
                        page.StartFocus = FindFocus(page);
                    else
                        page.StartFocus = null;
                }

                page.Hide();
            }
        }
开发者ID:krishnais,项目名称:ProfileSharp,代码行数:34,代码来源:TabControl.cs

示例2: AddTabPage

        protected virtual void AddTabPage(TabPage page)
        {
            // Has not been shown for the first time yet
            page.Shown = false;

            // Add user supplied control
            if (page.Control != null)
            {
                Form controlIsForm = page.Control as Form;

                page.Control.Hide();

                // Adding a Form takes extra effort
                if (controlIsForm == null)
                {
                    // Monitor focus changes on the Control
                    page.Control.GotFocus += new EventHandler(OnPageEnter);
                    page.Control.LostFocus += new EventHandler(OnPageLeave);
                    page.Control.MouseEnter += new EventHandler(OnPageMouseEnter);
                    page.Control.MouseLeave += new EventHandler(OnPageMouseLeave);

                    // Must fill the entire hosting panel it is on
                    page.Control.Dock = DockStyle.None;

                    // Set correct size
                    page.Control.Location = new Point(0,0);
                    page.Control.Size = _hostPanel.Size;

                    _hostPanel.Controls.Add(page.Control);
                }
                else
                {
                    // Monitor activation changes on the TabPage
                    controlIsForm.Activated += new EventHandler(OnPageEnter);
                    controlIsForm.Deactivate += new EventHandler(OnPageLeave);
                    controlIsForm.MouseEnter += new EventHandler(OnPageMouseEnter);
                    controlIsForm.MouseLeave += new EventHandler(OnPageMouseLeave);

                    // Have to ensure the Form is not a top level form
                    controlIsForm.TopLevel = false;

                    // We are the new parent of this form
                    controlIsForm.Parent = _hostPanel;

                    // To prevent user resizing the form manually and prevent
                    // the caption bar appearing, we use the 'None' border style.
                    controlIsForm.FormBorderStyle = FormBorderStyle.None;

                    // Must fill the entire hosting panel it is on
                    controlIsForm.Dock = DockStyle.None;

                    // Set correct size
                    controlIsForm.Location = new Point(0,0);
                    controlIsForm.Size = _hostPanel.Size;
                }

                // Need to monitor when the Form/Panel is clicked
                if ((page.Control is Form) || (page.Control is Panel))
                    page.Control.MouseDown += new MouseEventHandler(OnPageMouseDown);

                RecursiveMonitor(page.Control, true);
            }
            else
            {
                page.Hide();

                // Monitor focus changes on the TabPage
                page.GotFocus += new EventHandler(OnPageEnter);
                page.LostFocus += new EventHandler(OnPageLeave);
                page.MouseEnter += new EventHandler(OnPageMouseEnter);
                page.MouseLeave += new EventHandler(OnPageMouseLeave);

                // Must fill the entire hosting panel it is on
                page.Dock = DockStyle.None;

                // Need to monitor when the Panel is clicked
                page.MouseDown += new MouseEventHandler(OnPageMouseDown);

                RecursiveMonitor(page, true);

                // Set correct size
                page.Location = new Point(0,0);
                page.Size = _hostPanel.Size;

                // Add the TabPage itself instead
                _hostPanel.Controls.Add(page);
            }
        }
开发者ID:krishnais,项目名称:ProfileSharp,代码行数:88,代码来源:TabControl.cs


注:本文中的TabPage.Hide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。