コード例 #1
0
        private void OnWantPutTabPageToNavigationListView(
            WantPutTabPageToNavigationListViewEventArgs args)
        {
            var h = WantPutTabPageToNavigationListView;

            h?.Invoke(this, args);
        }
コード例 #2
0
        /// <summary>
        /// Helper function for replacing regular tabs with a list box, like in
        /// the new Microsoft Office option dialogs.
        /// </summary>
        protected void PutTabNavigationToListView(
            MyXtraTabControl tabControl,
            ListBoxControl listControl)
        {
            tabControl.SelectedTabPageIndex = 0;
            tabControl.ShowTabHeader        = DefaultBoolean.False;

            // 2011-04-12, Uwe Keim: No border around the group boxes.
            tabControl.BorderStyle       = BorderStyles.NoBorder;
            tabControl.BorderStylePage   = BorderStyles.NoBorder;
            tabControl.LookAndFeel.Style = LookAndFeelStyle.Flat;
            tabControl.LookAndFeel.UseDefaultLookAndFeel = false;

            listControl.Items.Clear();

            foreach (MyXtraTabPage tabPage in tabControl.TabPages)
            {
                var args = new WantPutTabPageToNavigationListViewEventArgs(tabPage);
                OnWantPutTabPageToNavigationListView(args);

                if (!args.Cancel)
                {
                    listControl.Items.Add(new TabListItemInfo {
                        TabPage = tabPage
                    });
                }
            }

            listControl.SelectedIndexChanged +=
                delegate
            {
                RefreshTabNavigationFromSelection(tabControl, listControl);
            };

            ConnectTabControlInitializingEvents(tabControl);

            // --

            tabControl.TabStop = false;

            tabControl.KeyDown +=
                delegate(object sender, KeyEventArgs e)
            {
                // Forbid tabbing through.
                if (e.KeyCode == Keys.Tab && e.Control)
                {
                    e.Handled = true;
                }
            };
        }