TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
asma
NA
507
0
Display image on Bitmap
Jun 18 2008 2:39 AM
i am trying to pick a image file from open dialog box and send to other user in C#.net
private System.Windows.Forms.OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.RestoreDirectory = true;
openFileDialog1.FileName = "";
openFileDialog1.Filter = "Graphic Interchange Format (*.gif)|*.gif|" +
"JPEG File Interchange Format (*.jpg;*.jpeg)|*.jpg;*.jpeg";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string filename = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("\\") + 1);
File.Copy(openFileDialog1.FileName, Application.StartupPath + "\\Temp\\" + filename, true);
string fname = Application.StartupPath + "\\Temp\\" + filename;
if(File.Exists(fname))
WhiteBoard1.iSelected = fname;
FileInfo info = new FileInfo(WhiteBoard1.iSelected);
long filesize = info.Length;
if(filesize>0)
{
WhiteBoard1.strConfid = strConfid;
WhiteBoard1.LoadImage();
}
}
In whiteboard class
public void LoadImage()
{
try
{
Graphics grphs = CreateGraphics();
if(File.Exists(iSelected))
{
Image img1 = Image.FromFile(iSelected);
pict.Image=img1;
}
}
catch(OutOfMemoryException)
{
MessageBox.Show(msg.ToString());
}
}
I get exception as
OutofMemory Exception
Reply
Answers (
1
)
Serializable
IFormatProvider.GetFormat