Pages

Friday, February 18, 2011

18/02 Extended and Inherited Controls: -


Date 18-2-11 Friday

// consume the method defined under StopClock
StopClock1.Start();

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Under Show time Button:
// consume the property defined under StopClock
MessageBox.Show(StopClock1.Time);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To consume a MyClick event, which we have defined à goto properties of StopClock & dabble click on MyClick event which defines an event procedure 

StopClock_MyClick

Write following code init.

this.close();

2. Extended and Inherited Controls: -


Create an Inherited control: As discussed earlier in case of inherited controls, we only copy the design of an existing control to new control and than define any new properties or behavior required for the new one


Opens the controls Project we have created earlier under which the StopClock is developed.
à add a code file in the project à naming it as MyTextBox.cs and write the following code.


** Code can not be displayed 


- Open the solution explorer and rebuilt your project which regenerates ControlsProject.dll again.

Consuming the Control: - open your windows form project and going to toolbox, under that we have already a tabà right click on tab à select choose item à click browse à and again select ControlsProject.dll  from physical memory, which add MyTextBox control

à Now place MyTextBox control and use it by setting with the required set option value.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 comments:

Post a Comment