Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Put an image in the header of ultragridprintdocument
posted

Hi all;

I want to put an image in the header of the page when printing but i cant find the way to do it

this is my code that just loads the image from the database:

private

void Printbutton4_Click(object sender, EventArgs

e)

this.ultraGridPrintDocument1.Grid = this.ultraGrid1;

LoadImage();

this.ultraGridPrintDocument1.Header.Appearance.FontData.Italic = DefaultableBoolean.True;

this.ultraPrintPreviewDialog1.Document = this

.ultraGridPrintDocument1;

this.ultraPrintPreviewDialog1.ShowDialog(this

.ultraGrid1);

}

protected

void LoadImage()

try

{

 

cmdSelect.CommandText =

this.connection.OpenConnection(); SqlCommand cmdSelect = new SqlCommand();

"Select Picture from tblImgData where ID= 1";

byte[] barrImg = (byte[])cmdSelect.ExecuteScalar();  

string strfn = Convert.ToString(DateTime.Now.ToFileTime());  

FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);

this.ultraGridPrintDocument1.Header.Appearance.Image = fs.Name ;

}

Please of anyone can help?

thanx a lot

fs.Write(barrImg, 0, barrImg.Length);

fs.Flush();

fs.Close();

cmdSelect.Connection = connection.conn;