What should you do to write code to render the control, preventing other controls from modifying the rendering behavior of your control?

You are busy developing a custom control from a class from Control, which is not a composite control and performs all of its rendering by using GD+. What should you do to write code to render the control, preventing other controls from modifying the rendering behavior of your control?

You are busy developing a custom control from a class from Control, which is not a composite control and performs all of its rendering by using GD+. What should you do to write code to render the control, preventing other controls from modifying the rendering behavior of your control?

A.
You should attach the Paint event to an event handler in the constructor and perform all rendering in the event handler.

B.
You should create a Graphic instance in the contracture and perform all rendering via the Graphic instance.

C.
You should override the Onpaint method and do all rendering in the overridden method.

D.
You should override the InitLayout method, attach the Paint event to the event handler and do all rendering in the event handler.

Explanation:
When you override the Onpaint method, you can render the control via the Supplied PaintEventArgs parameter.

Incorrect Answers:
A, D: The event handler in not needed. You cannot stop the other controls from attaching to the event handlers.



Leave a Reply 0

Your email address will not be published. Required fields are marked *