hello all

in dataGridView1 I have 2 columns

Column fruitname and column fruitpictures

The content are :
banana (picture of banana)
orange (picture of orange)
etc

How to print the content of the dataGridView1
(including the fruits picture ) ?

thank you
denny

Recommended Answers

All 5 Replies

hi how u get pics in grid view tell me and give me code i also want to do this.....

Try it this way:

using system;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing; 

private void Button1_Click(object sender , eventargs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage+= new PrintPage(printing);
    pd.Print();
} 

void printing(object sender , PrintPageEventArgs e)
{

   Bitmap bitmap = new Bitmap(datagrid1.width,datagrid1.height);
   datagrid1.DrawtoBitmpa(bitmap,datagrid1.ClientRectangle);
   e.Graphics.DrawImage(bitmap,new Point(50,50));
}

u can see the example of urs requirement in msdn

hi how u get pics in grid view tell me and give me code i also want to do this.....

1.create new form
2.add datagridview
3.add imagecolumn inside datagridview
4.add code below
5.dont forget add : using System,drawing;

private void Form1_Load(object sender, EventArgs e)
        {
            dataGridView1.RowCount = 2;
            Bitmap img = new Bitmap(@"C:\blue.ico");
            dataGridView1.Rows[0].Cells[0].Value = img;
    
     
        }

Ji Mitja
your advice work fine
thank you
denny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.