﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-西沉_NET</title><link>http://www.cnitblog.com/zyu20000/</link><description>NET技术</description><language>zh-cn</language><lastBuildDate>Tue, 05 May 2026 04:23:34 GMT</lastBuildDate><pubDate>Tue, 05 May 2026 04:23:34 GMT</pubDate><ttl>60</ttl><item><title>用OWC做统计图总结 </title><link>http://www.cnitblog.com/zyu20000/archive/2005/12/19/5586.html</link><dc:creator>西沉</dc:creator><author>西沉</author><pubDate>Mon, 19 Dec 2005 03:43:00 GMT</pubDate><guid>http://www.cnitblog.com/zyu20000/archive/2005/12/19/5586.html</guid><wfw:comment>http://www.cnitblog.com/zyu20000/comments/5586.html</wfw:comment><comments>http://www.cnitblog.com/zyu20000/archive/2005/12/19/5586.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/zyu20000/comments/commentRss/5586.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/zyu20000/services/trackbacks/5586.html</trackback:ping><description><![CDATA[&nbsp;最近做项目要对数据进行统计分析，所以做一些统计图，首先想到了微软的owc，同时自己把owc的操作封装了一下。在程序里调用里方便的多。 
<P>先看一下效果图：<BR><IMG height=320 alt=o_2005083116363353.gif src="http://www.cnitblog.com/images/cnitblog_com/zyu20000/o_2005083116363353.gif" width=500 border=0><BR><IMG height=300 alt=o_2005090510095092.gif src="http://www.cnitblog.com/images/cnitblog_com/zyu20000/o_2005090510095092.gif" width=530 border=0><BR><IMG height=300 alt=o_2005090616060239.gif src="http://www.cnitblog.com/images/cnitblog_com/zyu20000/o_2005090616060239.gif" width=530 border=0><BR></P>
<P>在使用该类前当然首先要引用一下owc的dll啦！</P>
<P>公布源码：<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000">&nbsp;System;<BR></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000">&nbsp;System.Data;<BR></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000">&nbsp;System.Text;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">using</SPAN><SPAN style="COLOR: #000000">&nbsp;Microsoft.Office.Interop;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">namespace</SPAN><SPAN style="COLOR: #000000">&nbsp;OWCChartTest<BR>{<BR>&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;利用OWC11进行作统计图的封装类。<BR>&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;李天平&nbsp;2005-8-31<BR>&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #808080"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;OWCChart11<BR>&nbsp;{<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#region</SPAN><SPAN style="COLOR: #000000">&nbsp;属性</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;_phaysicalimagepath;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;_title;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;_seriesname;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;_picwidth;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;_pichight;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;DataTable&nbsp;_datasource;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;strCategory;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;strValue;<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;图片存放路径<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #808080"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;PhaysicalImagePath<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">{_phaysicalimagepath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_phaysicalimagepath;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;Title<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">{_title</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_title;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;SeriesName<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">{_seriesname</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_seriesname;}<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;PicWidth<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">{_picwidth</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_picwidth;}<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;PicHight<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">{_pichight</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_pichight;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;DataTable&nbsp;DataSource<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;_datasource</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;strCategory</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">GetColumnsStr(_datasource);<BR>&nbsp;&nbsp;&nbsp;&nbsp;strValue</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">GetValueStr(_datasource);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;_datasource;}<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;GetColumnsStr(DataTable&nbsp;dt)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;StringBuilder&nbsp;strList</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;StringBuilder();<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000">(DataRow&nbsp;r&nbsp;</SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000">&nbsp;dt.Rows)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;strList.Append(r[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].ToString()</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">\t</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;strList.ToString();<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;GetValueStr(DataTable&nbsp;dt)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;StringBuilder&nbsp;strList</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;StringBuilder();<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000">(DataRow&nbsp;r&nbsp;</SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000">&nbsp;dt.Rows)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;strList.Append(r[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].ToString()</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">\t</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;strList.ToString();<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#endregion</SPAN><SPAN style="COLOR: #000000"><BR><BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;OWCChart11()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;OWCChart11(</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;PhaysicalImagePath,</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;Title,</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;SeriesName)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;_phaysicalimagepath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">PhaysicalImagePath;<BR>&nbsp;&nbsp;&nbsp;_title</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">Title;<BR>&nbsp;&nbsp;&nbsp;_seriesname</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">SeriesName;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;柱形图<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;returns&gt;&lt;/returns&gt;</SPAN><SPAN style="COLOR: #808080"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;CreateColumn()<BR>&nbsp;&nbsp;{&nbsp;<BR>&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpace&nbsp;objCSpace&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Microsoft.Office.Interop.Owc11.ChartSpaceClass();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">创建ChartSpace对象来放置图表&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChChart&nbsp;objChart&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objCSpace.Charts.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">在ChartSpace对象中添加图表，Add方法返回chart对象<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Microsoft.Office.Interop.OWC.ChartChartTypeEnum</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.Type</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypeColumnClustered;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表是否需要图例</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasLegend&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">标题</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Title.Caption</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_title;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Title.Font.Bold=true;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Title.Font.Color="blue";</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#region</SPAN><SPAN style="COLOR: #000000">&nbsp;样式设置&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000"><BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">旋转<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Rotation&nbsp;&nbsp;=&nbsp;360;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">表示指定三维图表的旋转角度<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Inclination&nbsp;=&nbsp;10;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">表示指定三维图表的视图斜率。有效范围为&nbsp;-90&nbsp;到&nbsp;90<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">背景颜色<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.PlotArea.Interior.Color&nbsp;=&nbsp;"red";<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">底座颜色<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.PlotArea.Floor.Interior.Color&nbsp;=&nbsp;"green";<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Overlap&nbsp;=&nbsp;50;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">单个类别中标志之间的重叠量</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#endregion</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">x,y轴的图示说明</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Title.Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">X&nbsp;：&nbsp;类别</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].Title.Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Y&nbsp;：&nbsp;数量</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">添加一个series</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChSeries&nbsp;ThisChSeries&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR><BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定series的名字</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),SeriesName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定分类</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strCategory);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strValue);<BR><BR>&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChDataLabels&nbsp;dl</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection.Add();&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;dl.HasValue</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;dl.Position=Microsoft.Office.Interop.Owc11.ChartDataLabelPositionEnum.chLabelPositionOutsideEnd;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;filename</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">DateTime.Now.ToString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">yyyyMMddHHmmssff</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;strAbsolutePath&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_phaysicalimagepath&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">filename;<BR>&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(strAbsolutePath,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;_picwidth,&nbsp;_pichight);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">输出成GIF文件.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;filename;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;饼图<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;returns&gt;&lt;/returns&gt;</SPAN><SPAN style="COLOR: #808080"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;CreatePie()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpace&nbsp;objCSpace&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Microsoft.Office.Interop.Owc11.ChartSpaceClass();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">创建ChartSpace对象来放置图表&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChChart&nbsp;objChart&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objCSpace.Charts.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">在ChartSpace对象中添加图表，Add方法返回chart对象<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表的类型</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.Type</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypePie;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表是否需要图例</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasLegend&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">标题</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Title.Caption</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_title;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">添加一个series</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChSeries&nbsp;ThisChSeries&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定series的名字</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),SeriesName);<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定分类</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strCategory);<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strValue);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">表示系列或趋势线上的单个数据标志</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChDataLabels&nbsp;dl</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection.Add();&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;dl.HasValue</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;dl.HasPercentage</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">图表绘图区的图例放置在右侧。<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;dl.Position=Microsoft.Office.Interop.Owc11.ChartDataLabelPositionEnum.chLabelPositionRight;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;filename</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">DateTime.Now.Ticks.ToString()</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;strAbsolutePath&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_phaysicalimagepath&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">filename;<BR>&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(strAbsolutePath,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;_picwidth,&nbsp;_pichight);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">输出成GIF文件.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;filename;<BR>&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;条形图<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;returns&gt;&lt;/returns&gt;</SPAN><SPAN style="COLOR: #808080"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;CreateBar()<BR>&nbsp;&nbsp;{&nbsp;<BR>&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpace&nbsp;objCSpace&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Microsoft.Office.Interop.Owc11.ChartSpaceClass();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">创建ChartSpace对象来放置图表&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChChart&nbsp;objChart&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objCSpace.Charts.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">在ChartSpace对象中添加图表，Add方法返回chart对象<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Microsoft.Office.Interop.OWC.ChartChartTypeEnum</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.Type</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypeBarClustered;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">指定图表是否需要图例</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasLegend&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">标题</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Title.Caption</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_title;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Title.Font.Bold=true;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Title.Font.Color="blue";</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#region</SPAN><SPAN style="COLOR: #000000">&nbsp;样式设置&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000"><BR><BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">旋转<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Rotation&nbsp;&nbsp;=&nbsp;360;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">表示指定三维图表的旋转角度<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Inclination&nbsp;=&nbsp;10;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">表示指定三维图表的视图斜率。有效范围为&nbsp;-90&nbsp;到&nbsp;90<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">背景颜色<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.PlotArea.Interior.Color&nbsp;=&nbsp;"red";<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">底座颜色<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.PlotArea.Floor.Interior.Color&nbsp;=&nbsp;"green";<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;objChart.Overlap&nbsp;=&nbsp;50;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">单个类别中标志之间的重叠量</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">#endregion</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">x,y轴的图示说明</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Title.Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">X&nbsp;：&nbsp;类别</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].HasTitle&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;objChart.Axes[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].Title.Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Y&nbsp;：&nbsp;数量</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">添加一个series</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChSeries&nbsp;ThisChSeries&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR><BR><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定series的名字</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),SeriesName);<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定分类</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strCategory);<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,<BR>&nbsp;&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(),strValue);<BR><BR>&nbsp;&nbsp;&nbsp;Microsoft.Office.Interop.Owc11.ChDataLabels&nbsp;dl</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection.Add();&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;dl.HasValue</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;&nbsp;&nbsp;dl.Position=Microsoft.Office.Interop.Owc11.ChartDataLabelPositionEnum.chLabelPositionOutsideEnd;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;filename</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">DateTime.Now.ToString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">yyyyMMddHHmmssff</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;strAbsolutePath&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;_phaysicalimagepath&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">filename;<BR>&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(strAbsolutePath,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;_picwidth,&nbsp;_pichight);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">输出成GIF文件.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;filename;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR><BR><BR>&nbsp;}<BR>}</SPAN></DIV><BR>在要显示统计图的页面代码直接调用就可以了<BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;OWCChart11&nbsp;chart</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;OWCChart11();&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;chart.Title</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">标题</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;chart.SeriesName</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">图例</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;filepath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">Server.MapPath(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\\ChartImages</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;chart.PhaysicalImagePath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">filepath;<BR>&nbsp;&nbsp;&nbsp;chart.PicHight</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">320</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;chart.PicWidth</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">500</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;chart.DataSource</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">GetData();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">这是你的数据源</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.Image1.ImageUrl</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">filepath</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">chart.CreateBar();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示给图像控件。</SPAN></DIV><img src ="http://www.cnitblog.com/zyu20000/aggbug/5586.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/zyu20000/" target="_blank">西沉</a> 2005-12-19 11:43 <a href="http://www.cnitblog.com/zyu20000/archive/2005/12/19/5586.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>File文件控件，选中文件(图片,flash,视频)即立即预览显示()</title><link>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5341.html</link><dc:creator>西沉</dc:creator><author>西沉</author><pubDate>Tue, 13 Dec 2005 09:11:00 GMT</pubDate><guid>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5341.html</guid><wfw:comment>http://www.cnitblog.com/zyu20000/comments/5341.html</wfw:comment><comments>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5341.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/zyu20000/comments/commentRss/5341.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/zyu20000/services/trackbacks/5341.html</trackback:ping><description><![CDATA[&nbsp;&nbsp; 继续总结项目里的一些小TIP，我们平常用file文件控件上传文件，要预览有时会刷新页面，结果file控件被清空，好多人问能能让他不清空或重新赋值，因为处于安全性的考虑，这是不可能的。那怎么进行无刷新预览呢？这里我把我所使用的方法写一下。 
<P><STRONG>选择页面：</STRONG></P>
<P>&lt;script language="javascript"&gt;<BR>function checkData()<BR>{<BR>&nbsp;&nbsp;var fileName=document.getElementById("FileUp").value;<BR>&nbsp;&nbsp;if(fileName=="")<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;<FONT color=#339966>&nbsp;//检查文件类型<BR></FONT>&nbsp;&nbsp;var exName=fileName.substr(fileName.lastIndexOf(".")+1).toUpperCase()&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;if(exName=="JPG"||exName=="BMP"||exName=="GIF")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//document.getElementById("myimg").src=fileName;<BR>&nbsp;&nbsp;&nbsp;document.getElementById("previewImage").innerHTML='&lt;img src=\''+fileName+'\' width=100 height=100 &gt;';<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;if(exName=="SWF")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;document.getElementById("previewImage").innerHTML='&lt;embed src=\''+fileName+'\' width=\'100\' height=\'100\' quality=\'high\' bgcolor=\'#f5f5f5\' &gt;&lt;/embed&gt;';&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;if(exName=="WMV"||exName=="MPEG"||exName=="ASF"||exName=="AVI")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;var strcode='&lt;embed src=\''+fileName+'\' border=\'0\' width=\'100\' height=\'100\' quality=\'high\' ';<BR>&nbsp;&nbsp;&nbsp;strcode+=' autoStart=\'1\' playCount=\'0\' enableContextMenu=\'0\' type=\'application/x-mplayer2\'&gt;&lt;/embed&gt;';<BR>&nbsp;&nbsp;&nbsp;document.getElementById("previewImage").innerHTML=strcode;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;alert("请选择正确的图片文件");<BR>&nbsp;&nbsp;&nbsp;document.getElementById("FileUp").value="";<BR>&nbsp;&nbsp;}&nbsp;<BR>}<BR>function openwin() <BR>{ &nbsp;&nbsp;&nbsp;<BR>&nbsp;window.open("addPreview.aspx","","height=300,width=345,top=100,left=100");&nbsp;&nbsp;<BR>} </P>
<P>&lt;/script&gt;</P>
<P><STRONG>HTML代码：</STRONG></P>
<P>&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" ID="Table1"&gt;<BR>&nbsp;&lt;tr&gt;<BR>&nbsp;&nbsp;&lt;td width="255" height="100%" valign="middle"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;INPUT id="FileUp" style="WIDTH: 253px; HEIGHT: 22px" type="file" size="23" name="File1"<BR>&nbsp;&nbsp;&nbsp;&nbsp;runat="server" onchange="checkData()"&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbsp;&amp;nbsp;&amp;nbsp;注：这里可以是图片（jpg或gif格式）,flash动画（swf）及视频文件（wmv,mpeg,asf,avi）。大小限定在1M以内。<BR>&nbsp;&nbsp;&lt;/td&gt;<BR>&nbsp;&nbsp;&lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;div id="previewImage"&gt;当前页预览&lt;/div&gt;<BR>&nbsp;&nbsp;&lt;/td&gt;<BR>&nbsp;&lt;/tr&gt;<BR>&lt;/table&gt;</P>
<P><STRONG>弹出预览页面：</STRONG></P>
<P>&lt;script language="javascript"&gt;<BR>function getstr()<BR>{&nbsp;&nbsp;&nbsp;<BR>&nbsp;var strcode="";&nbsp;<BR>&nbsp;var width=100;<BR>&nbsp;var high=100;<BR>&nbsp;if(self.opener.document.getElementById("FileUp")!=null)<BR>&nbsp;{<BR>&nbsp;&nbsp;//strcode=self.opener.document.getElementById("previewImage").innerHTML;<BR>&nbsp;&nbsp;width=self.opener.document.getElementById("lblWidth").innerText;<BR>&nbsp;&nbsp;high=self.opener.document.getElementById("lblHigh").innerText;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;var fileName=self.opener.document.getElementById("FileUp").value;<BR>&nbsp;&nbsp;var exName=fileName.substr(fileName.lastIndexOf(".")+1).toUpperCase()&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;if(exName=="JPG"||exName=="BMP"||exName=="GIF")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//document.getElementById("myimg").src=fileName;<BR>&nbsp;&nbsp;&nbsp;strcode='&lt;img src=\''+fileName+'\' width='+width+' height='+high+' &gt;';<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;if(exName=="SWF")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;strcode='&lt;embed src=\''+fileName+'\' width=\''+width+'\' height=\''+high+'\' quality=\'high\' &gt;&lt;/embed&gt;';&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;if(exName=="WMV"||exName=="MPEG"||exName=="ASF"||exName=="AVI")<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;strcode='&lt;embed src=\''+fileName+'\' border=\'0\' width=\''+width+'\' height=\''+high+'\' quality=\'high\' ';<BR>&nbsp;&nbsp;strcode+=' autoStart=\'1\' playCount=\'0\' enableContextMenu=\'0\' type=\'application/x-mplayer2\'&gt;&lt;/embed&gt;';<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;if(self.opener.document.getElementById("txtADCode")!=null)<BR>&nbsp;{<BR>&nbsp;&nbsp;strcode=self.opener.document.getElementById("txtADCode").innerHTML;&nbsp;<BR>&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;if(strcode!="")<BR>&nbsp;{<BR>&nbsp;&nbsp;//window.alert(fileName);<BR>&nbsp;&nbsp;document.getElementById("showimg").innerHTML=strcode;<BR>&nbsp;}&nbsp;&nbsp;&nbsp;<BR>}</P>
<P>&lt;/script&gt;</P>
<P><STRONG>显示：</STRONG></P>
<P>&lt;div id="showimg"&gt;&lt;/div&gt;<BR><BR>来自：<A href="http://ltp.cnblogs.com/archive/2005/12/03/289688.html">http://ltp.cnblogs.com/archive/2005/12/03/289688.html</A></P><img src ="http://www.cnitblog.com/zyu20000/aggbug/5341.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/zyu20000/" target="_blank">西沉</a> 2005-12-13 17:11 <a href="http://www.cnitblog.com/zyu20000/archive/2005/12/13/5341.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NUnit2.0详细使用方法</title><link>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5340.html</link><dc:creator>西沉</dc:creator><author>西沉</author><pubDate>Tue, 13 Dec 2005 08:55:00 GMT</pubDate><guid>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5340.html</guid><wfw:comment>http://www.cnitblog.com/zyu20000/comments/5340.html</wfw:comment><comments>http://www.cnitblog.com/zyu20000/archive/2005/12/13/5340.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/zyu20000/comments/commentRss/5340.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/zyu20000/services/trackbacks/5340.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;&nbsp; 前一段时间,有人问我在.NET里如何进行TDD开发.这个问题促使我想对NUnit做一个详细的介绍.因为我们大家都知道NUnit是在.NET进行TDD的利器. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如果你已经知道很多关于NUnit的应用,请指出我的不对之处和提出一些建议，使本文更加完善.如果你对NUnit还不是...&nbsp;&nbsp;<a href='http://www.cnitblog.com/zyu20000/archive/2005/12/13/5340.html'>阅读全文</a><img src ="http://www.cnitblog.com/zyu20000/aggbug/5340.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/zyu20000/" target="_blank">西沉</a> 2005-12-13 16:55 <a href="http://www.cnitblog.com/zyu20000/archive/2005/12/13/5340.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>返回应用程序的绝对路径</title><link>http://www.cnitblog.com/zyu20000/archive/2005/12/12/5316.html</link><dc:creator>西沉</dc:creator><author>西沉</author><pubDate>Mon, 12 Dec 2005 09:48:00 GMT</pubDate><guid>http://www.cnitblog.com/zyu20000/archive/2005/12/12/5316.html</guid><wfw:comment>http://www.cnitblog.com/zyu20000/comments/5316.html</wfw:comment><comments>http://www.cnitblog.com/zyu20000/archive/2005/12/12/5316.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/zyu20000/comments/commentRss/5316.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/zyu20000/services/trackbacks/5316.html</trackback:ping><description><![CDATA[<P>&nbsp;</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_0_68_Open_Image onclick="this.style.display='none'; Codehighlighter1_0_68_Open_Text.style.display='none'; Codehighlighter1_0_68_Closed_Image.style.display='inline'; Codehighlighter1_0_68_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_0_68_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_68_Closed_Text.style.display='none'; Codehighlighter1_0_68_Open_Image.style.display='inline'; Codehighlighter1_0_68_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN id=Codehighlighter1_0_68_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_0_68_Open_Text><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;返回应用程序的绝对路径<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;/summary&gt;</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #808080">///</SPAN><SPAN style="COLOR: #008000">&nbsp;</SPAN><SPAN style="COLOR: #808080">&lt;returns&gt;&lt;/returns&gt;</SPAN><SPAN style="COLOR: #808080"></SPAN></SPAN><BR><SPAN style="COLOR: #008080">&nbsp;5</SPAN><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;root()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_101_436_Open_Image onclick="this.style.display='none'; Codehighlighter1_101_436_Open_Text.style.display='none'; Codehighlighter1_101_436_Closed_Image.style.display='inline'; Codehighlighter1_101_436_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_101_436_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_436_Closed_Text.style.display='none'; Codehighlighter1_101_436_Open_Image.style.display='inline'; Codehighlighter1_101_436_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align=top>&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_101_436_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.cnitblog.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_101_436_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;serverpath</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">HttpContext.Current.Request.ServerVariables[</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HTTPS</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">];<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;pro</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">(serverpath</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">on</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">https://</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">:</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">http://</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;servername</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">HttpContext.Current.Request.ServerVariables[</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Server_Name</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">];<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;appname</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">HttpContext.Current.Request.ApplicationPath;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;path</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">pro</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">servername</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">appname;<BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;path;<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>&nbsp;}<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV><img src ="http://www.cnitblog.com/zyu20000/aggbug/5316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/zyu20000/" target="_blank">西沉</a> 2005-12-12 17:48 <a href="http://www.cnitblog.com/zyu20000/archive/2005/12/12/5316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>