DISLIN Visual C++ 配置

1、去这里下载 visual c++ 2008 express http://msdn.microsoft.com/en-us/express/future/bb421473 ,然后安装
2、下载VC对应的库版本,dl_10_vc.zip http://www.mps.mpg.de/dislin/windows.html 解压安装
3、设置环境变量 Control Panel -> System -> Advanced -> Environment

添加DISLIN环境变量为c:\dislin(根据安装位置做相应改变)
添加c:\dislin\win到path环境变量里

4、配置项目属性

a) 在visual c++ 2008 express里创建一个新的visual c++ 2008 express项目
b) 在Project -> Properties -> Configuration Properties -> C/C++ -> General里,把Additional Include Directories设置为dislin.h所在的目录,也即安装目录
c) 把disvcm.lib添加到Project -> Properties -> Configuration Properties -> Linker -> Input中的Additional Dependencies里(这里可以写绝对路径,或者先在General里把Additional Library Directories设为disvcm.lib所在目录,而这里这写disvcm.lib)
d) 设置运动时库为MT,Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded (/MT)


配置完成后就可以写代码了
可以去DISLIN的项目网站把示例代码拷入项目中测试一下

注意:默认的输出是生成一个.met的文件,要想直观的看到效果,在 disini(); 前添加一行metafl (“XWIN”); ,这样就能直接在窗口里看到结果喽。

[c highlight="19"]
#include
#include
#include "dislin.h"

main()
{ int n = 100, i, ic;
double fpi = 3.1415926/180., step, x;
float xray[100], y1ray[100], y2ray[100];

step = 360. / (n-1);

for (i = 0; i < n; i++)
{ xray[i] = i * step;
x = xray[i] * fpi;
y1ray[i] = sin(x);
y2ray[i] = cos(x);
}

metafl ("XWIN");
disini();
pagera();
complx();
axspos(450,1800);
axslen(2200,1200);

name("X-axis","x");
name("Y-axis","y");

labdig(-1,"x");
ticks(9,"x");
ticks(10,"y");

titlin("Demonstration of CURVE",1);
titlin("SIN(X), COS(X)",3);

ic=intrgb(0.95,0.95,0.95);
axsbgd(ic);

graf(0.,360.,0.,90.,-1.,1.,-1.,0.5);
setrgb(0.7,0.7,0.7);
grid(1,1);

color("fore");
height(50);
title();

color("red");
curve(xray,y1ray,n);
color("green");
curve(xray,y2ray,n);
disfin();
}
[/c]

生成的效果图如下

Demonstration of  DISLIN CURVE

怎么样,相当专业的吧 ^_^!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>