Thursday, April 2, 2009

.Net Windows Forms Interview Questions Part II

1. What’s the difference between Move and LocationChanged? . Resize and SizeChanged?

Ans. Both methods do the same, Move and Resize are the names adopted from VB to ease migration to C#.

2. How would you create a non-rectangular window, let’s say an ellipse?

Ans . Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.

3. How do you create a separator in the Menu Designer?

Ans . A hyphen ‘-’ would do it. Also, an ampersand ‘&\’ would underline the next letter.

4. How’s anchoring different from docking?
Ans . Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size. So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.

No comments: