How to Display an Image in Devexpress XtraGrid Control using C# and VB.NET

To Display an Image in Devexpress XtraGrid Control using C# and VB.NET see the example below.

Sample C#


using System.Data;
using System.Drawing;
using System.Windows.Forms;
using WindowsFormsApplication77.Properties;
using DevExpress.XtraEditors.Repository;


namespace de.fesslersoft.XtraGridImageTest
    public partial class Form1 : Form
        public Form1()
            gridControl1.DataSource = CreateTable(3);
            gridView1.Columns["Image"].ColumnEdit = new RepositoryItemPictureEdit();

        private DataTable CreateTable(int rowCount)
            var image = Resources.Image1;
            var tbl = new DataTable();
            tbl.Columns.Add("ID", typeof (int));
            tbl.Columns.Add("URL", typeof (string));
            tbl.Columns.Add("Image", typeof (Image));
            for (var i = 0; i < rowCount; i++)
                tbl.Rows.Add(new object[] {i, "", image});
            return tbl;

Sample VB.NET

#Region ""

Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Imports WindowsFormsApplication77.Properties
Imports DevExpress.XtraEditors.Repository

#End Region

Namespace de.fesslersoft.XtraGridImageTest
	Public Partial Class Form1
		Inherits Form
		Public Sub New()
			gridControl1.DataSource = CreateTable(3)
			gridView1.Columns("Image").ColumnEdit = New RepositoryItemPictureEdit()
		End Sub

		Private Function CreateTable(rowCount As Integer) As DataTable
			Dim image = Resources.Image1
			Dim tbl = New DataTable()
			tbl.Columns.Add("ID", GetType(Integer))
			tbl.Columns.Add("URL", GetType(String))
			tbl.Columns.Add("Image", GetType(Image))
			For i As var = 0 To rowCount - 1
				tbl.Rows.Add(New Object() {i, "", image})
			Return tbl
		End Function
	End Class
End Namespace


XtraGrid ColumnImages

XtraGrid ColumnImages

How to use DebuggerDisplayAttribute in C# and VB.NET

If you want to change the information, the debugger variable window shows for your class, you can use the DebuggerDisplayAttribute.
Simply put the Attribut above your class declaration. The Value between {} are the name of the property or Field you want to show.

Sample C#

[DebuggerDisplay("Name = {Name}, Value = {Value}")]

Sample VB.NET

<DebuggerDisplay("Name = {Name}, Value = {Value}")>



for more informations see the DebuggerDisplayAttribute Class MSDN Entry

How to list the avaiable fonts in Java

To list the avaiable fonts in Java you can use the following snippet.

Sample Java

GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
String fonts[] = g.getAvailableFontFamilyNames();
for (int Counter = 0; Counter < fonts.length;Counter++ ){