Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox
Laaaarge picturebox Laaaarge picturebox
Laaaarge picturebox
Go Back  Xtreme Visual Basic Talk > > > Laaaarge picturebox


Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2011, 11:33 PM
WhatsMyUsername's Avatar
WhatsMyUsername WhatsMyUsername is offline
Regular
 
Join Date: Jan 2011
Location: Currently? Costa Rica
Posts: 52
Default Laaaarge picturebox


You know my map editor project? Well, logically, you can make big maps. Huge maps actually. Even... umm... let's see.... 16000x16000 pixels.

Ok, it is unlikely the maps will be THAT big, but they can. And sometimes, my users will do it.

The map section (where you draw the tiles in), is a picturebox. The picturebox has a nice grid background (which means "transparent" or "blank" area). I draw my tiles on said picturebox. The picturebox is inside a Panel, with autoscroll. So if your map is big, you can scroll.

That works pretty well.

But, as I said, my users can and probably will (sometimes) create maps of the max size allowed: 16000x16000.

I tested that. The application got god**** slow. But it worked, haha.
Anyway, the application became so slow it was pretty unusable.

The "visible" area of the map view would be like 640x700 or something.

This performance problem probably lies in the fact I got a 16000x16000 picturebox. So, do you have any idea of another method to achieve this? The picturebox was very convenient for me, I could make it big and the Panel would use autoscroll, and it also had the background image feature...

Now you may be wondering why the heck can maps be 16000x16000. Well, trust me they should be =/.... and I know it is possible to do such with excellent performance, because I have seen other similar applications where you can do the same: huge maps, super fast.

Ideas? Thanks ~
Reply With Quote
  #2  
Old 01-30-2011, 12:34 AM
OnErr0r's Avatar
OnErr0rLaaaarge picturebox OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

I really doubt they are loading the entire map at once. 16Kx16Kx4 (32 bit) is nearly 1 GB of memory. For decent performance they're only loading what is visible plus a little more. I could even imagine loading 9 screens full (current viewport in the center). This would allow them to scroll one viewport worth in any direction before you'd have to load from disk. And the memory is a much more manageable 16 MB (1920x2100x4).
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #3  
Old 01-30-2011, 01:02 AM
WhatsMyUsername's Avatar
WhatsMyUsername WhatsMyUsername is offline
Regular
 
Join Date: Jan 2011
Location: Currently? Costa Rica
Posts: 52
Default

Hmm... load only the visible part... that can't be done with a picturebox, or can it? I mean, the simple fact the picturebox is 16kx16k............ hummmm....
Reply With Quote
  #4  
Old 01-30-2011, 08:04 PM
AtmaWeapon's Avatar
AtmaWeaponLaaaarge picturebox AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Performing graphics work in WinForms and limiting yourself to what can be done with the picture box control is like trying to drive a car with no brake pedal: with great skill you can accomplish much but no one's going to blame you for taking the easy way.

Your 640x700 viewport is all you need to draw, since it's all that's on the screen at a given time. You might expand it slightly depending on your scrolling logic, but the point is there's no reason to load 160,000 units in any direction when you can't even display 1% of it on the screen.

If you're using a custom control and doing your own paint logic, this is a natural approach. If you're using a picture box, you have to take some extra steps. The picture box displays an image. You can draw whatever you want on that image. Instead of displaying a gigantic image, display a 640x700 image on which you only draw the part that's visible.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox Laaaarge picturebox
Laaaarge picturebox
Laaaarge picturebox
 
Laaaarge picturebox
Laaaarge picturebox
 
-->