Пример #1
0
 void TabControlHandleCreated(object sender, EventArgs e)
 {
     // I didn't check if this is visual styles related, but
     // docking the controls into the tab pages only works correctly
     // AFTER the tab control has been shown. (.NET 2.0 beta 2)
     // therefore call it after the current winforms event has been processed using BeginInvoke.
     tabControl.HandleCreated -= TabControlHandleCreated;
     tabControl.BeginInvoke(new MethodInvoker(DockControlsInPages));
 }
Пример #2
0
 /// <summary>Select TabPage by Index Number</summary>
 /// <param name="tc">TabControl Name</param>
 /// <param name="IndexNum">Index (starting with 0) Position</param>
 public void Select_Tab(TabControl tc, int IndexNum)
 {
     // select tab (from any thread)
     if (tc.InvokeRequired)
     {
         tc.BeginInvoke((MethodInvoker) delegate() { tc.SelectedIndex = IndexNum; });
     }
     else
     {
         tc.SelectedIndex = IndexNum;
     }
 }
        /// <summary>
        /// 状態変更時にメッセージボックスを表示する
        /// </summary>
        /// <param name="tabcontrol">タブコントロール</param>
        static void TabSelectEvent(TabControl tabcontrol)
        {
            EventHandler handler = null;

            handler = delegate
            {
                MessageBox.Show("");
                tabcontrol.BeginInvoke((MethodInvoker) delegate
                {
                    tabcontrol.SelectedIndexChanged -= handler;
                });
            };
            tabcontrol.SelectedIndexChanged += handler;
        }
Пример #4
0
 public void removeTab(TabControl from_me, TabPage remove_me)
 {
     if(from_me.InvokeRequired) {
             from_me.BeginInvoke(new removeTabDelegate(removeTab), new Object[] {from_me,remove_me});
         } else {
             lock(from_me) {
                 from_me.TabPages.Remove(remove_me);
             }
         }
 }