Documente Academic
Documente Profesional
Documente Cultură
ACCESS
//Declare the OpenFileDialog as a new OpenFileDialog.
OpenFileDialog openFileDialog = new OpenFileDialog();
//Declare the PictureBox as a new PictureBox
//PictureBox pic = new PictureBox();
//Set the openFileDialog's Filter.
openFileDialog.Filter = "Bitmap Image|*.bmp|All Files|*.*";
//Set the openFileDialog's FileName to nothing.
openFileDialog.FileName = "";
string path = "";
//Show the openFileDialog
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
//To do code if the Open button was pressed
//Use something like:
filename = openFileDialog.FileName;
pic.Image = Image.FromFile(filename);
pic.Size = new System.Drawing.Size(280, 140);
pic.SizeMode = PictureBoxSizeMode.CenterImage;
path = System.IO.Path.GetDirectoryName(openFileDialog.FileName) + "
\\" + openFileDialog.FileName;
FullFileName = openFileDialog.FileName;
txtComp_Image.Text = path;
}
else
{
return;
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It works in my code-
MyData = (byte[])dt.Rows[0]["fldPhotoSignature"];
ArraySize = MyData.GetUpperBound(0);
MyPic.Image = objPhoto.GetImageData(MyData);
---------------
mst.Write(ImageByte, 0, ImageByte.Length);
System.Drawing.Image newImage;
newImage = System.Drawing.Image.FromStream(mst);
return newImage;
IMPORTANTE
So far the only way I have been able to get these samples to work (and the one above)
is by excluding the OLE Object header information.
System.IO.MemoryStream mst = new System.IO.MemoryStream(ImageByte, 78,
ImageByte.Length-78);
mst.Write(ImageByte, 78, ImageByte.Length-78);