Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I am developing a tool that functions somewhat similar to MS Paint. I got all the functionality to be working fine.

 

My problems arise when I have to edit huge image files (8000 x 4000 (jpeg format) around 1 MB). When I try to load the image into my picturebox, it takes a really long time.

Even after it finish loading the picture, When ever I scroll over the picturebox, it takes forever (since it's redrawing).

 

Is there anyway that I can make the image loading to be faster, the most important thing is, is there anyway that rightafter i finished loading the image, the picturebox don't have to redraw it self again everytime we scroll the control.

 

The way I design the picture box is . I put the picture box on top of a panel which have the AutoScroll Property set to be True.

 

And every time I load the image, I do this:

Image i = Image.FromFile("test.jpg");

PictureBox.Width = i.Width;

.... same thing for height.....

 

PictureBox.Image = i;

 

 

I tried opening up MS Paint and use it to open the Big Image File, and while it takes quite a while to load it but right after it finished loading the picture, you can scroll around the image with ease

 

Sorry if I can't provide any specific chunk of codes, but I 'll be more than gladly to email it to you if you're willing tohelp me out

 

Urgent response is greatly appreciated

 

Henky

Posted

So is there anybody out there that can give a suggestion on how to create a custom picturebox ..

 

plus .. the image files that i'm trying to read is only about 1Mb in terms of Byte size. (it's in jpeg format) and it's even smaller in Gif format (around 500 kb).

 

So size wise it's not really that big

Posted

oh you mean diskspace i talk about memory.. in memory everything is bmp so ... :)

 

uhm your custom picturebox would have to only read the current needed data and not alle data of the picture..i think, maybe with some caching for a smooth scrolling

Posted

okay....

 

I stopped using the picturebox to draw my image anymore.

 

What I did is I used the a panel, overrides the OnPaint event for that panel.

 

in the OnPaint Panel I just create a graphics object of the Panel Control and call the graphics.DrawImage() method.

 

So based on the scrolling position I am able to draw a portion of the image which improves the loading time and performance alot.

 

But now how can I make the scrolling to be smooth.

You mentioned sometin' bout "Caching" ?? Any helpp...??

 

Again thanks for the reply.

Posted

Actually that's what i did... sorry for the confusion on my previous wording

 

protected override OnPaint (balbala... couldn't remember the details e)

 

e.Graphics... (this is the one that I used)...

 

 

 

so any suggestion on how to create a customize picturebox ?????

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...