.Net Windows Controls Interview Questions and Answers for Freshers and Experience Part-1
1. How can we auto size a button to fit its text?
The Button control has the AutoSize property, which can be set to true or false. If we set the value of theAutoSize property to true, then the button control automatically alters its size according to the content displayed on it.
2. How can we display an icon or a bitmap image on the Button control?
The Button class contains the Image property, which is used to set an image on the Button control. We can also set the alignment of the image by using the ImageAlign property of the Button class.
3. Which method is used to generate the click event of the Control class for the Button control in C#?
The PerformClick() method of the Button class is used to generate the Click event of theSystem.Windows.Forms.Control class.
4. A Windows Form will not show the Minimize, Maximize, and Close buttons, if the ControlBox property of the form is set to False. (True/False)
5. How is anchoring different from docking?
Docking refers to attaching a control to either an edge (top, right, bottom, or left) or the client area of the parent control. On the other hand, anchoring is a process in which you need to specify the distance that each edge of your control maintains from the edges of the parent control.
6. How can you display a default value in the text box of an input box?
You can display a default value in the text box of an input box by using the DefaultResponse argument of theInputBox() function.