Drawing question

B

Bo Boersson

Hello

I have to draw something on a picturebox, the strings I am loading
dynamically from an xml file.
I am using double buffering technique, so I first draw to a bitmap and then
I use a picturebox-control to show it.
I always add a new line, and if the the height is higher than the
picturebox-control, I am still drawing and loading it to the
picturebox-control, so that I can browse through it using a scrollbar.

Sometimes I then have a height of 1500 pix, and onle 240 or 480 of them are
really visible. But as I want to be able to scroll fast, I just draw a
320x1500-bitmap, add it to the picturebox with also 320x1500, and then I am
just moving the top position of the control using the scrollbar.

It is working, but it is also using a loooot of memory to create a
320x1500-bitmap, and on some devices, even today, memory is an issue.

What other technique can I use to do it? I dont think that drawing in
real-time is fast enough?

Thanks

Bo
 
C

Chris Tacke, eMVP

Why do you think drawing in real time isn't fast enough? Have you tried?
How do you think things like a ListBox work?


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
S

Simon Hart [MVP]

What are you doing in your drawing code for it to render slowly in real time?
 
B

Bo Boersson

Hi

Actually I am loading data from an XML-File. Then I am adding combobox,
textbox and numericupdowns to a panel.
It is a dynamic checklist. So I pass an xml-file to my application and it
will create a checklist out of these values.

The problem is, that adding a new control to a panel is taking some time. So
I am loading all controls to the panel and then I have a scrollbar to scroll
through the whole checklist.

In the background of the panel, I have a picturebox where I am loading a
bitmap which I am drawing with the necessary strings I read from the
xml-file.
It is double-buffered, so I am first creating a bitmap, then I am drawing to
it and after that I am loading the bitmap in the picturebox.

This is working, but I am loading all of the checklist in one process and I
am drawing all of the strings (not only the actual visible strings) to the
bitmap. The problem is, that if the checklist is long, the bitmap is using
loooooots of memory, which is still a limited facter on lots of devices.

So my question is, you think that it is possible to only draw the necessary
strings to the bitmap (without flickering) AND loading the controls (up to
40) to the panel in realtime?

Thanks

Bo
 
C

Chris Tacke, eMVP

Well you're not going to load all of the controls constantly - it's going to
be a one-time thing (and 40 controls on a Form seems like a lot to me
anyway). I'm certain it will work though. Again, that's how a ListBox
works - it draws only the items that are visible, not every item in the
list.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top