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 

New C# DPLOTLIB example program

 
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C#
View previous topic :: View next topic  
Author Message
DPlotAdmin
Site Admin


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

PostPosted: Thu Mar 30, 2006 4:25 pm    Post subject: New C# DPLOTLIB example program Reply with quote

Warning: This is the fish-out-of-water version of a C# demo program. The limited examples in this demo work, but you may run into problems with DPLOTLIB functions not used in this demo. Requires Visual Studio 2005 (Express version is fine and was used to create this demo.)

Get the demo source from [Edit: removed. C# source is now part of the DPLOTLIB distribution: http://www.dplot.com/lib/dplotlib.zip ] I wasn't entirely sure what files were absolutely necessary, so everything (other than executables) is included.

This demo makes use of DPLOTLIB calls:
DPlot_GetVersion
DPlot_Plot8
DPlot_Request
DPlot_SetErrorMethod

As far as I can tell, the interface to other DPLOTLIB commands is correct. But not tested, so use at your own risk.

A couple of notes:

All of the interface stuff and the structure definitions are found in the file dplot.cs. This file was added to the demo project with Add>Class. This file will likely be made into a class library DLL eventually, to avoid forcing you to copy/paste the code every time you create a new project. Or maybe not. Honestly I don't know enough about this stuff to make much of an informed decision right now.

Finding DPLOTLIB.DLL: This was always confusing for VB users and I wanted to avoid that confusion this time around. If DPLOTLIB.DLL is located in the same folder as your executable then finding the DLL is no problem; it will always be found. But finding the DLL is a bit more trouble while debugging within the VS environment, unless, again, the DLL is located in your project's \bin\Debug folder (or is it \obj\Debug? What IS all that stuff, anyway? Very Happy ). That is of course doable, but it is at best inconvenient to remember to copy/paste the DLL for all new projects. Starting with version 2.0.4.1 of DPlot/DPlot Jr, the installation scripts write the location of DPLOTLIB.DLL to the registry at HKCU\Software\DPLOT\DPLOTLIB\Folder. If you don't have that version of DPlot or DPlot Jr you can of course get it, or make this change to the registry yourself. In the demo program's Form_Load event it calls the function FindDPLOTLIB in dplot.cs, which in turn checks the registry for the location. If found, it then changes the current directory to that folder so that all references to DPLOTLIB functions will be resolved.

I'm open to suggestions if anyone believes this is a bad idea. I can't think of a down side unless your application makes assumptions at startup about what the current directory is.

As always, your comments, suggestions, and criticisms are welcome. I'll be adding additional examples similar to the VB and C demos as time allows.
_________________
Visualize Your Data
support@dplot.com


Last edited by DPlotAdmin on Sat Apr 08, 2006 12:00 am; edited 1 time 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: Fri Mar 31, 2006 11:30 pm    Post subject: Reply with quote

Round 2: The original source has been replaced, new source is in the same location: [Edit: removed. C# source is now part of the DPLOTLIB distribution: http://www.dplot.com/lib/dplotlib.zip ] . This iteration contains a couple of bug fixes: replacing "int" with "IntPtr" in dplot.cs, and also contains 2 new demo programs. One that retrieves a bitmap image from a hidden DPlot or DPlot Jr and displays it in a PictureBox control in the application, the second does the same thing with an enhanced metafile. The bitmap demo also illustrates converting mouse position to plot coordinates (2D renderings only).


_________________
Visualize Your Data
support@dplot.com


Last edited by DPlotAdmin on Sat Apr 08, 2006 12:02 am; edited 2 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: Mon Apr 03, 2006 9:37 pm    Post subject: Reply with quote

One more example, same location: [Edit: removed. C# source is now part of the DPLOTLIB distribution: http://www.dplot.com/lib/dplotlib.zip ]

This iteration includes a real-time simulation that sends data to DPlot at regular intervals. See the test3 project.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
abolakomadic



Joined: 02 Jun 2006
Posts: 1

PostPosted: Thu Jun 08, 2006 4:57 am    Post subject: Reply with quote

i don't like it.
_________________
its me
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


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

PostPosted: Thu Jun 08, 2006 8:20 am    Post subject: Reply with quote

Can you be a little more specific? What is it you don't like?
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Juffman



Joined: 08 Mar 2008
Posts: 1

PostPosted: Sat Mar 08, 2008 6:51 am    Post subject: Reply with quote

Well Dave, I don't know what Mr Abolakomadic was smoking, but I thought you your C# examples for calling Dplot were bloody good. I reckon the free C# Visual Express from MS and your Dplot program is a fantastic programming platform for engineering/scientific plotting & graphing.

For complete nubes to C# (like myself), here are some tips to get the examples running properly:

1. Download and extract the dplotlib.dll and the C# example codes from:
http://www.dplot.com/lib/dplotlib.zip

2. Put the dplotlib.dll in a new directory called:
C:\Program Files\DPlot\addin

3. Double click the *.csproj files in the dplotlib\csharp\test? folders which you extracted from the dplotlib.zip file.

4. If you have installed the recently issued Visual Express 2008, then let the program do the necessay conversions from Dave's 2005 edition code.

5. Hit the 'play' button to run the program!

My favorite was the 'test4' example which shows how you can put a Dplot graph on a C# form. This will save me about a million hours of programming time for developing my own graphs. Very Happy
Back to top
View user's profile Send private message Send e-mail
DPlotAdmin
Site Admin


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

PostPosted: Sat Mar 08, 2008 8:48 am    Post subject: Reply with quote

Quote:
Well Dave, I don't know what Mr Abolakomadic was smoking...


I thought he might have a legitimate gripe and so left the post in place, but now I think Mr. Abolakomadic was likely just another spammer hoping to get a link to his site back when this forum was plagued with that sort of nonsense.

In any case, thanks for your post and particularly for your instructions.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C# 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