ASP.NET开发经验(2) --- ASP.NET中的一些图形处理

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 kana99 的 blog

如果大家用过 sharepoint portal server 2001,一定会记得增加型文件夹中的一些很不错的特性,如文档检出/检入、发布、审批流程等,其中最吸引我的就是它通过在文档的图标上加一个特别的标记,来表示文档的状态,如下图所示:

自己在做文档管理系统时,也借鉴了这种做法,其实和给图片加水印的作法类似,主要代码如下:

//取源图像
image imgphoto = image.fromfile(ssourcefile);
bitmap bmphoto = new bitmap(imgphoto.width, imgphoto.height, pixelformat.format24bpprgb);
bmphoto.maketransparent();
//设置绘图面属性,呈现质量等   
graphics grphoto = graphics.fromimage(bmphoto);
grphoto.smoothingmode = smoothingmode.antialias;
grphoto.drawimage( imgphoto, new rectangle(0, 0, imgphoto.width, imgphoto.height), 0, 0, imgphoto.width, mgphoto.height, graphicsunit.pixel);


//打开要附加的水印图片
image imgwatermark = new bitmap(swatermarkfile);
bitmap bmwatermark = new bitmap(bmphoto);
bmwatermark.setresolution(imgphoto.horizontalresolution, imgphoto.verticalresolution);
graphics grwatermark = graphics.fromimage(bmwatermark);

int xposofwm = imgphoto.width - imgwatermark.width;
int yposofwm = imgphoto.height - imgwatermark.height;

//画
grwatermark.drawimage(imgwatermark,
   new rectangle(xposofwm,yposofwm,imgwatermark.width,imgwatermark.height),
   0,                 
   0,                  
   imgwatermark.width,           
   imgwatermark.height,     
   graphicsunit.pixel);

//保存最终图片
imgphoto = bmwatermark;
imgphoto.save(siconfilename,imageformat.png);

如果文档有审阅流程,那文档的流转图就非常受欢迎了,这样用户可以方便地查看文档正处于那个阶段。
其实与工作流有关软件可能都有这样要求,我目前没有找到更好的办法,利用 <table> ,将各个阶段
用线条和图形表示出来,办法虽有点笨,但好象显示效果还不错。

曾经试过 vml ,发现要动态地画这种图,就得很精确地控制屏幕上位置,比较麻烦,后来放弃了这种作法。

还曾经想用 visio automation 来试一下,发现 visio 的对象模型和 vba 比 word 和 excel 的难多了,工作量更大。

本文关键:ASP.NET开发经验(2) --- ASP.NET中的一些图形处理
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top