c# - winforms tab page event not firing -


i have tabcontrol user can add tab pages.

i trying attach events such as: mouseenter, mouseleave, mouseclick, seems these events not firing @ all, fire when attach them tabcontrol itself, not need.

what problem attaching events tab control tab page ?

here latest attempt attach these event code:

private void customertabctrl_controladded(object sender, controleventargs e) {    tctabpage tctab = (tctabpage)e.control; // option    tctabpage tctab = (tctabpage)customertabctrl.controls[customertabctrl.controls.count - 1]; //option b    tctab.mouseenter += new eventhandler(tctab_mouseenter);    tctab.mouseleave += new eventhandler(tctab_mouseleave); } 

you don't need event since default, end user cannot add tabpages tabcontrol without providing code it.

so wherever adding tabpage, that's when should wiring events:

tctabpage tctab = new tctabpage(); tbtab.text = "new tab"; tctab.mouseenter += tctab_mouseenter; tctab.mouseleave += tctab_mouseleave; customertabctrl.tabpages.add(tctab); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -