How do I hide the gridlines or set them to a particular color

You can download a working project. Below are VB code snippets showing how you might do these tasks. ’load a bitmap from an embedded resource Dim Bmp As Bitmap ’ from an embedded resource Dim curName As String = ''BitmapVB.sync.bmp'' Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream(curName) Bmp = New Bitmap(strm) PictureBox1.Image = Bmp ..... ..... ’load a bitmap from a file Dim Bmp As Bitmap = Image.FromFile(''c:\sync.bmp'') PictureBox1.Image = Bmp ..... ..... ’modify a bitmap Dim Bmp As Bitmap = PictureBox1.Image.Clone Dim g As Graphics = Graphics.FromImage(Bmp) Dim brush1 As SolidBrush = New SolidBrush(Color.Red) g.DrawString(TextBox1.Text, TextBox1.Font, brush1, 10, 10) PictureBox2.Image = Bmp g.Dispose() .... .... ’save a bitmap as a file Dim dlg As SaveFileDialog = New SaveFileDialog() dlg.Title = ''Save BMP file'' dlg.InitialDirectory = ''c:\'' dlg.Filter = ''bmp files (*.bmp)|*.bmp|All files (*.*)|*.*'' If dlg.ShowDialog = DialogResult.OK Then PictureBox2.Image.Save(dlg.FileName End If

How can I bind an ArrayList to a DataGrid

Here is a technique for binding an arraylist of objects where the objects contain public property that can appear as columns in the datagrid. In this example, the object contains 2 public doubles, one named value and the other named sqrt. To bind this arraylist to a datagrid, add a custom tablestyle that has a MappingName of ”ArrayList”, and then use the property names as the MappingName for each column. Below are some code snippets. You can download a working project that also has code to delete rows and add new rows to the bound arraylist. private void Form1_Load(object sender, System.EventArgs e) { CreateArrayList(); BindArrayListToGrid(); } private void BindArrayListToGrid() { dataGrid1.DataSource = arrayList1; //create a custom tablestyle and add two columnstyles DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ''ArrayList''; int colwidth = (dataGrid1.ClientSize.Width - ts.RowHeaderWidth - SystemInformation.VerticalScrollBarWidth - 5) / 2; //create a column for the value property DataGridTextBoxColumn cs = new DataGridTextBoxColumn(); cs.MappingName = ''value''; //public property name cs.HeaderText = ''Random Number''; cs.Format = ''f4''; cs.Width = colwidth; ts.GridColumnStyles.Add(cs); //create a column for the sqrt property cs = new DataGridTextBoxColumn(); cs.MappingName = ''sqrt''; //public property name cs.HeaderText = ''Square Root''; cs.Format = ''f4''; cs.Width = colwidth; ts.GridColumnStyles.Add(cs); dataGrid1.TableStyles.Clear(); dataGrid1.TableStyles.Add(ts); } private void CreateArrayList() { arrayList1 = new ArrayList(); //add some items Random r = new Random(); for (int i = 0; i < 20; ++i) arrayList1.Add(new RandomNumber(r.NextDouble())); } //create a struct or class that defines what you want in each row //the different columns in the row must be public properties public struct RandomNumber { private double number; public RandomNumber(double d) { number = d; } public double value { get{ return number; } set{ number = value;} } public double sqrt { get {return Math.Sqrt(this.value);} } }

How can I get notification of the changing of a value in a column of comboboxes within my datagrid

This solution is based off the combobox for datagrid columns found in this FAQ. That solution replaces the standard textbox with a combobox. To get notifications of the changes, a delegate is passed into the constructor for the custom column style. This delegate is called anytime the combobox value changes. It passes the row number and value as arguments. You can download sample code (C#, VB) that shows the implementation.

How can I get celltips or tooltips to vary from cell to cell in my DataGrid

One way to do this is to use a ToolTip control and reset the control text as the mouse moves from cell to cell. Below is a derived DataGrid class that implements this idea. The main points are: Have members that track the current hitRow and hitCol where the mouse is. In a MouseMove handler, do a HitTest on the mouse location to see if there is a new hit cell. If so, set the hitRow & hitCol, and hook the tooltip to hold your text according to the cell. In our sample, we just display the string value of the grid cell. Finally, in the MouseMove handler, after setting a new text in the tooltip, set the tooltip active so it can show itself in due time. public class DataGridCellTips : DataGrid { private int hitRow; private int hitCol; private System.Windows.Forms.ToolTip toolTip1; public DataGridCellTips() { hitRow = -1; hitCol = -1; this.toolTip1 = new System.Windows.Forms.ToolTip(); this.toolTip1.InitialDelay = 1000; this.MouseMove += new MouseEventHandler(HandleMouseMove); } private void HandleMouseMove(object sender, MouseEventArgs e) { DataGrid.HitTestInfo hti = this.HitTest(new Point(e.X, e.Y)); if (hti.Type == DataGrid.HitTestType.Cell && (hti.Row != hitRow || hti.Column != hitCol)) { //new hit row hitRow = hti.Row; hitCol = hti.Column; if (this.toolTip1 != null && this.toolTip1.Active) this.toolTip1.Active = false; //turn it off this.toolTip1.SetToolTip(this, this[hitRow, hitCol].ToString()); this.toolTip1.Active = true; //make it active so it can show itself //Console.WriteLine('MouseMove '+ hitRow.ToString() + ' ' + hitCol.ToString()); } } }

What should I do to make my StringCollection property editable during design-time?

Use this custom editor attribute for the property that is of the StringCollection type (this can be used for other Collection types too if you want to allow entry of strings into the collection during design-time). Editor('System.Windows.Forms.Design.StringCollectionEditor, System.Design', 'System.Drawing.Design.UITypeEditor, System.Drawing'), public YourCollection YourProp{get{...}set{...}} StringCollectionEditor is not public so you have to use the above constructor override and specify the typename. This editor should allow you to edit your collection without any problems.