473,383 Members | 1,868 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,383 software developers and data experts.

GDI limitations dealing with panels and large images

Create a new form, chuck a panel on and place within the panel a picturebox
of about 1000 * 5000, make an image that size set that to the image property
of the picturebox, then set the minimum size properties of the scrollbar to
1000 * 5000 and then run.
It is insanely slowwwwwwww, the refresh is so poor at times the graphic
looks completely wrong, why is this? Is this a limitation of the GDI or am I
missing something or setting up something wrong?
As it stands to get round this problem i am now looking into direct draw
(DirectX9) as i've heard this has a better re-draw rate but is this the only
solution or I am doing this work for naught? Is there a better way around
this problem?

If there is please let me know.

Jax
Nov 16 '05 #1
2 2378
Hi, [Inline]

"Jaxson Tammaru"
<JaxsonREMOVETOSEND.TamREMOVEmaru@diaIFYOUWISHTOSE NDMEAMAILREMOVETHISmetric.
org> wrote in message news:cd**********@sparta.btinternet.com...
Create a new form, chuck a panel on and place within the panel a picturebox of about 1000 * 5000, make an image that size set that to the image property of the picturebox, then set the minimum size properties of the scrollbar to 1000 * 5000 and then run.
It is insanely slowwwwwwww, the refresh is so poor at times the graphic
looks completely wrong, why is this? Is this a limitation of the GDI or am I missing something or setting up something wrong?
As it stands to get round this problem i am now looking into direct draw
(DirectX9) as i've heard this has a better re-draw rate but is this the only solution or I am doing this work for naught? Is there a better way around
this problem?
You can always implement your own scrolling :

1 Place a picturebox(viewport size, not image size), a vscrollbar and an
hscrollbar on a form.
Set hscrollbar max to 1000-picturebox.Width.
Set vscrollbar max to 5000-picturebox.Height.
Choose a smallchange/largechange value.
2 Attach a paint handler for the picturebox and scroll handlers for the
scrollbars.
3 Follow the implementation below :

private Image img = Image.FromFile(".....");

private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// determine visible portion
Rectangle srcRect = new Rectangle(
hScrollBar1.Value,
vScrollBar1.Value,
pictureBox1.Width,
pictureBox1.Height);

// only draw the visible portion of the image
e.Graphics.DrawImage(img, 0, 0, srcRect, GraphicsUnit.Pixel );
}

private void vScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
pictureBox1.Invalidate();
}

private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
pictureBox1.Invalidate();
}

HTH,
greetings

If there is please let me know.

Jax

Nov 16 '05 #2
Thanks for the solution, I tested it out and it worked as you specified.
The direct draw that I am looking is is far more effective though as the GDI
solution does end up being a little jerky and therefore the Direct Draw
solution would appear to be best for potential users of this program to be
best pleased.

Thankyou very much for the solution, it certainly made me think twice about
getting in-depth with DirectX, although I am finiding it quite enjoyable
now.

Jax

"BMermuys" <so*****@someone.com> wrote in message
news:Hl**********************@phobos.telenet-ops.be...
Hi, [Inline]

"Jaxson Tammaru"
<JaxsonREMOVETOSEND.TamREMOVEmaru@diaIFYOUWISHTOSE NDMEAMAILREMOVETHISmetric. org> wrote in message news:cd**********@sparta.btinternet.com...
Create a new form, chuck a panel on and place within the panel a picturebox
of about 1000 * 5000, make an image that size set that to the image

property
of the picturebox, then set the minimum size properties of the scrollbar

to
1000 * 5000 and then run.
It is insanely slowwwwwwww, the refresh is so poor at times the graphic
looks completely wrong, why is this? Is this a limitation of the GDI or am I
missing something or setting up something wrong?
As it stands to get round this problem i am now looking into direct draw
(DirectX9) as i've heard this has a better re-draw rate but is this the

only
solution or I am doing this work for naught? Is there a better way

around this problem?


You can always implement your own scrolling :

1 Place a picturebox(viewport size, not image size), a vscrollbar and an
hscrollbar on a form.
Set hscrollbar max to 1000-picturebox.Width.
Set vscrollbar max to 5000-picturebox.Height.
Choose a smallchange/largechange value.
2 Attach a paint handler for the picturebox and scroll handlers for the
scrollbars.
3 Follow the implementation below :

private Image img = Image.FromFile(".....");

private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// determine visible portion
Rectangle srcRect = new Rectangle(
hScrollBar1.Value,
vScrollBar1.Value,
pictureBox1.Width,
pictureBox1.Height);

// only draw the visible portion of the image
e.Graphics.DrawImage(img, 0, 0, srcRect, GraphicsUnit.Pixel );
}

private void vScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
pictureBox1.Invalidate();
}

private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
pictureBox1.Invalidate();
}

HTH,
greetings

If there is please let me know.

Jax


Nov 16 '05 #3

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

Similar topics

3
by: DOK | last post by:
I'm creating an ad for eBay and want to keep the page condensed. I have 6 images - different views of an antique lap steel guitar - that need to show superb detail. I have cropped the images to...
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...
4
by: Trevor Oakley | last post by:
I have just started using a book entitled "Teach Yourself C# Web Programming" and I find C#/ASP.NET very easy and powerful. I am learning C# and ASP.NET using this book. I also have Visual .NET...
2
by: Picho | last post by:
Hi everyone. I have a webForm that gets input using the querystring , builds an image according to the input and therefor renders an image as a contentType/GIF in the output stream. I use...
4
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
3
by: mbc | last post by:
According to the official documentation: ------------------------------------------------------------------------- Limitations of PostgreSQL Maximum size for a database unlimited (4 TB...
0
by: V Arzola | last post by:
I've done extensive work developing a large on-line application form, only to find that it will not render properly in Firefox (1.5.0.1) or Netscape (8.0). The panels are overlapping each other...
9
by: questions? | last post by:
I am using malloc to allocation memory for a group of structures. I am not using a whole lot of memory. But my program can run without a problem on a machine with 2GB RAM, but with a machine less...
8
by: theCancerus | last post by:
Hi All, I am not sure if this is the right place to ask this question but i am very sure you may have faced this problem, i have already found some post related to this but not the answer i am...
0
by: =?Utf-8?B?Um9zYWxpbmQgUC4=?= | last post by:
Hello I have a very long aspx page that consists of several panels. I am using MaintainScrollPositionOnPostback = "true" in the page directive and framework 3.5. The scroll position on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.