The controls that I’ve try to add to my form at runtime don’t show up. What’s wrong
Make sure you implemented and executed code similar to the InitializeComponent method that VS adds to your Windows Forms project for controls added during design time. Recall that InitializeComponent() is called from your Forms constructor to create the controls, size, position and show the controls, and finally add the controls to the form’s Controls collection. So, your code at runtime should also implement these same steps. In particular, don’t forget the this.Controls.AddRange call that adds your new controls to the form’s Controls collection.
How do I set the mouse cursor position
The Cursor.Position property is a static property with both get and set methods available. Remember that the Point object used by the property is in screen coordinates. Here is code that move the mouse position down 20 points. Point pt = Cursor.Position; pt.Y += 20; Cursor.Position = pt;
How can I put a bitmap or icon on a button face
You can use the Button.Image property to add an image to a button face. Use the Button.ImageAlign (and possibly Button.TextAlign) to layout your button face. You can also implement custom drawing on a button face as described in the FAQ entitled ‘How can I decorate a button face with custom drawing’.
How can I easily manage whether controls on my form are readonly or not
One way is to place all the controls into a single GroupBox and then use the GroupBox.Enabled property to manage whether the controls are editable or not.
How can I tell if the user has changed some system preference such as the locale or display settings
Use the static events in the SystemEvents class found in the Microsoft.Win32 namespace. There are many events in this class. Here are a couple: SystemEvents.DisplaySettingsChanged += new System.EventHandler(displaySettingsChanged); SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(userPreferencesChanged); ............. ............. private void displaySettingsChanged(object sender, EventArgs e) { MessageBox.Show(e.ToString()); } private void userPreferencesChanged(object sender, UserPreferenceChangedEventArgs e) { switch(e.Category) { case UserPreferenceCategory.Locale: MessageBox.Show('Changed locale'); break; default: MessageBox.Show(e.Category.ToString()); break; } }