WinForms FAQ
WinForms FAQ
WinForms FAQ
You are designing a GUI application with a windows and several widgets on
it. The user then resizes the app window and sees a lot of grey space, while
the widgets stay in place. What's the problem?
One should use anchoring for correct resizing. Otherwise the default property of a
widget on a form is top-left, so it stays at the same location when resized.
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.
With these events, why wouldn't Microsoft combine Invalidate and Paint, so
that you wouldn't have to tell it to repaint, and then to force it to repaint?
Painting is the slowest thing the OS does, so usually telling it to repaint, but not
forcing it allows for the process to take place in the background.
Before in my VB app I would just load the icons from DLL. How can I load
the icons provided by .NET dynamically?
By using System.Drawing.SystemIcons class, for example
System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.
When displaying fonts, what's the difference between pixels, points and
ems?
A pixel is the lowest-resolution dot the computer monitor supports. Its size depends
on user's settings and monitor size. A point is always 1/72 of an inch. An em is the
number of pixels that it takes to display the letter M.