Properties
- Every control has a properties, events to access the properties of control Visual Studio provides Property window that lists all properties of control. To select press F4 to open it.
- We can change any property value in the list of property under property window like width, height, font, fore color etc for which we can see the impact immediately after changing the property value.
- Whenever we set a value to any property of a control under property window Visual Studio on behalf of us writes all the necessary code by assigning values to the property we have modified, we can view that code under Initialize Component method of a class which is called in a constructor of a class.
- To view code under Initialize Component method ,go to definition code view right click on the method called in constructor and select go to definition this takes us to form.designer.cs and here also we find the same class because it is partial.
Events
- This are time period which tells when an action is to be performed i.e when exactly we want to execute a method . Every control has number of events with it where each event occurs at a particular time period.
- We can access the events of a control also under property window only to view them in the property window.
- If we want to write any code that should execute when an event occurs double-click on the desired event corresponding to a control which takes you to the code view and provides a method for writing a code.
No comments:
Post a Comment