private void setSelectedIndex(int value) { SelectedIndexChanging?.Invoke(this, _selectedIndex); _selectedIndex = value; Invalidate(); SelectedIndexChanged?.Invoke(this, value); }
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(base.SelectedTab, tp); SelectedIndexChanging?.Invoke(this, e); if (e.Cancel || tp.Enabled == false) { m.Result = new IntPtr(1); return; } } } } base.WndProc(ref m); }