What should you do to display a custom control as a menu item of the ContextMenuStrip control?

You were busy with a task to add a ContextMenuStrip control to a form. What should you do to display a custom control as a menu item of the ContextMenuStrip control?

You were busy with a task to add a ContextMenuStrip control to a form. What should you do to display a custom control as a menu item of the ContextMenuStrip control?

A.
Add a ToolstripContainer control to the form and add the custom control to the Controls collection residing on the toolStripContainer control. You should then add the ContextMenuStrip control to the controls of the ToolStripContainer control.

B.
Of ToolStripControlHost, create an instance and specify your custom control instance as a parameter to the conductor. You should then the ToolStripControlHost instance to the Items collection of the ContextMenuStrip control.

C.
Add a ToolstripContainer control to the form and add the custom control to the Controls collection residing on the toolStripContainer control. You should then add the ToolstripContainer control to the controls of the ContextMenuStrip controls.

D.
Of ToolStripControlHost, create an instance and specify your custom control instance as a parameter to the conductor. You should then the ContextMenuStrip controls to the collection of the ToolStripControlHost instance.

Explanation:
The ToolStripControlHost class to host a custom control as a menu item in the ContextMeniStrip. You should also the custom control instance as the parameter to the constructor.

Incorrect Answers:
A, B, C: The ToolstripContainer should not be used to reach your goal. Furthermore, you cannot host a ToolstripContainer control as the menu item in a ContextMeniStrip controls.



Leave a Reply 0

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