473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Load an image

I'm trying to load an image and show it on a panel control. The code is
this:

private void btnCargarImagen_Click(object sender, System.EventArgs e)

{

openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();

if (openFileDialog1.ShowDialog() == DialogResult.OK)

{

Image = Image.FromFile(openFileDialog1.FileName);

panelImage.AutoScrollMinSize = Image.Size;

panelImage.Invalidate();

}

}

private void panelImage_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)

{

if (Image != null)

e.Graphics.DrawImage(Image, this.AutoScrollPosition);

}

}

The Image is loaded but when I move the panel's bar, I don't see the image
properly.

Does anybody know what's happening?

Thank you very much


Nov 16 '05 #1
1 1374
I respond myself: the error was in this line
this.AutoScrollPosition
I have to change this by panelImage.

Anyway now I can move the image with the bars but I can't see it complete.
Any idea?
Thank yor.

"Alberto" <al*****@nospam.com> escribió en el mensaje
news:Ow*************@TK2MSFTNGP12.phx.gbl...
I'm trying to load an image and show it on a panel control. The code is
this:

private void btnCargarImagen_Click(object sender, System.EventArgs e)

{

openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();

if (openFileDialog1.ShowDialog() == DialogResult.OK)

{

Image = Image.FromFile(openFileDialog1.FileName);

panelImage.AutoScrollMinSize = Image.Size;

panelImage.Invalidate();

}

}

private void panelImage_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)

{

if (Image != null)

e.Graphics.DrawImage(Image, this.AutoScrollPosition);

}

}

The Image is loaded but when I move the panel's bar, I don't see the image
properly.

Does anybody know what's happening?

Thank you very much

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Charlie | last post by:
Hi I am using the following code to create an image viewer for multiple images. var pageImage = document.images; var image = new Image(); var args = GetQuerystring(); //return arguments from...
0
by: BATISTA | last post by:
Hi I have to program in C# such that I have to add a button to the form , and create a crystal report, by getting source from the xml schema file(.xsd file) with two fields namely...
12
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses...
3
by: Mike Dee | last post by:
Hi, I'm having an issue with the status bar in Mozilla and Netscape showing that it is still waiting on the page to load even after it is finished. This problem does NOT occur with IE. In...
4
by: jordi_ramis | last post by:
Hi, I'm currently using image.fromfile to load jpg images in my application. I've noted that this procedure is very slow compared to some aplications I have seen. Is there any way to load a jpeg...
1
by: dbagirltx | last post by:
We have done some testing with mixed and forgotten results. So I'm hoping that asking here can clarify some issues for us. Right now we do one weekly warm backup. Throughout the week there are...
6
by: nuhura01 | last post by:
Hi all... My system contains an image which I have saved it at client side. Unfortunately, when users want to view the image, the image doesn't loaded. If i'm not mistaken, it is set at the HTML...
11
by: Chamnap | last post by:
Hello, I have several images that need to be loaded dynamically based on user interaction. Each image size is about 6000x1500 pixels. I see several sites they make the image blur, blur, blur,...
2
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in...
2
by: Casey | last post by:
I'm doing some image processing that requires accessing the individual pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of pixel RGB tuples using the Image class instance load()...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.