Пример #1
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == (WM_REFLECT + WM_NOTIFY))
     {
         NMHDR hdr = (NMHDR)(Marshal.PtrToStructure(m.LParam, typeof(NMHDR)));
         if (hdr.code == TCN_SELCHANGING)
         {
             TabPage tp = TestTab(PointToClient(Cursor.Position));
             if (tp != null)
             {
                 TabPageChangeEventArgs e = new TabPageChangeEventArgs(SelectedTab, tp);
                 if (SelectedIndexChanging != null)
                 {
                     SelectedIndexChanging(this, e);
                 }
                 if (e.Cancel || tp.Enabled == false)
                 {
                     m.Result = new IntPtr(1);
                     return;
                 }
             }
         }
     }
     base.WndProc(ref m);
 }
Пример #2
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 0x204e)
     {
         NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
         if (nmhdr.code == -552)
         {
             TabPage nextTab = this.TestTab(base.PointToClient(Cursor.Position));
             if (nextTab != null)
             {
                 TabPageChangeEventArgs e = new TabPageChangeEventArgs(base.SelectedTab, nextTab);
                 if (this.SelectedIndexChanging != null)
                 {
                     this.SelectedIndexChanging(this, e);
                 }
                 if (e.Cancel || !nextTab.Enabled)
                 {
                     m.Result = new IntPtr(1);
                     return;
                 }
             }
         }
     }
     base.WndProc(ref m);
 }
Пример #3
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 0x204e)
     {
         NMHDR nmhdr = (NMHDR) Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
         if (nmhdr.code == -552)
         {
             TabPage nextTab = this.TestTab(base.PointToClient(Cursor.Position));
             if (nextTab != null)
             {
                 TabPageChangeEventArgs e = new TabPageChangeEventArgs(base.SelectedTab, nextTab);
                 if (this.SelectedIndexChanging != null)
                 {
                     this.SelectedIndexChanging(this, e);
                 }
                 if (e.Cancel || !nextTab.Enabled)
                 {
                     m.Result = new IntPtr(1);
                     return;
                 }
             }
         }
     }
     base.WndProc(ref m);
 }