Graphics VB2008 Pro

G

Galen Somerville

My graphics involves a lot of line drawings in a short period of time. I
have all the graphics in a separate module.

I repeatedly get the pixel data from a USB device, draw the requisite
traces, get more data, draw traces, etc.

The USB appears to take 82 ms between bursts of data. But the drawing is
taking 178 ms !!!

It's a real time display, like an oscilloscope, whereby I have to blank the
current 6 pixels, draw the new data in those 6 pixels then blank the next 6
pixels (to leave a gap that shows the traces moving across the screen).

By 6 pixels I mean horizontally. The lines represented by these 6 pixels can
have vertical pixels of, say, 50 pixels above and below an imaginary center
line. At the end of a full screen sweep, the current array info is saved to
a previous array so all the data is available.

Rather than post my code here, I have placed all the module info on my web
site. I would appreciate it if someone with mucho more knowledge than I
could take a look at it.

http://home.surewest.net/galen/private/PictDraw.zip

Thanks

Galen
 
G

Guest

My graphics involves a lot of line drawings in a short period of time. I
have all the graphics in a separate module.

I repeatedly get the pixel data from a USB device, draw the requisite
traces, get more data, draw traces, etc.

Have you looked at using WPF to do your graphics?
 
G

Galen Somerville

Galen Somerville said:
No, I'll look into that

Galen

Does anyone have a link to a simple VB.net module using WPF in 2D (drawing
lines).

All that I find are written in C variations.

Galen
 
W

Walter Wang [MSFT]

Hi Galen,

If you're looking for WPF samples, you can find many of them in the Windows
SDK
(http://www.microsoft.com/downloads/details.aspx?familyid=C2B1E300-F358-4523
-B479-F53D234CDCCF&displaylang=en) or your can search for them on
http://msdn2.microsoft.com and http://windowsclient.net

However, if this issue is still the previous one we have discussed long
time ago, remember managed code will probably never draw faster than low
level APIs such as DirectX.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Galen Somerville

Hi Walter

Yes it's the same problem. We originally solved the problem of a very slow
USB by using shared memory and activex.

I thought I would try VB2008 Pro but the slow drawing is still the problem.
After looking into WPF I got the impression it would be much faster than the
current graphics methods.

If this is not true then maybe I should look at shared memory and activex
for the drawing portion?

Incidentally I made a minor change in my VB6 app and now I can process Heart
beats well over 450 per minute whereas I was getting only around 300 tops.
This puts us in the realm of animals and birds.

Galen
 
W

Walter Wang [MSFT]

Hi Galen,

I agree doing animation in WPF would be better than in Winform. Based on
your actual scenario, you may have a try and see if it meets your
requirement.

I'm not sure how the shared memory would help the drawing part.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Galen Somerville

I'm currently setting up a WPF User control. We'll see what happens.

Galen
 
J

Just_a_fan

That's a really long time to draw 6 pixels.

Are you referencing the previous data and only turning off the pixel
that was on or are you blanking the entire column?

No, I did not download the code. Just a quick thought I had when I read
your post.

Mike
 
G

Galen Somerville

It's not just 6 pixels. From horizontal pixel 1 to horizontal pixel 2 may
have a difference of 100 vertical pixels.

And first it has to erase the previous trace between those 6 X pixels and
all of their Y components. Then it has to draw the new trace for those 6
pixels, etc.

Galen
 
J

Jeffrey Tan[MSFT]

Hi Galen,

Thanks for your feedback.

Have you tried to use the WPF approach for the painting? Does the
performance get better?

I would recommend you to draw the USB data into an internal memory buffer
first and commit the entire filled memory buffer to the control surface at
once. I assume this will boost the painting performance.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Galen,

Thanks for your feedback.

If you have problem of translate C# sample code into VB.net, you may
leverage some C# to VB.net translator tool such as the one below:
"C# to VB.NET Translator"
http://authors.aspalliance.com/aldotnet/examples/translate.aspx

Although the translation is not perfect, it really saves us 80~90% of time
during the translation.

Another approach is copying the C# sample code into a Visual Studio C#
project and compiling it into an assembly. Then, you may use Reflector to
open this assembly and examine it code in any languages: VB.net, IL, Delphi
etc... There are even certain plug-in in Reflector that can export the
entire assembly into source code with your specified language(VB.net). You
may download Reflector from the link below:
http://www.aisto.com/roeder/dotnet/

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Galen Somerville

I've been working on it on and off but my biggest problem is finding WPF
samples.

Most of them are C variations and I'm an old VB6 type of guy.

Galen
 

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