Beispiel #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);
 }
Beispiel #2
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);
 }