How can I change the background of my MDI Client container?

The default behavior is to make the client container use the Control color from the Control panel. You can change this behavior by making the MDI Client container use the form’s BackColor and Image. To do this, after the call to InitializeComponents(), add the code below. You can also download a working MDI Client project that has this code in it. //set back color foreach(Control c in this.Controls) { if(c is MdiClient) { c.BackColor = this.BackColor; c.BackgroundImage = this.BackgroundImage; } }

How can I place a border around a PictureBox?

One solution is to use a panel that has a picturebox placed on it with DockStyle.Fill. This will make the picturebox assume the size of the panel. In addition, set the DockPadding.All property to the width of the desired border. Then in the Panel’s OnPaint method, call the baseclass and then paint the desired borders. Here are both VB and C# projects that illustrate how you might go about this. The derived PicturePanel class has properties that allow you to set the bordersize and color as well as the image that is to be displayed. This sample retrieves the image from an embedded resource. It also uses double buffering to minimize flashing as you resize the control.

How do I autosize the columns in my DataGrid so they always fill the the grid’s client area

If you add a DataGridTableStyle to your Datagrid, then you can use the ColWidth property of the GridColumnStyles to set the width of each column. To dynamically set these widths as the grid is resized, you can handle the SizeChanged event of the the DataGrid. In your handler, you can compute the width of each column by dividing the client width minus the width of the row header column by the number of columns. Now there are a couple of technical points. You have to adjust for a possible vertical scrollbar. And, you have to adjust things for possible integer rounding in the calculations. To handle this last problem, the attached samples (both VB and C#) apply the single computed width to all but the last column. And this last column is just given all the space left. This means the last column may differ in width from the other columns by a couple of pixels.

How do I programmatically set an image as Form’s Icon ?

You could do so as shown in the code below : [C#] Form form1 = new Form(); Bitmap bmp = imageList1.Images[index] as Bitmap; form1.Icon = Icon.FromHandle(bmp.GetHicon()); [VB.NET] Dim form1 As Form = New Form() Dim bmp As Bitmap = imageList1.Images(index) as Bitmap form1.Icon = Icon.FromHandle(bmp.GetHicon()) Please refer to the sample attached here that illustrates this.