Windows Forms Interview Question with Answer

How would you create a non-rectangular window, let’s say an ellipse?
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.
What’s the difference between WindowsDefaultLocation and WindowsDefaultBounds?

WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.
My progress bar freezes up and dialog window shows blank, when an intensive background process takes over

Yes, you should’ve multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.

or Application.DoEvents can be used also
How do you retrieve the customized properties of a .NET application from XML .config file?



Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.

How can you save the desired properties of Windows Forms application?

config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.

No comments:

Post a Comment