DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VB.NET and DPLOTLIB

 
Post new topic   Reply to topic    DPlot Forum Index -> Basic
View previous topic :: View next topic  
Author Message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Jun 23, 2004 12:49 pm    Post subject: VB.NET and DPLOTLIB Reply with quote

VB.NET demos using DPLOTLIB.DLL to create plots with DPlot or DPlot Jr are now available here: Exclamation (Edit: Removed. These demo programs are now included with the DPLOTLIB and DPlot Jr distributions.)

These demos require an updated DPLOTLIB.DLL, which is included in the .zip file.

I had fits trying to make DPlot_Plot work with VB.NET - the DPLOT structure passed to that function was gibberish. This may eventually be worked out, but for now I've punted: VB.NET programs should call the new function DPlot_PlotNET rather than DPlot_Plot. DPlot_PlotNET, like DPlot_Plot8, takes arrays of Double rather than Single; if this is an unworkable limitation for any VB.NET users please let me know.

This is all very preliminary; you may find that some features which work in VB demos don't work in your VB.NET programs... if so just let me know.

There's at least one curiosity in the .NET demos that has nothing at all to do with DPLOTLIB, but I'd like to figure it out just the same if any .NET gurus have an idea: the Project2 and Project4 demos paint to a picturebox control, and that picturebox is not updated if it is covered/uncovered. I've no idea why as I'm a 2-day VB.NET veteran - any suggestions would be appreciated.

Documentation for new functions is nonexistant other than comments in the source. Docs will be updated in the next full release.

Comments, suggestions, and criticisms are of course welcome.
_________________
Visualize Your Data
support@dplot.com


Last edited by DPlotAdmin on Thu Nov 17, 2005 10:19 am; edited 8 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Jun 23, 2004 6:37 pm    Post subject: Reply with quote

Perhaps my wife is right... I do need Ritalin Shocked

I've stumbled into the correct, or at least functional, way of making the original DPLOTLIB functions work with VB.NET. The solution involves a bit of convoluted .NET statements in the DPLOT structure, which you don't need to be concerned about unless you want to go insane along with me. See global.vb in each of the project folders if you are crazy (or want to be).

The updated distribution is in the same location: Exclamation (Edit: Removed. These demo programs are now included with the DPLOTLIB and DPlot Jr distributions.)

I still have no idea why the picture control isn't updated properly, though. If any VB.NET gurus can figure this out I'll buy the beer.
[Edit]Figured this one out finally, and it is incorporated in the new DPLOTLIB and DPlot Jr 1.967 distributions.[/Edit]
_________________
Visualize Your Data
support@dplot.com


Last edited by DPlotAdmin on Thu Nov 17, 2005 10:20 am; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JetDeveloper



Joined: 16 Feb 2005
Posts: 2

PostPosted: Wed Feb 16, 2005 2:33 pm    Post subject: Reply with quote

About the picture box update, I downloaded the latest version yesterday and the demos still don't work with redrawing after cover up.

However, I did make some changes to the code.

First of all, I use a .NET Bitmap object (System.Drawing.Bitmap)
Dim myBmp as Bitmap

Then instead of


If (hBitmap <> 0) Then
ret = DeleteObject(hBitmap)
hBitmap = 0
End If


I use


If (Not (myBmp Is Nothing)) Then
myBmp.Dispose()
myBmp = Nothing
End If


Then I changed the
hBitmap type from Integer to IntPtr
I also changed the return type of
DPlot_GetBitmapEx() from Integer to IntPtr

Finally, to draw the plot in the picture box, I use
Bitmap.FromHBitmap(hBitmap) and Picture1.Image=myBmp
This avoids a whole mess of WinAPI GDI calls.

It seems to redraw fine after I cover it up.

Code:

DocNum = DPlot_Plot8(d, x(0), y(0), cmds)
        If (DocNum > 0) Then
            DPM.size = Len(DPM)
            hBitmap2 = DPlot_GetBitmapEx(DocNum, rect.Right - rect.Left, rect.Bottom - rect.Top, DPM)
            myBmp = Bitmap.FromHbitmap(hBitmap2)
            HasMetrics = 1
            Picture1.Image = myBmp
            ' Be sure to do a FileClose after DPlot_GetBitmapEx (if you're done with the document)
            ret = DPlot_Command(DocNum, "[FileClose()]")
        End If
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Feb 16, 2005 2:55 pm    Post subject: Reply with quote

Outstanding, thanks for your input. I've plugged this in and it seems to work perfectly.

If your e-mail address on record here is correct you should have an e-mail soon. If not then please reply privately with your correct address.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlot_User



Joined: 17 May 2005
Posts: 5

PostPosted: Wed Aug 03, 2005 1:23 pm    Post subject: Reply with quote

I'm having a problem with the order of the data for a 3DS plot. Here's how I'm generating the data.


For intIndex = 0 To Points.GetUpperBound(0)
adblNodes(0, intIndex) = intIndex
adblNodes(1, intIndex) = 100 + intIndex
adblNodes(2, intIndex) = 200 + intIndex
Next

This should generate a series of X's starting at 0, Y's starting at 100, and Z's starting at 200, all incrementing by 1.

Instead the data is coming into DPlotJr as follows (Using Edit>Copy>DataValues)

000 001 002
003 004 005
006 007 008
009 100 101
102 103 104
105 106 107
108 109 200
201 202 203
204 205 206
207 208 209


Using the same method of data generation in VB6 produces this data order.

000 100 200
001 101 201
002 102 202
003 103 203
004 104 204
005 105 205
006 106 206
007 107 207
008 108 208
009 109 209

I can change my routines to order the values to work in this manner but I thought you might like to know since I don't think it's supposed to be doing this. Please correct me if I'm wrong.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Aug 03, 2005 1:59 pm    Post subject: Reply with quote

That's a difference between VB and VB.NET. VB.NET treats array dimensions the same way all C's do: last dimension varies the fastest. If you change your code to

Code:
For intIndex = 0 To Points.GetUpperBound(0)
adblNodes(intIndex,0) = intIndex
adblNodes(intIndex,1) = 100 + intIndex
adblNodes(intIndex,2) = 200 + intIndex
Next


it will work as expected (though not, of course, in VB6).
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlot_User



Joined: 17 May 2005
Posts: 5

PostPosted: Wed Aug 03, 2005 2:26 pm    Post subject: Reply with quote

OK.

Thanks for the quick response and thanks again for developing and supporting such a great product.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Basic All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group