c# - When Control.ParentChanged Event occurs? -


i read control.parentchanged event on msdn http://msdn.microsoft.com/en-us/library/system.windows.forms.control.parentchanged(vs.71).aspx

but don't understand sample code: there's no parentchanged @ appearing in source code ?

private void currencytextbox_textchanged(object sender, eventargs e) {    try    {       // convert text double , determine if negative number.       if(double.parse(currencytextbox.text) < 0)       {          // if number negative, display in red.          currencytextbox.forecolor = color.red;       }       else       {          // if number not negative, display in black.          currencytextbox.forecolor = color.black;       }    }    catch    {       // if there error, display text using system colors.       currencytextbox.forecolor = systemcolors.controltext;    } } 

so don't understand control.parentchanged event or does.

hehe, couldn't come example. , punted showing generic foochanged event handler instead. yeah, useless.

it quite unusual implement parentchanged event handler yourself. it's big deal in winforms internals, properties backcolor, forecolor, font 'ambient' properties. if not overridden default they'll value of parent. of course means really important notice parent changed. winforms code takes care of it, have worry it. unless create own ambient property of course.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -