<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
	<title>13COM.NET</title>
	<description>13com.net</description>
	<link>http://www.13com.net/article/</link>
	<language>zh-cn</language>
	<generator>NBArticle</generator>
	<managingEditor>service@13com.net</managingEditor>
	<item>
	<title><![CDATA[SWFObject 2.0的使用说明 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1138</link>
	<description><![CDATA[div id="myContent"&gt;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;p&gt;Alternative content&lt;/p&gt;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;/div&gt;&nbsp;&nbsp; 
<P>&nbsp;</P>
<P>swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes)有5个必须的参数和4个可选的参数：</P>
<P>swfUrl（String，必须的）指定SWF的URL。 <BR>id（String，必须的）指定将会被Flash内容替换的HTML元素（包含你的替换内容）的id。 <BR>width（String，必须的）指定SWF的宽。 <BR>height（String，必须的）指定SWF的高。 <BR>version（String，必须的）指定你发布的SWF对应的Flash Player版本（格式为：major.minor.release）。 <BR>expressInstallSwfurl（String，可选的）指定express install SWF的URL并激活Adobe express install [ <A href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75" target=_blank><FONT color=#000000>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75</FONT></A> ]。 <BR>flashvars（String，可选的）用name:value对指定你的flashvars。 <BR>params（String，可选的）用name:value对指定你的嵌套object元素的params。 <BR>attributes（String，可选的）用name:value对指定object的属性。 <BR>注意：在不破坏参数顺序的情况下，你可以忽略可选参数。如果你不想使用一个可选参数，但是会使用后面的一个可选参数，你可以简单的传入false作为参数的值。对flashvars、 params和 attributes这些JavaScript对象来说，你也可以相应的传入一个空对象{}。</P>
<P>&lt;script type="text/javascript" src="swfobject.js"&gt;&lt;/script&gt;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;script type="text/javascript"&gt;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;/script&gt;&nbsp;&nbsp; <BR>-------------------------------------------------------------------------</P>
<P>你可以为你的object元素添加下面这些常用的可选属性（attributes）[ <A href="http://www.w3schools.com/tags/tag_object.asp" target=_blank><FONT color=#000000>http://www.w3schools.com/tags/tag_object.asp</FONT></A> ]：</P>
<P>id <BR>name <BR>styleclass（不使用class，因为class也是ECMA4的保留关键字）s <BR>align <BR>你可以使用下面这些专用于Flash的可选param元素[ <A href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12701" target=_blank><FONT color=#000000>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12701</FONT></A> ]：</P>
<P>play <BR>loop <BR>menu <BR>quality <BR>scale <BR>salign <BR>wmode <BR>bgcolor <BR>base <BR>swliveconnect <BR>flashvars <BR>devicefont [ <A href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_13331" target=_blank><FONT color=#000000>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_13331</FONT></A> ] <BR>allowscriptaccess [ <A href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16494" target=_blank><FONT color=#000000>http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16494</FONT></A> ] <BR>seamlesstabbing [ <A href="http://www.adobe.com/support/documentation/en/flashplayer/7/releasenotes.html" target=_blank><FONT color=#000000>http://www.adobe.com/support/documentation/en/flashplayer/7/releasenotes.html</FONT></A> ] <BR>allowfullscreen [ <A href="http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html" target=_blank><FONT color=#000000>http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html</FONT></A> ] <BR>allownetworking [ <A href="http://livedocs.adobe.com/flash/9.0/main/00001079.html" target=_blank><FONT color=#000000>http://livedocs.adobe.com/flash/9.0/main/00001079.html</FONT></A> ] <BR>------------------------------------------------------------------------------------------------------------- <BR>&lt;script type="text/javascript"&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var flashvars = {};&nbsp;&nbsp;&nbsp; <BR>var params = {};&nbsp;&nbsp;&nbsp; <BR>var attributes = {};&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&lt;/script&gt;&nbsp;&nbsp; </P>
<P>&nbsp;</P>
<P>---------------------------------------------------------------------------------------------------------------------------</P>
<P>&lt;script type="text/javascript"&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var flashvars = {};&nbsp;&nbsp;&nbsp; <BR>flashvars.name1 = "hello";&nbsp;&nbsp;&nbsp; <BR>flashvars.name2 = "world";&nbsp;&nbsp;&nbsp; <BR>flashvars.name3 = "foobar";&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var params = {};&nbsp;&nbsp;&nbsp; <BR>params.menu = "false";&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var attributes = {};&nbsp;&nbsp;&nbsp; <BR>attributes.id = "myDynamicContent";&nbsp;&nbsp;&nbsp; <BR>attributes.name = "myDynamicContent";&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&lt;/script&gt;&nbsp; </P>
<P>------------------------------------------------------------------- </P>
<P>&lt;script type="text/javascript"&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", {name1:"hello",name2:"world",name3:"foobar"}, {menu:"false"}, {id:"myDynamicContent",name:"myDynamicContent"});&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&lt;/script&gt; <BR>-------------------------------------------------------------------- <BR>&lt;script type="text/javascript"&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var flashvars = false;&nbsp;&nbsp;&nbsp; <BR>var params = {};&nbsp;&nbsp;&nbsp; <BR>var attributes = {&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; id: "myDynamicContent",&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; name: "myDynamicContent"&nbsp;&nbsp; <BR>};&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&lt;/script&gt;&nbsp;&nbsp; <BR>-------------------------------------------------------</P>
<P>&lt;script type="text/javascript"&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>var flashvars = false;&nbsp;&nbsp;&nbsp; <BR>var params = {&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; menu: "false",&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; flashvars: "name1=hello&amp;name2=world&amp;name3=foobar"&nbsp;&nbsp; <BR>};&nbsp;&nbsp;&nbsp; <BR>var attributes = {&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; id: "myDynamicContent",&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; name: "myDynamicContent"&nbsp;&nbsp; <BR>};&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","expressInstall.swf", flashvars, params, attributes);&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; <BR>&lt;/script&gt;&nbsp;&nbsp; </P>
<P>================================================</P>
<P>&nbsp;</P>
<P>从SWFObject 1.5迁移到SWFObject 2.0的注意事项</P>
<P>SWFObject 2.0并不向后兼容SWFObject 1.5。 <BR>现在更倾向于在HTML页面的head标签中插入所有的脚本文件。 <BR>现在类库使用的是小写：swfobject，而不是SWFObject。 <BR>现在只能通过类库（的类）来访问方法（译者注：即静态方法），而不是像从SWFObject v1.5中那样通过SWFObject的实例来访问。 <BR>API跟以前完全不同了，而且更详尽：[ <A href="http://code.google.com/p/swfobject/wiki/SWFObject_2_0_api_javascript_dev" target=_blank><FONT color=#000000>http://code.google.com/p/swfobject/wiki/SWFObject_2_0_api_javascript_dev</FONT></A> ]。 <BR>如果浏览器对JavaScript和Flash有足够的支持，SWFObject 2.0会将整个替换内容，包括被引用的HTML容器元素，替换为Flash内容，而不是像SWFObject 1.5那样，只把被引用容器里面的内容替换为Flash内容。你现在可以这样转移你的CSS规则：为你的Flash内容定义与替换内容的容器元素相同的 id（前者将替换后者，所以你的id不会重复）。 </P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1138">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 23 May 2011 09:13:42 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1138</comments>
	</item>

	<item>
	<title><![CDATA[flash图表- OpenFlashChart(二) 属性和方法 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1137</link>
	<description><![CDATA[<P>Charts <BR>Chart Size <BR>创建 flash object 时指定 chart 的大小，下面代码指定宽为 550 ，高為 200 ， </P>
<P>&lt;script type="text/javascript"&gt; </P>
<P>swfobject.embedSWF("open-flash-chart.swf", "my_chart", "550", "200","9.0.0", "expressInstall.swf",{"data-file":"datafile/bar.aspx"}); </P>
<P>&nbsp; &lt;/script&gt; </P>
<P>效果圖：&nbsp; </P>
<P>也可以指定寬或高為 100% ，意為占滿整個瀏覽器窗口的寬度，或者高度，如下面代碼： </P>
<P>&lt;script type="text/javascript"&gt; </P>
<P>swfobject.embedSWF("open-flash-chart.swf", "my_chart", "550", '100%',"9.0.0", "expressInstall.swf",{"data-file":"datafile/bar.aspx"}); </P>
<P>&nbsp; &lt;/script&gt; </P>
<P>效果如圖：&nbsp; </P>
<P></P>
<P>Data Lines <BR>曲線圖，包括三種類型： Line( 平滑曲線 ) 、 LineDot( 帶實心點的曲線 ) 、 LineHollow( 帶空心點的曲線 ) 。如圖：&nbsp; </P>
<P>此三種類型都有以下三個屬性： </P>
<P>Width: 寬度，即曲線的粗細； </P>
<P>Dotsize: 實心點的大小； </P>
<P>Halosize: 空心點的大小； </P>
<P>如上圖中 LineDot 的實現代碼： </P>
<P>OpenFlashChart.LineDot line1 = new LineDot(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Values = data1; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.HaloSize = 0; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Width = 2; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.DotSize = 5; </P>
<P>Bar Chart <BR>在 .NET 中沒有 bar_outline 。 </P>
<P>Set_key 用來設置圖例，顏色與對應的 Bar 一致。 如 bar.Set_Key("Test",12); </P>
<P>Values 設置 Bar 的值，如： </P>
<P>List&lt;double&gt; values = new List&lt;double&gt;();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values.Add(random.Next(i, i * 2)); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Values = values; </P>
<P>見下圖： </P>
<P>&nbsp;</P>
<P>也可以在一個 chart 中顯示多組 Bar ：如圖：&nbsp; </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; 實現代碼如下： </P>
<P>&nbsp;&nbsp; Bar bar = new OpenFlashChart.Bar();&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Random random = new Random(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Colour = "#345";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Set_Key("Test",12);&nbsp;&nbsp; </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;double&gt; values = new List&lt;double&gt;(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;string&gt; aa=new List&lt;string&gt;(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values.Add(random.Next(i, i * 2)); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aa.Add(i.ToString()+" 月 "); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Values = values; </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bar bar1 = new Bar(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar1.Colour = "#ff0000"; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar1.Text = "test2"; </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;double&gt; bb = new List&lt;double&gt;(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bb.Add(random.Next(i, i * 2)+6); </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar1.Values = bb; </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.AddElement(bar1); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.AddElement(bar); </P>
<P></P>
<P></P>
<P></P>
<P></P>
<P>3D Bar Chart <BR>X_Axis.Set3D() 方法設置 X 軸的 3D 效果，如 chart.X_Axis.Set3D(12); 時：&nbsp; </P>
<P>Glass Bar Chart <BR>Fade Bar Chart <BR>.net 中沒有此類型。 </P>
<P>Sketch Bars <BR>在創建一個新的 Sketch Bar 時需要指定三個參數： </P>
<P>BarSketch bar = new OpenFlashChart.BarSketch("#ff0000", "#4f1", 4); 分別為 Bar 的顏色，外圍邊線的顏色， Offset ； </P>
<P>此外還可以但都設置這三個屬性，分別為： </P>
<P>bar.Colour 、 bar.OutlineColour 、 bar.offSet; </P>
<P>Offset 為 BarSketch 的整潔程度，默認值為 2. 如 bar.Offset =1 時 : </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; bar.Offset =9 時 : </P>
<P>Fillalpha 屬性設置當鼠標移上 Bar 時顏色變化的起始值，如 bar.Colour = "# ff0000 " ; bar.Fillalpha = 0.4; 當鼠標移上 Bar 時紅色從 0.4 到 1; </P>
<P></P>
<P>Area Bars <BR>.net 中沒有此類型。 </P>
<P></P>
<P>Bars+Lines <BR>同時創建兩個 ( 或者多個 )Bar 對象和 Line 對象， 最后通過 chart.AddElement(); 將其都加入到 chart 中來顯示： </P>
<P>&nbsp;</P>
<P>實現代碼如下： </P>
<P>Bar bar = new OpenFlashChart.Bar(); </P>
<P>Random random = new Random(); </P>
<P>bar.Colour = "#345"; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Fillalpha = 0.4; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Set_Key("Test",12); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;double&gt; values = new List&lt;double&gt;();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values.Add(random.Next(i, i * 2)); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bar.Values = values; </P>
<P>&nbsp;&nbsp;&nbsp; </P>
<P></P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;double&gt; data1 = new List&lt;double&gt;(); </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (double i = 0; i &lt; 6.2; i += 0.2) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data1.Add(Math.Sin(i) * 1.9 + 4); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OpenFlashChart.Line line1 = new Line(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Values = data1; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.HaloSize = 0; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Width = 2; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.DotSize = 5; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Set_Key("Line1", 12); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line1.Colour = "#ff0000"; </P>
<P></P>
<P></P>
<P>line 1 .DotStyleType.Tip="#val#%";// 鼠标悬浮时显示 </P>
<P></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.AddElement(line1); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.AddElement(bar); </P>
<P></P>
<P>Pie Chart <BR>餅狀圖， Values 屬性設置各部分的值，如 </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;PieValue&gt; values = new List&lt;PieValue&gt;(); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 12; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values.Add(new PieValue(random.NextDouble(),"Pie"+i)); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; labels.Add(i.ToString()); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values.Add(0.2); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pie.Values = values; </P>
<P>Colors 屬性設置顏色，如 pie.Colours = new string[] { "#00FA9A", "#FFFF00", "#0033FF", "#000000" }; 效果圖：&nbsp; </P>
<P>Pie Chart Links <BR>.net 中沒有此類型。 </P>
<P></P>
<P>Scatter Chart <BR>Mixed Scatter <BR>High Low Close <BR>.net 中沒有此類型。 </P>
<P></P>
<P>Candle <BR>.net 中沒有此類型。 </P>
<P></P>
<P>X Axis <BR>X Axis Labels <BR>設置 X 軸的標簽 值： </P>
<P>List&lt;string&gt; aa=new List&lt;string&gt;();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aa.Add(i.ToString()+" 月 "); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.X_Axis.Labels.Values=aa ; 如圖： </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.X_Axis.Labels.SetLabels(x_axis); 没有上面的 Values 属性 </P>
<P>&nbsp;</P>
<P>chart.X_Axis.TickHeight = "10"; 如圖： </P>
<P>&nbsp;</P>
<P>chart.X_Axis.Labels.Rotate 設置 X 軸標簽的旋轉方式，可選擇 horizontal 或者 vertical, vertical 旋轉時中文不會顯示，此處為 Bug 。 .NET 下選擇 45degrees 旋转沒有效果。 </P>
<P>如： </P>
<P>List&lt;string&gt; aa=new List&lt;string&gt;();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&nbsp; for (int i = 0; i &lt; 13; i++) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aa.Add(i.ToString()+" 月 "); </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chart.X_Axis.Labels.Values=aa ; </P>
<P>chart.X_Axis.Labels.Rotate = "vertical"; 時如圖：&nbsp; </P>
<P></P>
<P>chart.X_Axis.Labels.Vertical = true; 設置 X 軸的標簽是否為垂直旋轉， </P>
<P>chart.X_Axis.Labels.Color = "#ff0000"; 設置 X 軸標簽的顏色。 </P>
<P></P>
<P>X Axis Labels Step <BR>設置 X 軸標簽的間隔值 chart.X_Axis.Steps = 2; 時如圖：&nbsp; </P>
<P>X Axis Legend <BR>chart.Y_Legend&nbsp; 不能显示中文，不能显示英文 </P>
<P>設置 X 軸的圖例， chart.X_Legend = new Legend("x-axis legend"); 時如圖：&nbsp; </P>
<P></P>
<P>Y Axis <BR>Y Axis <BR>Steps 屬性設置 Y 軸標簽的間距值，如 chart.Y_Axis.Steps = 2; 時： </P>
<P>&nbsp;</P>
<P>TickLength 屬性 如圖 : </P>
<P>&nbsp;</P>
<P>Color 用來設置 Y 軸的顏色： chart.Y_Axis.Colour = "#FF33FF"; 時，如圖：&nbsp; </P>
<P>Y Axis Labels-off <BR>.NET 中沒有此設置。 </P>
<P>Right Y Axis <BR>.NET 中沒有此設置。 </P>
<P>Y Axis Legend <BR>設置 Y 軸的圖例， chart.Y_Legend = new Legend("y-axis legend"); 時如圖：&nbsp; </P>
<P>Y Min Max <BR>設置 Y 軸的最值， chart.Y_Axis.SetRange(0, 10); 時如圖：&nbsp; </P>
<P>On Click Events <BR>在生成的圖像上點擊觸發某個事件， .NET 里沒有。 </P>
<P>Bar Links <BR>Line Links <BR>Tooltips <BR>Tool tip <BR>設置鼠标在上面悬停时显示的内容； </P>
<P>Line extras <BR>線圖時， chart.Tooltip = new ToolTip("my tip #val#"); 如圖：&nbsp; </P>
<P>Bar extras <BR>棒狀圖時， chart.Tooltip = new ToolTip("TooptipTest&nbsp;&nbsp; #val#"); 如圖： </P>
<P>&nbsp;</P>
<P>Other bits <BR>Chart Title <BR>Chart 的標題，如 chart.Title = new Title("Bar 3D"); 時效果圖： </P>
<P>&nbsp;</P>
<P>Line and Key <BR>顯示多組數據時， Set_Key() 方法來設置圖例 </P>
<P>如 line1.Set_Key("Line1",12); </P>
<P>&nbsp; Line2.Set_Key("Line2",12); </P>
<P>Line3.Set_Key("Line3",12); 時效果圖：&nbsp; </P>
<P>Background Style <BR>chart.Bgcolor = "#FF00FF"; 設置 chart 的背景色： </P>
<P>&nbsp;</P>
<P>Background Image <BR>.net 沒有這個屬性設置。 </P>
<P>Inner Background Style <BR>.net 沒有這個屬性設置。 </P>
<P>Null datavalues <BR>X Offset <BR>X 軸的零點與 Y 軸之間是否有間距 ， 默認為 false, chart.X_Axis.Offset = true; 時：&nbsp; </P>
<P>Format Numbers <BR>.NET 沒有這個方法。 </P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1137">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 23 May 2011 09:11:42 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1137</comments>
	</item>

	<item>
	<title><![CDATA[OpenflashChart(三) Flash转换成image，并插入Excel,Excel提供下载 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1136</link>
	<description><![CDATA[Flash 转换成image 有两种方法 <BR>一 、通过javascript 把FLASH 把div 转成Image ，这种方法在客户端显示。不能保存到服务器。<BR>&nbsp; <BR>&lt; script src= "js/jquery-1.2.6.min.js" type= "text/javascript" &gt;&lt;/ script&gt;&nbsp;&nbsp; 
<P>&lt; script type= "text/javascript" src= "js/swfobject.js" &gt;&lt;/ script&gt; </P>
<P>&lt; script type= "text/javascript" &gt; </P>
<P>swfobject.embedSWF ( </P>
<P>&nbsp; "open-flash-chart.swf" , "my_chart" , </P>
<P>&nbsp; "550" , "250" , "9.0.0" , "expressInstall.swf" , </P>
<P>&nbsp; { "data-file" : "gallery/3d-bar-chart.php" } ) ; </P>
<P>&nbsp;</P>
<P>&lt;/ script&gt; </P>
<P>&nbsp;</P>
<P>// 这里使用jQuery 来操作，不喜欢这个框架的，可以使用Javascript 。查看：<A href="http://teethgrinder.co.uk/open-flash-chart-2/save-image-js.php" target=_blank><FONT color=#000000>http://teethgrinder.co.uk/open-flash-chart-2/save-image-js.php</FONT></A></P>
<P>&lt; script type= "text/javascript" &gt; </P>
<P>&nbsp;</P>
<P>OFC = {} ; </P>
<P>&nbsp;</P>
<P>OFC.jquery = { </P>
<P>&nbsp;&nbsp;&nbsp; name : "jQuery" , </P>
<P>&nbsp;&nbsp;&nbsp; version: function ( src) { return $( '#' + src)[ 0 ] .get_version () } , </P>
<P>&nbsp;&nbsp;&nbsp; rasterize: function ( src, dst) { $( '#' + dst) .replaceWith ( OFC.jquery .image ( src)) } , </P>
<P>&nbsp;&nbsp;&nbsp; image: function ( src) { return "&lt;img src='data:image/png;base64," + $( '#' + src)[ 0 ] .get_img_binary () + "' /&gt;" } , </P>
<P>&nbsp;&nbsp;&nbsp; popup: function ( src) { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var img_win = window.open ( '' , 'Charts: Export as Image' ) </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with ( img_win.document ) { </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write ( '&lt;html&gt;&lt;head&gt;&lt;title&gt;Charts: Export as Image&lt; \/ title&gt;&lt; \/ head&gt;&lt;body&gt;' + OFC.jquery .image ( src) + '&lt; \/ body&gt;&lt; \/ html&gt;' ) } </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // stop the 'loading...' message </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; img_win.document .close () ; </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; } </P>
<P>} </P>
<P>&nbsp;</P>
<P>// Using an object as namespaces is JS Best Practice. I like the Control.XXX style. </P>
<P>//if (!Control) {var Control = {}} </P>
<P>//if (typeof(Control == "undefined")) {var Control = {}} </P>
<P>if ( typeof ( Control == "undefined" )) { var Control = { OFC: OFC.jquery }} </P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>// By default, right-clicking on OFC and choosing "save image locally" calls this function. </P>
<P>// You are free to change the code in OFC and call my wrapper (Control.OFC.your_favorite_save_method) </P>
<P>// function save_image() { alert(1); Control.OFC.popup('my_chart') } </P>
<P>function save_image() { alert ( 1 ) ; OFC.jquery .popup ( 'my_chart' ) } </P>
<P>function moo() { alert ( 99 ) ; } ; </P>
<P>&lt;/ script&gt;</P>
<P><BR>&lt;INPUT TYPE =BUTTON OnClick ="OFC.jquery.rasterize('my_chart', 'img_chart_1')" VALUE ="Add image in the table" &gt;</P>
<P><BR>OFC.jquery.rasterize('my_chart', 'img_chart_1')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>//</P>
<P>rasterize 是转换成图片 </P>
<P>my_chart 、&nbsp; img_chart_1 为div 的ID&nbsp; my_chart 为显示FLASH 的。。 </P>
<P>mg_chart_1 就是把Image 转换成图片显示的ID</P>
<P>OFC.jquery.rasterize('my_chart', 'my_chart'); 这个就在原div 里转换成图片 </P>
<P>&nbsp;</P>
<P>OFC.jquery.popup('my_chart')&nbsp; 为打开一个新页面。输出一个图片 。 <BR>&nbsp; <BR>&nbsp; <BR>二 、使用 Post 圖片到服務器 <BR>这个又有两种传递方式。先介绍复杂的，自己研究了好久的。 - - <BR>&nbsp; <BR>&nbsp; <BR>一： javascirpt 傳递 base64 編碼圖片 <BR>&nbsp; <BR>Image: function ( src) { return "&lt;img src='data:image/png;base64," + document.getElementById ( src) .get_img_binary () + "' /&gt;" } , <BR>&nbsp; <BR>1 ）、 src 為 Flash DIV 的 ID <BR>2 ）、 data:image/png;base64," + document.getElementById ( src) .get_img_binary () 為 flash 轉換成 Base64 格式的圖片 <BR>&nbsp; <BR>&nbsp; <BR>二、 Post the image 把圖片上傳至服務器 <BR>&nbsp; <BR>function post_image_2(debug) <BR>{ <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; url = "Save_image.aspx?name=" + $("#my_chart" )[0].get_img_binary() +"" ; <BR>&nbsp;&nbsp;&nbsp; var ofc = findSWF("my_chart" ); <BR>&nbsp;&nbsp;&nbsp; // call our objects image_saved() method when finished <BR>&nbsp;&nbsp;&nbsp; x = ofc.post_image( url, 'my_chart.image_saved' , debug ); <BR>} <BR>&nbsp; <BR>1) 、 url 為把圖片傳到的頁面， name 就是傳遞圖片的參數 ---- <BR>$("#my_chart" )[0].get_img_binary() 為 Base64 格式的圖片 這里用到 jQuery 要引用 <BR>2 ）、 post_image 第二個參數只是彈出對話窗，顯示的字符串 <BR>3 ） debug 這里是 Boolen ， true 是已新窗口形式打開 Save_image.aspx 頁面， <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; False 在本窗口處理，不打開頁面，但執行 Save_image.aspx 頁面 有回發到該頁面 <BR>&nbsp; </P>
<P><BR>注：：：： IE6 、 IE7 是不支持 Base64 編碼 所以在 IE6 、 IE7 中不能彈窗，不能顯示圖片 <BR>&nbsp; <BR>&nbsp; <BR>三、 Save_image.aspx 頁的編碼 <BR>&nbsp; <BR>1、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 由於 Base64 編碼在地址傳值時，會把字符串的“ + ”轉成“ ”（空格），所以在取值時需要替換 <BR>&nbsp; string strname = Request.QueryString["name" ].ToString(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Base64ToImage( strname.Replace(' ' , '+' )); <BR>&nbsp; <BR>2 、 <BR>&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp; /// 把 Base64 編碼轉成 圖片保存至服務器 <BR>&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp; /// &lt;param name="base64String"&gt;&lt;/param&gt; <BR>public void Base64ToImage(string base64String) <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // base64String.Substring(0, base64String.Length / 40 * 40) 主要是 Base64 編碼長度有規定必須是 0 或 4 的整數倍，所以為免出錯，把長度處理一下 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte [] imageBytes = Convert .FromBase64String(base64String.Substring(0, base64String.Length / 40 * 40)); <BR>&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // byte[] imageBytes = Convert.FromBase64String(base64String.Substring(0,128)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemoryStream ms = new MemoryStream (imageBytes, 0, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imageBytes.Length); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert byte[] to Image <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ms.Write(imageBytes, 0, imageBytes.Length); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Drawing.Image image = System.Drawing.Image .FromStream(ms, true ); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image.Save(Server.MapPath("Report" ), ImageFormat .Png); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception ex) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Write("&lt;javascript&gt;alert('" + ex.Message + "')&lt;/javascript&gt;" ); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //} <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; <BR>在使用Convert.ToBase64String() 对字符串进行Base64 编码时，注意的几点：<BR>&nbsp;&nbsp; 例：string s = "Hello";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] bytes = Convert.FromBase64String(s);<BR>以上代码在运行时会抛出FormatException 异常. 提示为：Base-64 字符数组的无效长度 <BR>原因：<BR>当Convert.FromBase64String 方法的参数s 的长度小于4 或不是4 的偶数倍时，将会抛出FormatException 。<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; 例: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Convert.FromBase64String("Hell");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Normal.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Convert.FromBase64String("Hell ");&nbsp;&nbsp;&nbsp;&nbsp; // Normal. （忽略空格）<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Convert.FromBase64String("Hello!");&nbsp;&nbsp;&nbsp;&nbsp; // throw FormatException.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Convert.FromBase64String("Hello Net"); // Normal. （忽略空格） <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>附： <BR>// 把圖片轉換成 Base64 編碼的函數 <BR>&nbsp;&nbsp;&nbsp; public string ImageToBase64(System.Drawing.Image image, System.Drawing.Imaging.ImageFormat format) <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (MemoryStream ms = new MemoryStream ()) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert Image to byte[] <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image.Save(ms, format); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte [] imageBytes = ms.ToArray(); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert byte[] to Base64 String <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string base64String = Convert .ToBase64String(imageBytes); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return base64String; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>四、圖片插入 EXCEL 并 保存到服務器 <BR>1 ）、 InsertPictureToExcel 類 <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp; /// InsertPictureToExcel 的摘要说明 <BR>&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp; public class InsertPictureToExcel <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel.Application m_objExcel = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel.Workbooks m_objBooks = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel._Workbook m_objBook = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel.Sheets m_objSheets = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel._Worksheet m_objSheet = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Excel.Range m_objRange = null ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private object m_objOpt = System.Reflection.Missing .Value; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 打开没有模板的操作。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Open() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this .Open(String .Empty); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 功能：实现Excel 应用程序的打开 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;param name="TemplateFilePath"&gt; 模板文件物理路径 &lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Open(string TemplateFilePath) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 打开对象 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel = new Excel.Application (); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel.Visible = false ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel.DisplayAlerts = false ; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_objExcel.Version != "11.0" ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //MessageBox.Show(" 您的 Excel 版本不是 11.0 （Office 2003 ），操作可能会出现问题。"); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel.Quit(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBooks = (Excel.Workbooks )m_objExcel.Workbooks; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (TemplateFilePath.Equals(String .Empty)) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook = (Excel._Workbook )(m_objBooks.Add(m_objOpt)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook = m_objBooks.Open(TemplateFilePath, m_objOpt, m_objOpt, m_objOpt, m_objOpt, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objSheets = (Excel.Sheets )m_objBook.Worksheets; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objSheet = (Excel._Worksheet )(m_objSheets.get_Item(1)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //m_objExcel.WorkbookBeforeClose += new Excel.AppEvents_WorkbookBeforeCloseEventHandler(m_objExcel_WorkbookBeforeClose); <BR>&nbsp; <BR>// 這里 WEB 不能用，沒去研究，先注釋 ，在 WNDOW FORMS 里可以 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void m_objExcel_WorkbookBeforeClose(Excel.Workbook m_objBooks, ref bool _Cancel) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //MessageBox.Show(" 保存完毕！"); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 将图片插入到指定的单元格位置。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 注意：图片必须是绝对物理路径 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;param name="RangeName"&gt; 单元格名称，例如：B4 &lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;param name="PicturePath"&gt; 要插入图片的绝对路径。 &lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void InsertPicture(string RangeName, string PicturePath) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange = m_objSheet.get_Range(RangeName, m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange.Select(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Excel.Pictures pics = (Excel.Pictures )m_objSheet.Pictures(m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pics.Insert(PicturePath, m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 将图片插入到指定的单元格位置，并设置图片的宽度和高度。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 注意：图片必须是绝对物理路径 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;param name="RangeName"&gt; 单元格名称，例如：B4&lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;param name="PicturePath"&gt; 要插入图片的绝对路径。&lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;param name="PictuteWidth"&gt; 插入后，图片在Excel 中显示的宽度。&lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // &lt;param name="PictureHeight"&gt; 插入后，图片在Excel 中显示的高度。&lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //public void InsertPicture(string RangeName, string PicturePath, float PictuteWidth, float PictureHeight) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; m_objRange = m_objSheet.get_Range(RangeName, m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; m_objRange.Select(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; float PicLeft, PicTop; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; PicLeft = Convert.ToSingle(m_objRange.Left); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; PicTop = Convert.ToSingle(m_objRange.Top); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 参数含义： <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 图片路径 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 是否链接到文件 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 图片插入时是否随文档一起保存 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 图片在文档中的坐标位置（单位： points ） <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 图片显示的宽度和高度（单位： points ） <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 参数详细信息参见：<A href="http://msdn2.microsoft.com/zh-cn/library/aa221765(office.11).aspx" target=_blank><FONT color=#000000>http://msdn2.microsoft.com/zh-cn/library/aa221765(office.11).aspx</FONT></A> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; m_objSheet.Shapes.AddPicture(PicturePath, Microsoft.Office.Core.MsoTriState.msoFalse, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; Microsoft.Office.Core.MsoTriState.msoTrue, PicLeft, PicTop, PictuteWidth, PictureHeight); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //} <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 将Excel 文件保存到指定的目录，目录必须事先存在，文件名称不一定要存在。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;param name="OutputFilePath"&gt; 要保存成的文件的全路径。 &lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void SaveFile(string OutputFilePath) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook.SaveAs(OutputFilePath, m_objOpt, m_objOpt, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objOpt, m_objOpt, m_objOpt, Excel.XlSaveAsAccessMode .xlNoChange, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this .Close(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 关闭应用程序 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void Close() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook.Close(false , m_objOpt, m_objOpt); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel.Quit(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 释放所引用的COM 对象。注意：这个过程一定要执行。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Dispose() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReleaseObj(m_objSheets); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReleaseObj(m_objBook); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReleaseObj(m_objBooks); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReleaseObj(m_objExcel); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.GC .Collect(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.GC .WaitForPendingFinalizers(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// 释放对象，内部调用 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;/summary&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /// &lt;param name="o"&gt;&lt;/param&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void ReleaseObj(object o) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Runtime.InteropServices.Marshal .ReleaseComObject(o); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch { } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally { o = null ; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>2 ）、調用類方法 --- 完成圖片插入 Excel 并保存至服務器 <BR>&nbsp;&nbsp;&nbsp; // 圖片保存到Excel ，并將Excel 保存到服務器 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string picPath1 = Server.MapPath("Report.jpg" ).ToString(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InsertPictureToExcel ipt = new InsertPictureToExcel (); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipt.Open(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipt.InsertPicture("B2" , picPath1); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ipt.InsertPicture("B8", picPath2, 120, 80); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipt.SaveFile(Server.MapPath("ExcelTest1.xls" )); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipt.Dispose(); <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>五、 Excel 提供下載 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInfo fi = new FileInfo (Server.MapPath("ExcelTest1.xls" )); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (fi.Exists) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Clear(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // string file_name = fi.Name.Substring(randomnum.ToString().Length, fi.Name.Length - randomnum.ToString().Length); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.AddHeader("Content-Disposition" , "attachment; filename=" + System.Web.HttpUtility .UrlEncode("FRE01011.xls" , System.Text.Encoding .UTF8)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.AddHeader("Content-Length" , fi.Length.ToString()); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ContentType = "application/octet-stream" ; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Filter.Close(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.WriteFile(fi.FullName); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpContext .Current.ApplicationInstance.CompleteRequest(); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>&nbsp; <BR>上面的方法浏览器兼容不好。其实 openflashchart 内部就有传递一个参数。当时不懂。。现在也不太懂。。呵。。看下面。 <BR>&nbsp; <BR>&nbsp; <BR>function post_image()&nbsp; { <BR>&nbsp; $("#my_chart" )[0].post_image( "Save_image.aspx?name=postimage" , '' , true ); <BR>&nbsp;&nbsp;&nbsp; } <BR>Save_image.aspx?name=postimage" , 其实这个方法它应该做了把图片 post 页面去了。。（不知道怎么实现！！） <BR>&nbsp; <BR>在 Save_image.aspx 页只要 <BR>Request.SaveAs(Server.MapPath("Report.jpg" ).ToString(), false ); 就能保存到服务器。。插入 EXCEL 和给客户端下载 与上同。！</P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1136">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 23 May 2011 09:11:13 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1136</comments>
	</item>

	<item>
	<title><![CDATA[ASP.NET常用代码]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1135</link>
	<description><![CDATA[<P>1. 打开新的窗口并传送参数： <BR>传送参数：<BR>response.write("&lt;script&gt;window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&amp;id1="+...+"')&lt;/script&gt;")</P>
<P>接收参数：<BR>string a = Request.QueryString("id");<BR>string b = Request.QueryString("id1");</P>
<P><BR>2.为按钮添加对话框</P>
<P><BR>传送参数：<BR>response.write("&lt;script&gt;window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&amp;id1="+...+"')&lt;/script&gt;")</P>
<P>接收参数：<BR>string a = Request.QueryString("id");<BR>string b = Request.QueryString("id1");</P>
<P><BR>2.为按钮添加对话框</P>
<P>Button1.Attributes.Add("<I>onclick</I>","return confirm('确认?')");</P>
<P>button.attributes.add("<I>onclick</I>","if(confirm('are you sure...?')){return true;}else{return false;}")</P>
<P><BR>3.删除表格选定记录</P>
<P>int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex];<BR>string deleteCmd = "DELETE from Employee where emp_id = "<BR>myTableCell = e.Item.Cells[14];<BR>LinkButton myDeleteButton ;<BR>myDeleteButton = (LinkButton)myTableCell.Controls[0];<BR>myDeleteButton.Attributes.Add("<I>onclick</I>","return confirm('您是否确定要删除这条信息');");<BR>break;<BR>default:<BR>break;<BR>}</P>
<P>}</P>
<P><BR>5.点击表格行链接另一页</P>
<P>private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<BR>{<BR>//点击表格打开<BR>if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<BR>e.Item.Attributes.Add("<I>onclick</I>","window.open('Default.aspx?id=" + e.Item.Cells[0].Text + "');");<BR>}</P>
<P><BR>双击表格连接到另一页<BR>在itemDataBind事件中<BR>if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<BR>{<BR>string OrderItemID =e.item.cells[1].Text;<BR>...<BR>e.item.Attributes.Add("ondblclick", "location.href='../ShippedGrid.aspx?id=" + OrderItemID + "'");<BR>}<BR>双击表格打开新一页<BR>if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<BR>{<BR>string OrderItemID =e.item.cells[1].Text;<BR>...<BR>e.item.Attributes.Add("ondblclick", "open('../ShippedGrid.aspx?id=" + OrderItemID + "')");<BR>}<BR>★特别注意：【?id=】 处不能为 【?id =】</P>
<P>6.表格超连接列传递参数<BR>&lt;asp:HyperLinkColumn Target="_blank" headertext="ID号" DataTextField="id" NavigateUrl="aaa.aspx?id='&lt;%# DataBinder.Eval(Container.DataItem, "数据字段1")%&gt;' &amp; DataBinder.Eval(Container.DataItem, "数据字段2")%&gt;' /&gt;</P>
<P><BR>7.表格点击改变颜色<BR>if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)<BR>{<BR>e.Item.Attributes.Add("<I>onclick</I>","this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';");<BR>}</P>
<P><BR>写在DataGrid的_ItemDataBound里<BR>if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)<BR>{<BR>e.Item.Attributes.Add("<I>onmouse</I>over","this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';");<BR>e.Item.Attributes.Add("<I>onmouse</I>out","this.style.backgroundColor='';this.style.color='';");<BR>}</P>
<P>8.关于日期格式</P>
<P>日期格式设定<BR>DataFormatString="{0:yyyy-MM-dd}"</P>
<P>我觉得应该在itembound事件中<BR>e.items.cell["你的列"].text=DateTime.Parse(e.items.cell["你的列"].text.ToString("yyyy-MM-dd"))</P>
<P>9.获取错误信息并到指定页面<BR>不要使用Response.Redirect,而应该使用Server.Transfer<BR>e.g<BR>// in global.asax<BR>protected void Application_Error(Object sender, EventArgs e) {<BR>if (Server.GetLastError() is HttpUnhandledException)<BR>Server.Transfer("MyErrorPage.aspx");</P>
<P>//其余的非HttpUnhandledException异常交给ASP.NET自己处理就okay了 :)<BR>}</P>
<P>Redirect会导致post－back的产生从而丢失了错误信息，所以页面导向应该直接在服务器端执行，这样就可以在错误处理页面得到出错信息并进行相应的处理</P>
<P><BR>10.清空Cookie<BR>Cookie.Expires=[DateTime];<BR>Response.Cookies("UserName").Expires = 0</P>
<P><BR>11.自定义异常处理</P>
<P>//自定义异常处理类 <BR>using System;<BR>using System.Diagnostics;</P>
<P>namespace MyAppException<BR>{<BR>/// &lt;summary&gt;<BR>/// 从系统异常类ApplicationException继承的应用程序异常处理类。<BR>/// 自动将异常内容记录到Windows NT/2000的应用程序日志<BR>/// &lt;/summary&gt;<BR>public class AppException:System.ApplicationException<BR>{<BR>public AppException()<BR>{<BR>if (ApplicationConfiguration.EventLogEnabled)<BR>LogEvent("出现一个未知错误。");<BR>}</P>
<P>public AppException(string message)<BR>{<BR>LogEvent(message);<BR>}</P>
<P>public AppException(string message,Exception innerException)<BR>{<BR>LogEvent(message);<BR>if (innerException != null)<BR>{<BR>LogEvent(innerException.Message);<BR>}<BR>}</P>
<P>//日志记录类<BR>using System;<BR>using System.Configuration;<BR>using System.Diagnostics;<BR>using System.IO;<BR>using System.Text;<BR>using System.Threading;</P>
<P>namespace MyEventLog<BR>{<BR>/// &lt;summary&gt;<BR>/// 事件日志记录类，提供事件日志记录支持 <BR>/// &lt;remarks&gt;<BR>/// 定义了4个日志记录方法 (error, warning, info, trace) <BR>/// &lt;/remarks&gt;<BR>/// &lt;/summary&gt;<BR>public class ApplicationLog<BR>{<BR>/// &lt;summary&gt;<BR>/// 将错误信息记录到Win2000/NT事件日志中<BR>/// &lt;param &gt;需要记录的文本信息&lt;/param&gt;<BR>/// &lt;/summary&gt;<BR>public static void WriteError(String message)<BR>{<BR><BR>WriteLog(TraceLevel.Error, message);<BR>}<BR><BR>/// &lt;summary&gt;<BR>/// 将警告信息记录到Win2000/NT事件日志中<BR>/// &lt;param &gt;需要记录的文本信息&lt;/param&gt;<BR>/// &lt;/summary&gt;<BR>public static void WriteWarning(String message)<BR>{<BR><BR>WriteLog(TraceLevel.Warning, message);<BR>}<BR><BR>/// &lt;summary&gt;<BR>/// 将提示信息记录到Win2000/NT事件日志中<BR>/// &lt;param &gt;需要记录的文本信息&lt;/param&gt;<BR>/// &lt;/summary&gt;<BR>public static void WriteInfo(String message)<BR>{<BR>WriteLog(TraceLevel.Info, message);<BR>}<BR>/// &lt;summary&gt;<BR>/// 将跟踪信息记录到Win2000/NT事件日志中<BR>/// &lt;param &gt;需要记录的文本信息&lt;/param&gt;<BR>/// &lt;/summary&gt;<BR>public static void WriteTrace(String message)<BR>{<BR><BR>WriteLog(TraceLevel.Verbose, message);<BR>}<BR><BR>/// &lt;summary&gt;<BR>/// 格式化记录到事件日志的文本信息格式<BR>/// &lt;param &gt;需要格式化的异常对象&lt;/param&gt;<BR>/// &lt;param &gt;异常信息标题字符串.&lt;/param&gt;<BR>/// &lt;retvalue&gt;<BR>/// &lt;para&gt;格式后的异常信息字符串，包括异常内容和跟踪堆栈.&lt;/para&gt;<BR>/// &lt;/retvalue&gt;<BR>/// &lt;/summary&gt;<BR>public static String FormatException(Exception ex, String catchInfo)<BR>{<BR>StringBuilder strBuilder = new StringBuilder();<BR>if (catchInfo != String.Empty)<BR>{<BR>strBuilder.Append(catchInfo).Append("\r\n");<BR>}<BR>strBuilder.Append(ex.Message).Append("\r\n").Append(ex.StackTrace);<BR>return strBuilder.ToString();<BR>}</P>
<P>/// &lt;summary&gt;<BR>/// 实际事件日志写入方法<BR>/// &lt;param &gt;要记录信息的级别（error,warning,info,trace).&lt;/param&gt;<BR>/// &lt;param &gt;要记录的文本.&lt;/param&gt;<BR>/// &lt;/summary&gt;<BR>private static void WriteLog(TraceLevel level, String messageText)<BR>{<BR><BR>try<BR>{ <BR>EventLogEntryType LogEntryType;<BR>switch (level)<BR>{<BR>case TraceLevel.Error:<BR>LogEntryType = EventLogEntryType.Error;<BR>break;<BR>case TraceLevel.Warning:<BR>LogEntryType = EventLogEntryType.Warning;<BR>break;<BR>case TraceLevel.Inf<BR>LogEntryType = EventLogEntryType.Information;<BR>break;<BR>case TraceLevel.Verbose:<BR>LogEntryType = EventLogEntryType.SuccessAudit;<BR>break;<BR>default:<BR>LogEntryType = EventLogEntryType.SuccessAudit;<BR>break;<BR>}<BR><BR>EventLog eventLog = new EventLog("Application", ApplicationConfiguration.EventLogMachineName, ApplicationConfiguration.EventLogSourceName );<BR>//写入事件日志<BR>eventLog.WriteEntry(messageText, LogEntryType);<BR><BR>}<BR>catch {} //忽略任何异常<BR>} <BR>} //class ApplicationLog<BR>}</P>
<P><BR>12.Panel 横向滚动，纵向自动扩展<BR>&lt;asp:panel style="overflow-y:auto;"&gt;&lt;/asp:panel&gt;</P>
<P><BR>13.回车转换成Tab <BR>&lt;script language="javascript" for="document" event="<I>onkey</I>down"&gt;<BR>if(event.keyCode==13 &amp;&amp; event.srcElement.type!='button' &amp;&amp; event.srcElement.type!='submit' &amp;&amp; event.srcElement.type!='reset' &amp;&amp; event.srcElement.type!=''&amp;&amp; event.srcElement.type!='textarea'); <BR>event.keyCode=9;<BR>&lt;/script&gt;</P>
<P><I>onkey</I>down="if(event.keyCode==13) event.keyCode=9"</P>
<P><A href="http://dotnet.aspx.cc/exam/enter2tab.aspx"><FONT color=#002c99>http://dotnet.aspx.cc/exam/enter2tab.aspx</FONT></A></P>
<P><BR>14.DataGrid超级连接列<BR>DataNavigateUrlField="字段名" DataNavigateUrlFormatString="<A href="http://xx/inc/delete.aspx?ID={0"><FONT color=#002c99>http://xx/inc/delete.aspx?ID={0</FONT></A>}"</P>
<P><BR>15.DataGrid行随鼠标变色<BR>private void DGzf_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<BR>{<BR>if (e.Item.ItemType!=ListItemType.Header)<BR>{<BR>e.Item.Attributes.Add( "<I>onmouse</I>out","this.style.backgroundColor=\""+e.Item.Style["BACKGROUND-COLOR"]+"\"");<BR>e.Item.Attributes.Add( "<I>onmouse</I>over","this.style.backgroundColor=\""+ "#EFF3F7"+"\"");<BR>}<BR><BR>}</P>
<P><BR>16.模板列<BR>&lt;ASP:TEMPLATECOLUMN visible="False" sortexpression="demo" headertext="ID"&gt;<BR>&lt;ITEMTEMPLATE&gt;<BR>&lt;ASP:LABEL text='&lt;%# DataBinder.Eval(Container.DataItem, "ArticleID")%&gt;' runat="server" width="80%" /&gt;<BR>&lt;/ITEMTEMPLATE&gt;<BR>&lt;/ASP:TEMPLATECOLUMN&gt;</P>
<P><BR>&lt;ASP:TEMPLATECOLUMN headertext="选中"&gt;<BR>&lt;HEADERSTYLE wrap="False" horizontalalign="Center"&gt;&lt;/HEADERSTYLE&gt;<BR>&lt;ITEMTEMPLATE&gt;<BR>&lt;ASP:CHECKBOX runat="server" /&gt;<BR>&lt;/ITEMTEMPLATE&gt;<BR>&lt;EDITITEMTEMPLATE&gt;<BR>&lt;ASP:CHECKBOX runat="server" enabled="true" /&gt;<BR>&lt;/EDITITEMTEMPLATE&gt;<BR>&lt;/ASP:TEMPLATECOLUMN&gt;</P>
<P>后台代码</P>
<P>protected void CheckAll_CheckedChanged(object sender, System.EventArgs e)<BR>{<BR>//改变列的选定，实现全选或全不选。<BR>CheckBox chkExport ;<BR>if( CheckAll.Checked)<BR>{<BR>foreach(DataGridItem oDataGridItem in MyDataGrid.Items)<BR>{<BR>chkExport = (CheckBox)oDataGridItem.FindControl("chkExport");<BR>chkExport.Checked = true;<BR>}<BR>}<BR>else<BR>{<BR>foreach(DataGridItem oDataGridItem in MyDataGrid.Items)<BR>{<BR>chkExport = (CheckBox)oDataGridItem.FindControl("chkExport");<BR>chkExport.Checked = false;<BR>}<BR>}<BR>}</P>
<P>17.数字格式化<BR>【&lt;%#Container.DataItem("price")%&gt;的结果是500.0000，怎样格式化为500.00?】</P>
<P>&lt;%#Container.DataItem("price","{0:￥#,##0.00}")%&gt;</P>
<P>int i=123456;<BR>string s=i.ToString("###,###.00");</P>
<P>18.日期格式化</P>
<P>【aspx页面内：&lt;%# DataBinder.Eval(Container.DataItem,"Company_Ureg_Date")%&gt;<BR>显示为：%# DataBinder.Eval(Container.DataItem,"Company_Ureg_Date","{0:yyyy-M-d}")%&gt;</P>
<P>应该如何改？</P>
<P><BR>【格式化日期】<BR>取出来,一般是object<BR>((DateTime)objectFromDB).ToString("yyyy-MM-dd");</P><BR>HttpUtility.HtmlDecode(string) 
<P></P>
<P>19.如何设定全局变量<BR>Global.asax中</P>
<P>Application_Start()事件中</P>
<P>添加Application[属性名] ＝ xxx;</P>
<P>就是你的全局变量</P>
<P>20.怎样作到HyperLinkColumn生成的连接后，点击连接，打开新窗口？</P>
<P>HyperLinkColumn有个属性Target,将器值设置成"_blank"即可.(Target="_blank")</P>
<P>【ASPNETMENU】点击菜单项弹出新窗口<BR>在你的menuData.xml文件的菜单项中加入URLTarget="_blank"<BR>如：<BR>&lt;?xml version="1.0" encoding="GB2312"?&gt;<BR>&lt;MenuData ImagesBaseURL="images/"&gt; <BR>&lt;MenuGroup&gt;<BR>&lt;MenuItem Label="内参信息" URL="Infomation.aspx" &gt;<BR>&lt;MenuGroup &gt;<BR>&lt;MenuItem Label="公告信息" URL="Infomation.aspx" URLTarget="_blank" LeftIcon="file.gif"/&gt;<BR>&lt;MenuItem Label="编制信息简报" URL="NewInfo.aspx" LeftIcon="file.gif" /&gt;<BR>......<BR>最好将你的aspnetmenu升级到1.2版</P>
<P>21.委托讨论<BR><A href="http://community.csdn.net/Expert/topic/2651/2651579.xml?temp=.7183191"><FONT color=#002c99>http://community.csdn.net/Expert/topic/2651/2651579.xml?temp=.7183191</FONT></A><BR><A href="http://dev.csdn.net/develop/article/22/22951.shtm"><FONT color=#002c99>http://dev.csdn.net/develop/article/22/22951.shtm</FONT></A></P>
<P>22.读取DataGrid控件TextBox值</P>
<P>foreach(DataGrid dgi in yourDataGrid.Items)<BR>{<BR>TextBox tb = (TextBox)dgi.FindControl("yourTextBoxId");<BR>tb.Text....<BR>}</P>
<P>23.在DataGrid中有3个模板列包含Textbox分别为 DG_ShuLiang (数量) DG_DanJian(单价) DG_JinE(金额)分别在5.6.7列，要求在录入数量及单价的时候自动算出金额即:数量*单价=金额还要求录入时限制为 数值型.我如何用客户端脚本实现这个功能?</P>
<P>〖思归〗<BR>&lt;asp:TemplateColumn HeaderText="数量"&gt; <BR>&lt;ItemTemplate&gt;<BR>&lt;asp:TextBox runat='server' Text='&lt;%# DataBinder.Eval(Container.DataItem,"DG_ShuLiang")%&gt;' <BR><I>onkey</I>up="javascript：DoCal()"<BR>/&gt;</P>
<P>&lt;asp:RegularExpressionValidator runat="server" ControlToValidate="ShuLiang" ErrorMessage="must be integer" ValidationExpression="^\d+$" /&gt;<BR>&lt;/ItemTemplate&gt;<BR>&lt;/asp:TemplateColumn&gt;</P>
<P>&lt;asp:TemplateColumn HeaderText="单价"&gt; <BR>&lt;ItemTemplate&gt;<BR>&lt;asp:TextBox runat='server' Text='&lt;%# DataBinder.Eval(Container.DataItem,"DG_DanJian")%&gt;' <BR><I>onkey</I>up="javascript：DoCal()"<BR>/&gt;</P>
<P>&lt;asp:RegularExpressionValidator runat="server" ControlToValidate="DanJian" ErrorMessage="must be numeric" ValidationExpression="^\d+(\.\d*)?$" /&gt;</P>
<P>&lt;/ItemTemplate&gt;<BR>&lt;/asp:TemplateColumn&gt;</P>
<P>&lt;asp:TemplateColumn HeaderText="金额"&gt; <BR>&lt;ItemTemplate&gt;<BR>&lt;asp:TextBox runat='server' Text='&lt;%# DataBinder.Eval(Container.DataItem,"DG_JinE")%&gt;' /&gt;<BR>&lt;/ItemTemplate&gt;<BR>&lt;/asp:TemplateColumn&gt;</P>
<P>&lt;script language="javascript"&gt;<BR>function DoCal()<BR>{<BR>var e = event.srcElement;<BR>var row = e.parentNode.parentNode;<BR>var txts = row.all.tags("INPUT");<BR>if (!txts.length || txts.length &lt; 3)<BR>return;<BR><BR>var q = txts[txts.length-3].value;<BR>var p = txts[txts.length-2].value;</P>
<P>if (isNaN(q) || isNaN(p))<BR>return;</P>
<P>q = parseInt(q);<BR>p = parseFloat(p);</P>
<P>txts[txts.length-1].value = (q * p).toFixed(2);<BR>}<BR>&lt;/script&gt;</P>
<P><BR>24.datagrid选定比较底下的行时，为什么总是刷新一下，然后就滚动到了最上面，刚才选定的行因屏幕的关系就看不到了<BR>page_load <BR>page.smartNavigation=true</P>
<P>25.在Datagrid中修改数据，当点击编辑键时，数据出现在文本框中，怎么控制文本框的大小 ? </P>
<P>private void DataGrid1_ItemDataBound(obj sender,DataGridItemEventArgs e)<BR>{<BR>for(int i=0;i&lt;e.Item.Cells.Count-1;i++)<BR>if(e.Item.ItemType==ListItemType.EditType)<BR>{<BR>e.Item.Cells[i].Attributes.Add("Width", "80px")</P>
<P>} <BR>}</P>
<P><BR>26.对话框<BR>private static string ScriptBegin = "&lt;script language=\"JavaScript\"&gt;";<BR>private static string ScriptEnd = "&lt;/script&gt;";</P>
<P>public static void ConfirmMessageBox(string PageTarget,string Content)<BR>{</P>
<P>string ConfirmContent="var retValue=window.confirm('"+Content+"');"+"if(retValue){window.location='"+PageTarget+"';}";<BR><BR>ConfirmContent=ScriptBegin + ConfirmContent + ScriptEnd;<BR><BR>Page ParameterPage = (Page)System.Web.HttpContext.Current.Handler;<BR>ParameterPage.RegisterStartupScript("confirm",ConfirmContent);<BR>//Response.Write(strScript);<BR><BR>}</P>
<P>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－</P>
<P>27. 将时间格式化：string aa=DateTime.Now.ToString("yyyy年MM月dd日"); </P>
<P>1.1 取当前年月日时分秒 <BR>currentTime=System.DateTime.Now; </P>
<P>1.2 取当前年 <BR>int 年= DateTime.Now.Year; </P>
<P>1.3 取当前月 <BR>int 月= DateTime.Now.Month; </P>
<P>1.4 取当前日 <BR>int 日= DateTime.Now.Day; </P>
<P>1.5 取当前时 <BR>int 时= DateTime.Now.Hour; </P>
<P>1.6 取当前分 <BR>int 分= DateTime.Now.Minute; </P>
<P>1.7 取当前秒 <BR>int 秒= DateTime.Now.Second; </P>
<P>1.8 取当前毫秒 <BR>int 毫秒= DateTime.Now.Millisecond; </P>
<P>28．自定义分页代码：</P>
<P>先定义变量 ：public static int pageCount; //总页面数 </P>
<P>public static int curPageIndex=1; //当前页面 </P>
<P>下一页： </P>
<P>if(DataGrid1.CurrentPageIndex &lt; (DataGrid1.PageCount - 1)) </P>
<P>{ </P>
<P>DataGrid1.CurrentPageIndex += 1; </P>
<P>curPageIndex+=1; </P>
<P>} </P>
<P>bind(); // DataGrid1数据绑定函数 </P>
<P>上一页： </P>
<P>if(DataGrid1.CurrentPageIndex &gt;0) </P>
<P>{ </P>
<P>DataGrid1.CurrentPageIndex += 1; </P>
<P>curPageIndex-=1; </P>
<P>} </P>
<P>bind(); // DataGrid1数据绑定函数 </P>
<P>直接页面跳转： </P>
<P>int a=int.Parse(JumpPage.Value.Trim());//JumpPage.Value.Trim()为跳转值 </P>
<P>if(a&lt;DataGrid1.PageCount) </P>
<P>{ </P>
<P>this.DataGrid1.CurrentPageIndex=a; </P>
<P>} </P>
<P>bind(); </P>
<P>29．DataGrid使用： </P>
<P>3．1添加删除确认： </P>
<P>private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) </P>
<P>{ </P>
<P>foreach(DataGridItem di in this.DataGrid1.Items) </P>
<P>{ </P>
<P>if(di.ItemType==ListItemType.Item||di.ItemType==ListItemType.AlternatingItem) </P>
<P>{ </P>
<P>((LinkButton)di.Cells[8].Controls[0]).Attributes.Add("<I>onclick</I>","return confirm('确认删除此项吗?');"); </P>
<P>} </P>
<P>} </P>
<P>} </P>
<P>3．2样式交替： </P>
<P>ListItemType itemType = e.Item.ItemType; </P>
<P>if (itemType == ListItemType.Item ) </P>
<P>{ </P>
<P>e.Item.Attributes["<I>onmouse</I>out"] = "javascript：this.style.backgroundColor='#FFFFFF';"; </P>
<P>e.Item.Attributes["<I>onmouse</I>over"] = "javascript：this.style.backgroundColor='#d9ece1';cursor='hand';" ; </P>
<P>} </P>
<P>else if( itemType == ListItemType.AlternatingItem) </P>
<P>{ </P>
<P>e.Item.Attributes["<I>onmouse</I>out"] = "javascript：this.style.backgroundColor='#a0d7c4';"; </P>
<P>e.Item.Attributes["<I>onmouse</I>over"] = "javascript：this.style.backgroundColor='#d9ece1';cursor='hand';" ; </P>
<P>} </P>
<P>3．3添加一个编号列： </P>
<P>DataTable dt= c.ExecuteRtnTableForAccess(sqltxt); //执行sql返回的DataTable </P>
<P>DataColumn dc=dt.Columns.Add("number",System.Type.GetType("System.String")); </P>
<P>for(int i=0;i&lt;dt.Rows.Count;i++) </P>
<P>{ </P>
<P>dt.Rows[i]["number"]=(i+1).ToString(); </P>
<P>} </P>
<P>DataGrid1.DataSource=dt; </P>
<P>DataGrid1.DataBind(); </P>
<P>3．4 DataGrid1中添加一个CheckBox，页面中添加一个全选框 </P>
<P>private void CheckBox2_CheckedChanged(object sender, System.EventArgs e) </P>
<P>{ </P>
<P>foreach(DataGridItem thisitem in DataGrid1.Items) </P>
<P>{ </P>
<P>((CheckBox)thisitem.Cells[0].Controls[1]).Checked=CheckBox2.Checked; </P>
<P>} </P>
<P>} </P>
<P>将当前页面中DataGrid1显示的数据全部删除 </P>
<P>foreach(DataGridItem thisitem in DataGrid1.Items) </P>
<P>{ </P>
<P>if(((CheckBox)thisitem.Cells[0].Controls[1]).Checked) </P>
<P>{ </P>
<P>string strloginid= DataGrid1.DataKeys[thisitem.ItemIndex].ToString(); </P>
<P>Del (strloginid); //删除函数 </P>
<P>} </P>
<P>} </P>
<P>30．当文件在不同目录下，需要获取数据库连接字符串（如果连接字符串放在Web.config，然后在Global.asax中初始化） </P>
<P>在Application_Start中添加以下代码： </P>
<P>Application["ConnStr"]=this.Context.Request.PhysicalApplicationPath+ConfigurationSettings.AppSettings["ConnStr"].ToString(); </P>
<P>31． 变量.ToString() <BR>字符型转换 转为字符串 <BR>12345.ToString("n"); //生成 12,345.00 <BR>12345.ToString("C"); //生成 ￥12,345.00 <BR>12345.ToString("e"); //生成 1.234500e+004 <BR>12345.ToString("f4"); //生成 12345.0000 <BR>12345.ToString("x"); //生成 3039 (16进制) <BR>12345.ToString("p"); //生成 1,234,500.00% </P>
<P>32、变量.Substring(参数1,参数2); <BR>截取字串的一部分，参数1为左起始位数，参数2为截取几位。 <BR>如：string s1 = str.Substring(0,2); </P>
<P><BR>34.在自己的网站上登陆其他网站：(如果你的页面是通过嵌套方式的话，因为一个页面只能有一个FORM，这时可以导向另外一个页面再提交登陆信息) </P>
<P><BR>＜SCRIPT language="javascript"＞ <BR>＜!-- <BR>　function gook(pws) <BR>　{ <BR>　　frm.submit(); <BR>　} <BR>//--＞ </P>
<P>＜/SCRIPT＞ ＜body leftMargin="0" topMargin="0" marginwidth="0" marginheight="0"＞ <BR>＜form action=" <A href="http://220.194.55.68:6080/login.php?retid=7259"><FONT color=#002c99>http://220.194.55.68:6080/login.php?retid=7259</FONT></A> " method="post"＞ <BR>＜tr＞ <BR>＜td＞<BR>＜input type="hidden" size="1" runat="server"＞<BR>＜input type="hidden" size="1" runat="server"＞<BR>＜input type="hidden" size="1" runat="server"＞ </P>
<P>＜INPUT type="hidden" maxLength="20" size="1" value="5" ＞<BR>＜INPUT type="hidden" size="1" value="2" ＞ </P>
<P>＜/td＞ </P>
<P>＜/tr＞ </P>
<P>＜/form＞ </P>
<P>文本框的名称必须是你要登陆的网页上的名称，如果源码不行可以用vsniffer 看看。 <BR>　　下面是获取用户输入的登陆信息的代码： </P>
<P><BR>string name; <BR>name=Request.QueryString["EmailName"]; </P>
<P>try <BR>{ <BR>　int a=name.IndexOf("@",0,name.Length); <BR>　f_user.Value=name.Substring(0,a); <BR>　f_domain.Value=name.Substring(a+1,name.Length-(a+1)); <BR>　f_pass.Value=Request.QueryString["Psw"]; <BR>} </P>
<P>catch <BR>{ <BR>　Script.Alert("错误的邮箱!"); <BR>　Server.Transfer("index.aspx"); <BR>}</P>
<P>35.警告窗口 </P>
<P>/**//// &lt;summary&gt; <BR>/// 服务器端弹出alert对话框 <BR>/// &lt;/summary&gt; <BR>/// &lt;param &gt;提示信息,例子："不能为空!"&lt;/param&gt; <BR>/// &lt;param &gt;Page类&lt;/param&gt; <BR>public void Alert(string str_Message,Page page) <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt;alert('"+str_Message+"');&lt;/script&gt;"); <BR>} </P>
<P>36.重载此警告窗口,使某控件获得焦点</P>
<P><BR>/**//// &lt;summary&gt; <BR>/// 服务器端弹出alert对话框，并使控件获得焦点 <BR>/// &lt;/summary&gt; <BR>/// &lt;param &gt;获得焦点控件Id值,比如：txt_Name&lt;/param&gt; <BR>/// &lt;param &gt;提示信息,例子："请输入您姓名!"&lt;/param&gt; <BR>/// &lt;param &gt;Page类&lt;/param&gt; <BR>public void Alert(string str_Ctl_Name,string str_Message,Page page) <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt;alert('"+str_Message+"');document.forms(0)."+str_Ctl_Name+".focus(); document.forms(0)."+str_Ctl_Name+".select();&lt;/script&gt;"); <BR>} </P>
<P>37.确认对话框 </P>
<P><BR>/**//// &lt;summary&gt; <BR>/// 服务器端弹出confirm对话框 <BR>/// &lt;/summary&gt; <BR>/// &lt;param &gt;提示信息,例子："您是否确认删除!"&lt;/param&gt; <BR>/// &lt;param &gt;隐藏Botton按钮Id值,比如：btn_Flow&lt;/param&gt; <BR>/// &lt;param &gt;Page类&lt;/param&gt; <BR>public void Confirm(string str_Message,string btn,Page page) <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt; if (confirm('"+str_Message+"')==true){document.forms(0)."+btn+".click();}&lt;/script&gt;"); <BR>} </P>
<P>38.重载确认对话框，点击确定触发一个隐藏按钮事件，点击取消触发一个隐藏按钮事件</P>
<P><BR>/**//// &lt;summary&gt; <BR>/// 服务器端弹出confirm对话框,询问用户准备转向那些操作，包括“确定”和“取消”时的操作 <BR>/// &lt;/summary&gt; <BR>/// &lt;param &gt;提示信息，比如："成功增加数据,单击\"确定\"按钮填写流程,单击\"取消\"修改数据"&lt;/param&gt; <BR>/// &lt;param &gt;"确定"按钮id值&lt;/param&gt; <BR>/// &lt;param &gt;"取消"按钮id值&lt;/param&gt; <BR>/// &lt;param &gt;Page类&lt;/param&gt; <BR>public void Confirm(string str_Message,string btn_Redirect_Flow,string btn_Redirect_Self,Page page) <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt; if (confirm('"+str_Message+"')==true){document.forms(0)."+btn_Redirect_Flow+".click();}else{document.forms(0)."+btn_Redirect_Self+".click();}&lt;/script&gt;"); <BR>} </P>
<P>39.获得焦点 </P>
<P><BR>/**//// &lt;summary&gt; <BR>/// 使控件获得焦点 <BR>/// &lt;/summary&gt; <BR>/// &lt;param &gt;获得焦点控件Id值,比如：txt_Name&lt;/param&gt; <BR>/// &lt;param &gt;Page类&lt;/param&gt; <BR>public void GetFocus(string str_Ctl_Name,Page page) <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt;document.forms(0)."+str_Ctl_Name+".focus(); document.forms(0)."+str_Ctl_Name+".select();&lt;/script&gt;"); <BR>} </P>
<P>40.子窗体返回主窗体</P>
<P><BR>/**////&lt;summary&gt; <BR>///名称：redirect <BR>///功能：子窗体返回主窗体 <BR>///参数：url <BR>///返回值：空 <BR>///&lt;/summary&gt; <BR>public void redirect(string url,Page page) <BR>{ <BR>if ( Session["IfDefault"]!=(object)"Default") <BR>{ <BR>page.RegisterStartupScript("","&lt;script&gt;window.top.document.location.href='"+url+"';&lt;/script&gt;"); <BR>} <BR>} </P>
<P><BR>41.判断是否为数字 </P>
<P><BR>/**//// &lt;summary&gt;/summary&gt; <BR><BR>public bool IsNumberic(string oText) <BR>{ <BR>try <BR>{ <BR>int var1=Convert.ToInt32 (oText); <BR>return true; <BR>} <BR>catch <BR>{ <BR>return false; <BR>} <BR>} </P>
<P>获得字符串实际长度（包括中文字符） </P>
<P>//获得字符串oString的实际长度 <BR>public int StringLength(string oString) <BR>{ <BR>byte[] strArray=System.Text .Encoding.Default .GetBytes (oString); <BR>int res=strArray.Length ; <BR>return res; <BR>} </P>
<P>42.将回车转换为TAB </P>
<P><BR>//当在有keydown事件的控件上敲回车时，变为tab <BR>public void Tab(System.Web .UI.WebControls .WebControl webcontrol) <BR>{ <BR>webcontrol.Attributes .Add ("<I>onkey</I>down", "if(event.keyCode==13) event.keyCode=9"); <BR>} </P>
<P>43.datagrid分页中如果删除时出现超出索引 </P>
<P><BR>public void jumppage(System.Web.UI.WebControls.DataGrid dg) <BR>{ <BR>int int_PageLess; //定义页面跳转的页数 <BR>//如果当前页是最后一页 <BR>if(dg.CurrentPageIndex == dg.PageCount-1) <BR>{ <BR>//如果就只有一页 <BR>if(dg.CurrentPageIndex == 0) <BR>{ <BR>//删除后页面停在当前页 <BR>dg.CurrentPageIndex = dg.PageCount-1; <BR>} <BR>else <BR>{ <BR>//如果最后一页只有一条记录 <BR>if((dg.Items.Count % dg.PageSize == 1) || dg.PageSize == 1) <BR>{ <BR>//把最后一页最后一条记录删除后，页面应跳转到前一页 <BR>int_PageLess = 2; <BR>} <BR>else //如果最后一页的记录数大于1，那么在最后一页删除记录后仍然停在当前页 <BR>{ <BR>int_PageLess = 1; <BR>} <BR>dg.CurrentPageIndex = dg.PageCount - int_PageLess; <BR>} <BR>} <BR>} </P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1135">点击查看详细</a>] ]]></description>
	<pubDate>Sun, 20 Mar 2011 03:18:15 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1135</comments>
	</item>

	<item>
	<title><![CDATA[aspx数据库连接与访问方法(ADO.NET)]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1134</link>
	<description><![CDATA[<DIV class="bct fc05 fc11 nbw-blog ztag js-fs2">
<P><STRONG><FONT color=#0000ff>一．用SqlConnection连接SQL Server</FONT></STRONG></P>
<P><STRONG><FONT color=#0000ff>1..加入命名空间</FONT></STRONG></P>
<P>using System.Data.SqlClient;</P>
<P><STRONG><FONT color=#0000ff>2.连接数据库</FONT></STRONG></P>
<P>SqlConnection myConnection = new SqlConnection();<BR>myConnection.ConnectionString = "user catalog=test;data source=127.0.0.1;Connect Timeout=30";<BR>myConnection.Open();</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>改进（更通用）的方法：</FONT></STRONG></P>
<P>string MySqlConnection="user =test;data source=127.0.0.1;Connect Timeout=30";<BR>SqlConnection myConnection = new SqlConnection(MySqlConnection);<BR>myConnection.Open();</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>二。用OleDbConnection连接</FONT></STRONG></P>
<P><BR><STRONG><FONT color=#0000ff>1.加入命名空间</FONT></STRONG></P>
<P>using System.Data.OleDb;<BR>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>2.连接sql server</FONT></STRONG></P>
<P>string MySqlConnection="Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=test;Integrated Security=SSPI;";</P>
<P>SqlConnection myConnection = new SqlConnection(MySqlConnection);<BR>myConnection.Open();</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#3366ff>3.连接Access(可通过建立.udl文件获得字符串)</FONT></STRONG></P>
<P>string MySqlConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db2000.mdb;</P>
<P>Persist Security Info=False;</P>
<P><BR><STRONG><FONT color=#0000ff>4.连接Oracle(也可通过OracleConnection连接)</FONT></STRONG></P>
<P>string MySqlConnection="Provider=MSDAORA;Data Source=db; user ;</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>三.创建Command对象</FONT></STRONG></P>
<P><BR><STRONG>1．SqlCommand 构造函数</STRONG></P>
<P>①初始化 SqlCommand 类的新实例。public SqlCommand();</P>
<P>SqlCommand myCommand = new SqlCommand();</P>
<P>&nbsp;</P>
<P>②初始化具有查询文本的 SqlCommand 类的新实例。public SqlCommand(string);</P>
<P>String mySelectQuery = "SELECT * FROM mindata";<BR>SqlCommand myCommand = new SqlCommand(mySelectQuery);<BR>③初始化具有查询文本和 SqlConnection 的SqlCommand类实例。</P>
<P>Public SqlCommand(string, SqlConnection);</P>
<P>String mySelectQuery = "SELECT * FROM mindata";<BR>string myConnectString = "user ;<BR>SqlConnection myConnection = new SqlConnection(myConnectString);<BR>SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);<BR>&nbsp;</P>
<P>④初始化具有查询文本、SqlConnection 和 Transaction 的 SqlCommand 类实例。</P>
<P>public SqlCommand(string, SqlConnection, SqlTransaction);</P>
<P>SqlTransaction myTrans = myConnection.BeginTransaction();<BR>String mySelectQuery = "SELECT * FROM mindata";<BR>string myConnectString = "user ;<BR>SqlConnection myConnection = new SqlConnection(myConnectString);<BR>SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection, myTrans);<BR>&nbsp;</P>
<P><STRONG>2.建立SqlCommand与SqlConnection的关联。</STRONG></P>
<P>myCommand.Connection = myConnection;</P>
<P>或者：SqlCommand myCommand = myConnection.CreateCommand;</P>
<P>&nbsp;</P>
<P><STRONG>3．设置SqlCommand的查询文本。</STRONG></P>
<P>myCommand.CommandText = "SELECT * FROM mindata";</P>
<P>或者第2种构造：SqlCommand myCommand = new SqlCommand(mySelectQuery);</P>
<P>给SqlCommand对象提供两个查询字符串，每个查询字符串访问不同的表，返回不同的结果集。</P>
<P>两个查询语句用分号分隔。</P>
<P>&nbsp;</P>
<P><STRONG>4. 执行命令。</STRONG></P>
<P>ExecuteReader<BR>&nbsp;返回一行或多行<BR>&nbsp;<BR>ExecuteNonQuery<BR>&nbsp;对 Connection 执行 Transact-SQL 语句并返回受影响的行数(int)<BR>&nbsp;<BR>ExecuteScalar<BR>&nbsp;返回单个值(如一个聚合值).返回结果集中第一行的第一列。忽略额外的列或行<BR>&nbsp;<BR>ExecuteXmlReader<BR>&nbsp;将 CommandText 发送到 Connection 并生成一个 XmlReader 对象。<BR>&nbsp;</P>
<P>&nbsp;</P>
<P>SqlDataReader myReader = myCommand.ExecuteReader();</P>
<P>或SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);</P>
<P>&nbsp;&nbsp; while(myReader.Read()) //循环读取数据<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(myReader.GetString(0));// 获取指定列的字符串形式的值<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(myReader. GetValue(1));// 获取以本机格式表示的指定列的值<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;</P>
<P>CommandText = "select count(*) as NumberOfRegions from region";<BR>Int count = (int) myCommand.ExecuteScalar();</P>
<P>&nbsp;</P>
<P>关于OleDbCommand对象的使用。</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>四．DataReader的使用</FONT></STRONG></P>
<P><STRONG>1．遍历结果集</STRONG></P>
<P>while (myReader.Read())<BR>&nbsp; Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0), myReader.GetString(1));<BR>myReader.Close();<BR>&nbsp;</P>
<P><STRONG>2．使用序数索引器。</STRONG></P>
<P>while (myReader.Read())<BR>&nbsp; Console.WriteLine("\t{0}\t{1}", myReader[0].ToString(), myReader[1].ToString());<BR>myReader.Close();</P>
<P><BR><STRONG>3．使用列名索引器。</STRONG></P>
<P>while (myReader.Read())<BR>&nbsp; Console.WriteLine("\t{0}\t{1}", myReader["code].ToString(), myReader["name"].ToString());<BR>myReader.Close();</P>
<P>&nbsp;</P>
<P><STRONG>4.使用类型访问器。</STRONG></P>
<P>public char GetChar(int i); 获取指定列的单个字符串形式的值<BR>public DateTime GetDateTime(int i); 获取指定列的 DateTime 对象形式的值<BR>public short GetInt16(int i); 获取指定列的 16 位有符号整数形式的[C#]<BR>public string GetString(int i); 获取指定列的字符串形式的值</P>
<P><BR><STRONG>5．得到列信息。</STRONG></P>
<P>myReader.FieldCount&nbsp;&nbsp;&nbsp;&nbsp; 获取当前行中的列数<BR>myReader.GetFieldType(序号)&nbsp;&nbsp; 获取是对象的数据类型的 Type<BR>myReader.GetDataTypeName(序号)&nbsp; 获取源数据类型的名称<BR>myReader.GetName(序号)&nbsp;&nbsp;&nbsp;&nbsp; 获取指定列的名称<BR>myReader.GetOrdinal(序号)&nbsp;&nbsp; 在给定列名称的情况下获取列序号</P>
<P><BR><STRONG>6.得到数据表的信息。</STRONG></P>
<P>myReader.GetSchemaTable()&nbsp;&nbsp; 返回一个 DataTable<BR>&nbsp;</P>
<P><STRONG>7．操作多个结果集。</STRONG><BR>myReader.NextResult()&nbsp;&nbsp;&nbsp;&nbsp; 使数据读取器前进到下一个结果集<BR>do<BR>{<BR>&nbsp; while (myReader.Read())<BR>&nbsp; Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0), myReader.GetString(1));<BR>}<BR>while(myReader.NextResult());</P>
<P><BR><STRONG><FONT color=#0000ff>五．DataAdapter</FONT></STRONG></P>
<P><BR>1.创建SqlDataAdapter<BR>初始化 SqlDataAdapter 类的新实例。<BR>public SqlDataAdapter();<BR>将指定的 SqlCommand 作为SelectCommand 属性，初始化 SqlDataAdapter 类的新实例。<BR>public SqlDataAdapter(SqlCommand);<BR>用 selectcommand字符串 和 SqlConnection对象初始化SqlDataAdapter 类的新实例。<BR>public SqlDataAdapter(string, SqlConnection);<BR>用 selectcommand字符串 和 一个连接字符串 初始化SqlDataAdapter 类的新实例。<BR>public SqlDataAdapter(string, string);</P>
<P><BR>2．DataAdapter和SqlConnection，SqlCommand建立关联。<BR>&nbsp; 1．DataAdapter在构造参数时建立<BR>&nbsp; 2．SqlDataAdapter adapter = new SqlDataAdapter();<BR>&nbsp;&nbsp;&nbsp;&nbsp; adapter.SelectCommand = new SqlCommand(query, conn);</P>
<P><BR>3．DataAdapter.Fill（）方法。</P>
<P>在 DataSet 中添加或刷新行以匹配使用 DataSet 名称的数据源中的行，并创建一个名为“Table”的 DataTable。<BR>public override int Fill(DataSet);<BR>在 DataSet 中添加或刷新行以匹配使用 DataSet 和 DataTable 名称的数据源中的行。<BR>&nbsp;public int Fill(DataSet, string);</P>
<P><BR>在 DataSet 的指定范围中添加或刷新行以匹配使用 DataSet 和 DataTable 名称的数据源中的行。</P>
<P>&nbsp;public int Fill(DataSet, int, int, string);</P>
<P><BR>在 DataTable 中添加或刷新行以匹配使用 DataTable 名称的数据源中的行。<BR>&nbsp;public int Fill(DataTable);</P>
<P><BR>在 DataTable 中添加或刷新行以匹配使用指定 DataTable 和 IDataReader 名称的数据源中的行。<BR>&nbsp;protected virtual int Fill(DataTable, IDataReader);</P>
<P>在 DataTable 中添加或刷新行以匹配使用 DataTable 名称、指定的 SQL SELECT 语句和 CommandBehavior 的数据源中的行。<BR>&nbsp;protected virtual int Fill(DataTable, IDbCommand, CommandBehavior);<BR>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>六．DataTable 类</FONT></STRONG></P>
<P><STRONG><FONT color=#0000ff>七．DataColumn 类</FONT></STRONG></P>
<P><STRONG><FONT color=#0000ff>八．DataRow 类<BR></FONT></STRONG>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>九．DataSet 类</FONT></STRONG><BR>1．创建DataSet 对象</P>
<P>初始化 DataSet 类的新实例。<BR>public DataSet();<BR>&nbsp;<BR>用给定名称初始化 DataSet 类的新实例。<BR>public DataSet(string);<BR>&nbsp;</P>
<P>2．用DataAdapter填充DataSet</P>
<P>&nbsp;&nbsp; DataSet myds=new DataSet();<BR>adapter.fill(myds)<BR>adapter.fill(myds,”表名”);&nbsp; 用一个表去填充DataSet.</P>
<P>&nbsp;</P>
<P><STRONG><FONT color=#0000ff>十. DataTableCollection 类</FONT></STRONG>。&nbsp;&nbsp;&nbsp; 表示 DataSet 的表的集合。</P>
<P>DataTableCollection dtc = ds.Tables;<BR>DataTable table = dtc[“表名”];<BR>String strExpr = "id &gt; 5";<BR>String strSort = "name DESC";<BR>DataRow[] foundRows = customerTable.Select( strExpr, strSort,);</P>
<P>进行动态的筛选和排序。<BR>DataTable.Select() 方法 ：&nbsp; 获取 DataRow 对象的数组，</P>
<P>①获取所有 DataRow 对象的数组。<BR>public DataRow[] Select();</P>
<P>&nbsp;</P>
<P>②按主键顺序(如没有主键,则按照添加顺序)，获取与筛选条件相匹配的所有 DataRow 对象的数组。<BR>public DataRow[] Select(string);</P>
<P><BR>③获取按照指定的排序顺序且与筛选条件相匹配的所有 DataRow 对象的数组。</P>
<P>public DataRow[] Select(string, string);</P>
<P><BR>④获取与排序顺序中的筛选器以及指定的状态相匹配的所有 DataRow 对象的数组。</P>
<P>public DataRow[] Select(string, string, DataViewRowState);</P>
<P></P>
<P><STRONG><FONT color=#0000ff>十一。DataView 类</FONT></STRONG> ： 是DataTable内容的动态视图。</P>
<P><STRONG>1．&nbsp; 创建对象</STRONG></P>
<P>初始化 DataView 类的新实例。</P>
<P>&nbsp; public DataView();</P>
<P>用指定的 DataTable 初始化 DataView 类的新实例。</P>
<P>&nbsp; public DataView(DataTable);</P>
<P>用指定的 DataTable、RowFilter、Sort 和 DataViewRowState 初始化 DataView 类的新实例。</P>
<P>&nbsp; public DataView(DataTable, string, string, DataViewRowState);</P>
<P><BR>DataView myview = new DataView(ds.Tables["Suppliers"], "id &gt; 5", "name DESC"，<BR>DataViewRowState.CurrentRows);</P>
<P><BR>2<STRONG> .得到DataView的行数据。</STRONG></P>
<P>&nbsp;&nbsp; foreach (DataRowView myrowview in myview)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; myview.Table.Columns.Count; i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Write(myrowview [i] + "\t");<BR>&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine();<BR>&nbsp;&nbsp; }</P></DIV>…… [<a href="http://www.13com.net/article/article.asp?articleid=1134">点击查看详细</a>] ]]></description>
	<pubDate>Sun, 20 Mar 2011 03:16:05 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1134</comments>
	</item>

	<item>
	<title><![CDATA[强烈推荐：240多个jQuery插件]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1133</link>
	<description><![CDATA[<h2>概述</h2>
<p>jQuery 是继 prototype 之后又一个优秀的 Javascript 框架。其宗旨是&mdash;写更少的代码,做更多的事情。它是轻量级的 js 库(压缩后只有21k) ，这是其它的 js 库所不<a href="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/jquery_2.gif"><img width="164" height="117" border="0" align="right" src="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/jquery_thumb.gif" alt="jquery" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" /></a>及 的，它兼容 CSS3，还兼容各种浏览器（IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+）。 jQuery  是一个快速的，简洁的 javaScript 库，使用户能更方便地处理 HTML  documents、events、实现动画效果，并且方便地为网站提供 AJAX 交互。 jQuery  还有一个比较大的优势是，它的文档说明很全，而且各种应用也说得很详细，同时还有许多成熟的插件可供选择。 jQuery 能够使用户的 html  页保持代码和 html 内容分离，也就是说，不用再在 html 里面插入一堆js来调用命令了，只需定义 id 即可。今天在<a href="http://www.kollermedia.at/" title="Logo Kollermedia.at">Kollermedia.at</a>上发现了一篇JQuery插件列表的文章，特推荐如下。</p>
<h2>文件上传(File upload)<a href="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_001_6.gif"><img width="396" height="165" border="0" align="right" src="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_001_thumb_2.gif" alt="JQuery_001" style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" /></a></h2>
<p><a href="http://www.phpletter.com/Demo/AjaxFileUpload-Demo/">Ajax File Upload</a>.<br />
<a href="http://www.pixeline.be/experiments/jqUploader/">jQUploader</a>.<br />
<a href="http://www.fyneworks.com/jquery/multiple-file-upload/">Multiple File Upload plugin</a>.&nbsp; <br />
<a href="http://www.appelsiini.net/projects/filestyle">jQuery File Style</a>.<br />
<a href="http://jquery.com/plugins/project/InputFileCSS">Styling an input type file</a>.<br />
<a href="http://digitalbush.com/projects/progress-bar-plugin">Progress Bar Plugin</a>.</p>
<h2>表单验证(Form Validation)</h2>
<p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation</a>.<br />
<a href="http://www.dyve.net/jquery/?autohelp">Auto Help</a>.<br />
<a href="http://www.willjessup.com/sandbox/jquery/form_validator/form_validate.html">Simple jQuery form validation</a>.<br />
<a href="http://letmehaveblog.blogspot.com/2007/08/easy-client-side-web-forms-validations.html">jQuery XAV - form validations</a>.<br />
<a href="http://itgroup.com.ph/alphanumeric/">jQuery AlphaNumeric</a>.<br />
<a href="http://digitalbush.com/projects/masked-input-plugin">Masked Input</a>.<br />
<a href="http://www.dennydotnet.com/post/TypeWatch-jQuery-Plugin.aspx">TypeWatch Plugin</a>.<br />
<a href="http://jquery.com/plugins/project/TextLimiter">Text limiter for form fields</a>.<br />
<a href="http://www.shawngo.com/gafyd/index.html">Ajax Username Check with jQuery</a>.</p>
<h2>表单－选取框(Form - Select Box stuff)</h2>
<p><a href="http://jquery.sanchezsalvador.com/page/jquerycombobox.aspx">jQuery Combobox</a>.<br />
<a href="http://www.ajaxray.com/blog/2007/11/08/jquery-controlled-dependent-or-cascading-select-list-2/">jQuery controlled dependent (or Cascadign) Select List</a>.<br />
<a href="http://code.google.com/p/jqmultiselects/">Multiple Selects</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/select/">Select box manipulation</a>.<br />
<a href="http://code.google.com/p/jqueryselectcombo/">Select Combo Plugin</a>.<br />
<a href="http://www.msxhost.com/jquery/linked-selects/json/%20target=">jQuery - LinkedSelect</a><br />
<a href="http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/">Auto-populate multiple select boxes</a>.<br />
<a href="http://www.sitespotting.it/esempi/002/">Choose Plugin (Select Replacement)</a>.</p>
<h2>表单基本、输入框、选择框等(Form Basics, Input Fields, Checkboxes etc.)</h2>
<p><a href="http://www.malsup.com/jquery/form/">jQuery Form Plugin</a>.<br />
<a href="http://code.handlino.com/wiki/jquery-form">jQuery-Form</a>.<br />
<a href="http://envero.org/jlook/">jLook Nice Forms</a>.<br />
<a href="http://www.whitespace-creative.com/jquery/jNice/">jNice</a>.<br />
<a href="http://www.brainfault.com/2007/07/07/pin-plugin-reloaded/">Ping Plugin</a>.<br />
<a href="http://grzegorz.frydrychowicz.net/jquery_toggleformtext/">Toggle Form Text</a>.<br />
<a href="http://thoughts.kuzemchak.net/entry/toggleval-for-jquery/">ToggleVal</a>.<br />
<a href="http://www.pengoworks.com/workshop/jquery/field.plugin.htm">jQuery Field Plugin</a>.<br />
<a href="http://code.befruit.com/">jQuery Form&rsquo;n Field plugin</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/checkboxes/">jQuery Checkbox manipulation</a>.<br />
<a href="http://www.alcoholwang.cn/jquery/jTaggingDemo.htm">jTagging</a>.<br />
<a href="http://code.google.com/p/labelcheck/">jQuery labelcheck</a>.<br />
<a href="http://scott.sauyet.com/thoughts/archives/2007/03/31/overlabel-with-jquery/">Overlabel</a>.<br />
<a href="http://blog.amicoimmaginario.it/2007/08/28/jquery-plugin-3-state-radio-buttons/">3 state radio buttons</a>.<br />
<a href="http://sanisoft-demo.com/jquery/plugins/shiftcheckbox/">ShiftCheckbox jQuery Plugin</a>.<br />
<a href="http://digitalbush.com/projects/watermark-input-plugin">Watermark Input</a>.<br />
<a href="http://kawika.org/jquery/checkbox/">jQuery Checkbox (checkboxes with imags)</a>.<br />
<a href="http://www.softwareunity.com/sandbox/jqueryspinbtn/">jQuery SpinButton Control</a>.<br />
<a href="http://www.phpletter.com/form_builder/demo.html">jQuery Ajax Form Builder</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/focusfields/">jQuery Focus Fields</a>.<br />
<a href="http://home.iprimus.com.au/kbwood/jquery/timeEntry.html">jQuery Time Entry</a>.</p>
<h2>时间、日期和颜色选取(Time, Date and Color Picker)</h2>
<p><a href="http://marcgrabanski.com/code/ui-datepicker/">jQuery UI Datepicker</a>.<br />
<a href="http://kelvinluck.com/assets/jquery/datePicker/">jQuery date picker plugin</a>.<br />
<a href="http://code.google.com/p/jquery-timepicker/">jQuery Time Picker</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/timepicker/">Time Picker</a>.<br />
<a href="http://www.oakcitygraphics.com/jquery/clockpick/ClockPick.cfm">ClickPick</a>.<br />
<a href="http://labs.perifer.se/timedatepicker/">TimePicker</a>.<br />
<a href="http://acko.net/dev/farbtastic">Farbtastic jQuery Color Picker Plugin</a>.<br />
<a href="http://www.intelliance.fr/jquery/color_picker/">Color Picker by intelliance.fr</a>.</p>
<h2>投票插件(Rating Plugins)</h2>
<p><a href="http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/#">jQuery Star Rating Plugin</a>.<br />
<a href="http://www.m3nt0r.de/devel/raterDemo/">jQuery Star Rater</a>.<br />
<a href="http://riderdesign.com/articles/displayarticle.aspx?articleid=21">Content rater with asp.net, ajax and jQuery</a>.<br />
<a href="http://www.learningjquery.com/2007/05/half-star-rating-plugin">Half-Star Rating Plugin</a>.</p>
<h2>搜索插件(Search Plugins)</h2>
<p><a href="http://www.vulgarisoip.com/2007/08/06/jquerysuggest-11/">jQuery Suggest</a>.<br />
<a href="http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/">jQuery Autocomplete</a>.<br />
<a href="http://www.pengoworks.com/workshop/jquery/autocomplete.htm">jQuery Autocomplete Mod</a>.<br />
<a href="http://www.ajaxdaddy.com/demo-jquery-autocomplete.html">jQuery Autocomplete by AjaxDaddy</a>.<br />
<a href="http://dev.reach1to1.net/saurabh/jplugins/autocomplete/">jQuery Autocomplete Plugin with HTML formatting</a>.<br />
<a href="http://interface.eyecon.ro/docs/autocomplete">jQuery Autocompleter</a>.<br />
<a href="http://nodstrum.com/2007/09/19/autocompleter/">AutoCompleter (Tutorial with PHP&amp;MySQL)</a>.<br />
<a href="http://rikrikrik.com/jquery/quicksearch/">quick Search jQuery Plugin</a>.</p>
<h2>编辑器(Inline Edit &amp; Editors)<a href="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_002_2.gif"><img width="400" height="193" border="0" align="right" src="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_002_thumb.gif" alt="JQuery_002" style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" /></a></h2>
<p><a href="http://www.jaysalvat.com/jquery/jtageditor/">jTagEditor</a>.<br />
<a href="http://demo.wymeditor.org/demo.html">WYMeditor</a>.<br />
<a href="http://garage.pimentech.net/scripts_doc_jquery_jframe/">jQuery jFrame</a>.<br />
<a href="http://www.appelsiini.net/projects/jeditable">Jeditable - edit in place plugin for jQuery</a>. <br />
<a href="http://www.dyve.net/jquery/?editable">jQuery editable</a>.<br />
<a href="http://www.jdempster.com/category/jquery/disableTextSelect/">jQuery Disable Text Select Plugin</a>.<br />
<a href="http://15daysofjquery.com/edit-in-place-with-ajax-using-jquery-javascript-library/15/">Edit in Place with Ajax using jQuery</a>.<br />
<a href="http://davehauenstein.com/blog/archives/28">jQuery Plugin - Another In-Place Editor</a>.<br />
<a href="http://dev.iceburg.net/jquery/tableEditor/demo.php">TableEditor</a>.<br />
<a href="http://joshhundley.com/teditable-in-place-editing-for-tables/">tEditable - in place table editing for jQuery</a>.</p>
<h2>多媒体、视频、Flash等(Audio, Video, Flash, SVG, etc)</h2>
<p><a href="http://www.contentwithstructure.com/extras/jmedia">jMedia - accessible multi-media embedding</a>.<br />
<a href="http://sourceforge.net/projects/jbedit/">JBEdit - Ajax online Video Editor</a>.<br />
<a href="http://www.sean-o.com/jquery/jmp3/">jQuery MP3 Plugin</a>.<br />
<a href="http://malsup.com/jquery/media/">jQuery Media Plugin</a>.<br />
<a href="http://jquery.lukelutman.com/plugins/flash/index.html">jQuery Flash Plugin</a>.<br />
<a href="http://www.solitude.dk/archives/embedquicktime/">Embed QuickTime</a>.<br />
<a href="http://keith-wood.name/svg.html">SVG Integration</a>.</p>
<h2>图片(Photos/Images/Galleries)</h2>
<p><a href="http://jquery.com/demo/thickbox/">ThickBox</a>.<br />
<a href="http://leandrovieira.com/projects/jquery/lightbox/">jQuery lightBox plugin</a>.<br />
<a href="http://blog.joshuaeichorn.com/archives/2007/01/11/jquery-image-strip/">jQuery Image Strip</a>.<br />
<a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html">jQuery slideViewer</a>.<br />
<a href="http://benjaminsterling.com/2007/09/09/jquery-jqgalscroll-photo-gallery/">jQuery jqGalScroll 2.0</a>.<br />
<a href="http://benjaminsterling.com/2007/10/02/jquery-jqgalviewii-photo-gallery/">jQuery - jqGalViewII</a>.<br />
<a href="http://benjaminsterling.com/2007/10/21/jqgalviewiii-proof-of-concept/">jQuery - jqGalViewIII</a>.<br />
<a href="http://opiefoto.com/articles/photoslider">jQuery Photo Slider</a>.<br />
<a href="http://joanpiedra.com/jquery/thumbs/">jQuery Thumbs - easily create thumbnails</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/jQIR/">jQuery jQIR Image Replacement</a>.<br />
<a href="http://www.gmarwaha.com/jquery/jcarousellite/index.php#what">jCarousel Lite</a>.<br />
<a href="http://projects.sevir.org/storage/jpanview/index.html">jQPanView</a>.<br />
<a href="http://sorgalla.com/projects/jcarousel/#Examples">jCarousel</a>.<br />
<a href="http://www.intelliance.fr/jquery/imagebox/">Interface Imagebox</a>.<br />
<a href="http://www.getintothis.com/blog/2006/10/12/image-gallery-using-jquery-interface-reflections/">Image Gallery using jQuery, Interface &amp; Reflactions</a>.<br />
<a href="http://realazy.org/lab/jquery/j-gallery/">simple jQuery Gallery</a>.<br />
<a href="http://chicagosocial.com/gallery/">jQuery Gallery Module</a>.<br />
<a href="http://www.eogallery.com/">EO Gallery</a>.<br />
<a href="http://flesler.blogspot.com/search/label/jQuery.ScrollShow">jQuery ScrollShow</a>.<br />
<a href="http://www.malsup.com/jquery/cycle/">jQuery Cycle Plugin</a>.<br />
<a href="http://www.projectatomic.com/en/flickr.htm">jQuery Flickr</a>.<br />
<a href="http://www.appelsiini.net/2007/9/lazy-load-images-jquery-plugin">jQuery Lazy Load Images Plugin</a>.<br />
<a href="http://www.sunsean.com/zoomi/">Zoomi - Zoomable Thumbnails</a>.<br />
<a href="http://remysharp.com/2007/03/19/a-few-more-jquery-plugins-crop-labelover-and-pluck/#crop">jQuery Crop - crop any image on the fly</a>.<br />
<a href="http://jquery.com/plugins/project/reflection">Image Reflection</a>.</p>
<h2>Google地图（Google Map）</h2>
<p><a href="http://www.dyve.net/jquery/?googlemaps">jQuery Plugin googlemaps</a>.<br />
<a href="http://code.google.com/p/jmaps/">jMaps jQuery Maps Framework</a>.<br />
<a href="http://projects.sevir.org/storage/jqmaps/index.html">jQmaps</a>.<br />
<a href="http://olbertz.de/jquery/googlemap.html#">jQuery &amp; Google Maps</a>.<br />
<a href="http://snippets.dzone.com/posts/show/4361">jQuery Maps Interface forr Google and Yahoo maps</a>.<br />
<a href="http://webrocket.ulmb.com/jmaps/">jQuery J Maps - by Tane Piper</a>.</p>
<h2>游戏(Games)</h2>
<p><a href="http://fmarcia.info/jquery/tetris/tetris.html">Tetris with jQuery</a>.<br />
<a href="http://64squar.es/">jQuery Chess</a>.<br />
<a href="http://www.bennadel.com/blog/623-jQuery-Demo-Mad-Libs-Word-Game.htm">Mad Libs Word Game</a>.<br />
<a href="http://www.alexatnet.com/node/68">jQuery Puzzle</a>.<br />
<a href="http://www.willjessup.com/sandbox/jquery/solar_system/rotator.html">jQuery Solar System (not a game but awesome jQuery Stuff)</a>.</p>
<h2>表格等(Tables, Grids etc.)</h2>
<p><a href="http://docs.jquery.com/Plugins/Tablesorter">UI/Tablesorter</a>.<a href="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_003_2.gif"><img width="400" height="143" border="0" align="right" src="http://images.cnblogs.com/cnblogs_com/Terrylee/WindowsLiveWriter/240jQuery_128F5/JQuery_003_thumb.gif" alt="JQuery_003" style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" /></a> <br />
<a href="http://www.reconstrukt.com/ingrid/">jQuery ingrid</a>.<br />
<a href="http://www.trirand.com/blog/?p=13">jQuery Grid Plugin</a>.<br />
<a href="http://ideamill.synaptrixgroup.com/jquery/tablefilter/tabletest.htm">Table Filter - awesome!</a>.<br />
<a href="http://dev.iceburg.net/jquery/tableEditor/demo.php">TableEditor</a>.<br />
<a href="http://www.hanpau.com/jquery/unobtrusivetreetable.php">jQuery Tree Tables</a>.<br />
<a href="http://www.javascripttoolbox.com/jquery/#expandablerows">Expandable &ldquo;Detail&rdquo; Table Rows</a>.<br />
<a href="http://www.remotesynthesis.com/blog/index.cfm/2007/9/25/Sortable-Table-ColdFusion-Custom-Tag-with-jQueryUI">Sortable Table ColdFusion Costum Tag with jQuery UI</a>.<br />
<a href="http://flesler.blogspot.com/2007/10/jquerybubble.html">jQuery Bubble</a>.<br />
<a href="http://tablesorter.com/docs/">TableSorter</a>.<br />
<a href="http://www.webtoolkit.info/demo/jquery/scrollable/demo.html">Scrollable HTML Table</a>.<br />
<a href="http://p.sohei.org/stuff/jquery/columnmanager/demo/demo.html">jQuery column Manager Plugin</a>.<br />
<a href="http://p.sohei.org/stuff/jquery/tablehover/demo/demo.html">jQuery tableHover Plugin</a>.<br />
<a href="http://p.sohei.org/stuff/jquery/columnhover/demo/demo.html">jQuery columnHover Plugin</a>.<br />
<a href="http://makoomba.altervista.org/grid/">jQuery Grid</a>.<br />
<a href="http://motherrussia.polyester.se/jquery-plugins/tablesorter/">TableSorter plugin for jQuery</a>.<br />
<a href="http://joshhundley.com/teditable-in-place-editing-for-tables/">tEditable - in place table editing for jQuery</a>.<br />
<a href="http://www.hovinne.com/dev/jquery/chartotable/">jQuery charToTable Plugin</a>.<br />
<a href="http://www.ita.es/jquery/jquery.grid.columnSizing.htm">jQuery Grid Column Sizing</a>.<br />
<a href="http://www.ita.es/jquery/jquery.grid.rowSizing.htm">jQuery Grid Row Sizing</a>.</p>
<h2>统计图(Charts, Presentation etc.)</h2>
<p><a href="http://worcesterwideweb.com/2007/06/04/jquery-wizard-plugin/">jQuery Wizard Plugin </a>.<br />
<a href="http://www.reach1to1.com/sandbox/jquery/jqchart/">jQuery Chart Plugin</a>.<br />
<a href="http://ejohn.org/apps/speed/">Bar Chart</a>.</p>
<h2>边框、圆角、背景(Border, Corners, Background)</h2>
<p><a href="http://www.malsup.com/jquery/corner/">jQuery Corner</a>.<br />
<a href="http://blue-anvil.com/archives/anti-aliased-rounded-corners-with-jquery">jQuery Curvy Corner</a>.<br />
<a href="http://dev.jquery.com/%7Epaul/plugins/nifty/example.html">Nifty jQuery Corner</a>.<br />
<a href="http://illandril.net/jQuery/transparentCorners/">Transparent Corners</a>.<br />
<a href="http://www.methvin.com/jquery/jq-corner.html">jQuery Corner Gallery</a>.<br />
<a href="http://blog.brandonaaron.net/my-jquery-plugins/gradient/">Gradient Plugin</a>.</p>
<h2>文字和超链接(Text and Links)</h2>
<p><a href="http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html">jQuery Spoiler plugin</a>.<br />
<a href="http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html">Text Highlighting</a>.<br />
<a href="http://www.jdempster.com/category/jquery/disableTextSelect/">Disable Text Select Plugin</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/newsticker/">jQuery Newsticker</a>.<br />
<a href="http://www.ollicle.com/2007/jun/03/jquery_lineheight_flexible.html">Auto line-height Plugin</a>.<br />
<a href="http://agencenp.net/textgrad/textgrad.html">Textgrad - a text gradient plugin</a>.<br />
<a href="http://kawika.org/jquery/linklook/">LinkLook - a link thumbnail preview</a>.<br />
<a href="http://rikrikrik.com/jquery/pager/#examples">pager jQuery Plugin</a>.<br />
<a href="http://rikrikrik.com/jquery/shortkeys/">shortKeys jQuery Plugin</a>.<br />
<a href="http://www.ollicle.com/eg/jquery/biggerlink">jQuery Biggerlink</a>.<br />
<a href="http://troy.dyle.net/linkchecker/">jQuery Ajax Link Checker</a>.</p>
<h2>鼠标提示（Tooltips）</h2>
<p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Plugin - Tooltip</a>.<br />
<a href="http://www.codylindley.com/blogstuff/js/jtip/">jTip - The jQuery Tool Tip</a>.<br />
<a href="http://examples.learningjquery.com/62/demo/index.html#examplesection">clueTip</a>.<br />
<a href="http://edgarverle.com/BetterTip/default.cfm">BetterTip</a>.<br />
<a href="http://ioreader.com/2007/05/15/flash-tooltips-using-jquery/">Flash Tooltips using jQuery</a>.<br />
<a href="http://www.texotela.co.uk/code/jquery/tooltipdemo/">ToolTip</a>.</p>
<h2>菜单和导航(Menus, Navigations)</h2>
<p><a href="http://stilbuero.de/jquery/tabs_3/">jQuery Tabs Plugin - awesome! </a>. [<a href="http://stilbuero.de/jquery/tabs_3/nested.html">demo nested tabs</a>.]<br />
<a href="http://blog.cutterscrossing.com/index.cfm/2007/6/15/Updated-JQuery-Nested-Tab-Set-with-Demo">another jQuery nested Tab Set example (based on jQuery Tabs Plugin)</a>.<br />
<a href="http://www.sunsean.com/idTabs/">jQuery idTabs</a>.<br />
<a href="http://jdsharp.us/jQuery/plugins/jdMenu/">jdMenu - Hierarchical Menu Plugin for jQuery</a>.<br />
<a href="http://be.twixt.us/jquery/suckerFish.php">jQuery SuckerFish Style</a>.<br />
<a href="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/">jQuery Plugin Treeview</a>.<br />
<a href="http://be.twixt.us/jquery/treeView.php">treeView Basic</a>.<br />
<a href="http://labs.activespotlight.net/jQuery/menu_demo.html">FastFind Menu</a>.<br />
<a href="http://www.getintothis.com/blog/2006/09/26/my-first-jquery-plugin-a-sliding-menu/">Sliding Menu</a>.<br />
<a href="http://gmarwaha.com/blog/?p=7">Lava Lamp jQuery Menu</a>.<br />
<a href="http://icon.cat/wiki/IconDock_En#iconDock_jQuery_Plugin">jQuery iconDock</a>.<br />
<a href="http://cherne.net/brian/resources/jquery.variations.html">jVariations Control Panel</a>.<br />
<a href="http://www.trendskitchens.co.nz/jquery/contextmenu/">ContextMenu plugin</a>.<br />
<a href="http://p.sohei.org/jquery-plugins/clickmenu/">clickMenu</a>.<br />
<a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu">CSS Dock Menu</a>.<br />
<a href="http://webexpose.org/2006/12/28/jquery-pop-up-menu-tutorial/">jQuery Pop-up Menu Tutorial</a>.<br />
<a href="http://www.getintothis.com/blog/2006/09/26/my-first-jquery-plugin-a-sliding-menu/">Sliding Menu</a>.</p>
<p><a href="http://stilbuero.de/jquery/tabs_3/" title="http://stilbuero.de/jquery/tabs_3/">http://stilbuero.de/jquery/tabs_3/</a></p>
<h2>幻灯、翻转等(Accordions, Slide and Toggle stuff)</h2>
<p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-accordion/">jQuery Plugin Accordion</a>.<br />
<a href="http://fmarcia.info/jquery/accordion.html">jQuery Accordion Plugin Horizontal Way</a>.<br />
<a href="http://letmehaveblog.blogspot.com/2007/10/haccordion-simple-horizontal-accordion.html">haccordion - a simple horizontal accordion plugin for jQuery</a>.<br />
<a href="http://dev.portalzine.de/index?/Horizontal_Accordion--print">Horizontal Accordion by portalzine.de</a>.<br />
<a href="http://berndmatzner.de/jquery/hoveraccordion/">HoverAccordion</a>.<br />
<a href="http://fmarcia.info/jquery/accordion.html">Accordion Example from fmarcia.info</a>.<br />
<a href="http://blog.evaria.com/wp-content/themes/blogvaria/jquery/index.php">jQuery Accordion Example</a>.<br />
<a href="http://jquery.com/files/demo/dl-done.html">jQuery Demo - Expandable Sidebar Menu</a>.<br />
<a href="http://www.andreacfm.com/examples/jQpanels/">Sliding Panels for jQuery</a>.<br />
<a href="http://jquery.andreaseberhard.de/toggleElements/">jQuery ToggleElements</a>.<br />
<a href="http://www.ndoherty.com/demos/coda-slider/">Coda Slider</a>.<br />
<a href="http://sorgalla.com/projects/jcarousel/#Examples">jCarousel</a>.<br />
<a href="http://www.reindel.com/accessible_news_slider/">Accesible News Slider Plugin</a>.<br />
<a href="http://icant.co.uk/sandbox/jquerycodeview/">Showing and Hiding code Examples</a>.<br />
<a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery Easing Plugin</a>.<br />
<a href="http://sonspring.com/journal/jquery-portlets">jQuery Portlets</a>.<br />
<a href="http://jdsharp.us/jQuery/plugins/AutoScroll/">AutoScroll</a>.<br />
<a href="http://medienfreunde.com/lab/innerfade/">Innerfade</a>.</p>
<h2>拖放插件(Drag and Drop)</h2>
<p><a href="http://docs.jquery.com/UI/Draggables">UI/Draggables</a>.<br />
<a href="http://fromvega.com/wordpress/2007/07/14/easydrag-jquery-plugin/">EasyDrag jQuery Plugin</a>.<br />
<a href="http://sonspring.com/journal/jquery-portlets">jQuery Portlets</a>.<br />
<a href="http://dev.iceburg.net/jquery/jqDnR/">jqDnR - drag, drop resize</a>.<br />
<a href="http://interface.eyecon.ro/demos/drag.html">Drag Demos</a>.</p>
<h2>XML XSL JSON Feeds</h2>
<p><a href="http://www.jongma.org/webtools/jquery/xslt/">XSLT Plugin</a>.<br />
<a href="http://cgaskell.wordpress.com/2006/11/02/jquery-ajax-call-and-result-xml-parsing/">jQuery Ajax call and result XML parsing</a>.<br />
<a href="http://jquery.com/plugins/project/xmlObjectifier">xmlObjectifier - Converts XML DOM to JSON</a>.<br />
<a href="http://jquery.glyphix.com/">jQuery XSL Transform</a>.<br />
<a href="http://malsup.com/jquery/taconite/">jQuery Taconite - multiple Dom updates</a>.<br />
<a href="http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin">RSS/ATOM Feed Parser Plugin</a>.<br />
<a href="http://www.malsup.com/jquery/gfeed/">jQuery Google Feed Plugin</a>.</p>
<h2>浏览器(Browserstuff)</h2>
<p><a href="http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/">Wresize - IE Resize event Fix Plugin</a>.<br />
<a href="http://jquery.khurshid.com/ifixpng.php">jQuery ifixpng</a>.<br />
<a href="http://jquery.andreaseberhard.de/pngFix/">jQuery pngFix</a>.<br />
<a href="http://www.crismancich.de/jquery/plugins/linkscrubber/">Link Scrubber - removes the dotted line onfocus from links</a>.<br />
<a href="http://www.matthewjrichards.co.uk/articles/2007/06/25/jquery-perciformes-the-entire-suckerfish-familly-under-one-roof">jQuery Perciformes - the entire suckerfish familly under one roof</a>.<br />
<a href="http://blog.brandonaaron.net/my-jquery-plugins/background-iframe/">Background Iframe</a>.<br />
<a href="http://jquery.com/plugins/project/QinIE">QinIE - for proper display of Q tags in IE</a>.<br />
<a href="http://webrocket.ulmb.com/ability/">jQuery Accessibility Plugin</a>.<br />
<a href="http://www.ogonek.net/mousewheel/jquery-demo.html">jQuery MouseWheel Plugin</a>.</p>
<h2>对话框、确认窗口(Alert, Prompt, Confirm Windows)</h2>
<p><a href="http://trentrichardson.com/Impromptu/">jQuery Impromptu</a>.<br />
<a href="http://nadiaspot.com/jquery/confirm">jQuery Confirm Plugin</a>.<br />
<a href="http://dev.iceburg.net/jquery/jqModal/">jqModal</a>.<br />
<a href="http://www.ericmmartin.com/projects/simplemodal/">SimpleModal</a>.</p>
<h2>CSS</h2>
<p><a href="http://www.kelvinluck.com/article/switch-stylesheets-with-jquery">jQuery Style Switcher</a>.<br />
<a href="http://andykent.bingodisk.com/bingo/public/jss/">JSS - Javascript StyleSheets</a>.<br />
<a href="http://flesler.blogspot.com/2007/11/jqueryrule.html">jQuery Rule - creation/manipulation of CSS Rules</a>.<br />
<a href="http://www.designerkamal.com/jPrintArea/">jPrintArea</a>.</p>
<h2>DOM、AJAX和其它JQuery插件（DOM, Ajax and other jQuery plugins）</h2>
<p><a href="http://flydom.socianet.com/">FlyDOM</a>.<br />
<a href="http://brandonaaron.net/docs/dimensions/#getting-started">jQuery Dimenion Plugin</a>.<br />
<a href="http://happygiraffe.net/blog/articles/2007/09/26/jquery-logging">jQuery Loggin</a>.<br />
<a href="http://jquery.com/plugins/project/metadata">Metadata - extract metadata from classes, attributes, elements</a>.<br />
<a href="http://johannburkard.de/blog/programming/javascript/inc-a-super-tiny-client-side-include-javascript-jquery-plugin.html">Super-tiny Client-Side Include Javascript jQuery Plugin</a>.<br />
<a href="http://humanized.com/weblog/2007/09/14/undo-made-easy-with-ajax-part-1/">Undo Made Easy with Ajax</a>.<br />
<a href="http://www.jasons-toolbox.com/JHeartbeat/">JHeartbeat - periodically poll the server</a>.<br />
<a href="http://www.appelsiini.net/projects/lazyload">Lazy Load Plugin</a>.<br />
<a href="http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/">Live Query</a>.<br />
<a href="http://jquery.offput.ca/every/">jQuery Timers</a>.<br />
<a href="http://www.joanpiedra.com/jquery/shareit/">jQuery Share it - display social bookmarking icons</a>.<br />
<a href="http://www.jdempster.com/category/code/jquery/cookiejar/">jQuery serverCookieJar</a>.<br />
<a href="http://ideamill.synaptrixgroup.com/?p=3">jQuery autoSave</a>.<br />
<a href="http://www.semicomplete.com/blog/geekery/jquery-interface-puffer.html">jQuery Puffer</a>.<br />
<a href="http://33rockers.com/jquery/iframe-demo/">jQuery iFrame Plugin</a>.<br />
<a href="http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/">Cookie Plugin for jQuery</a>.<br />
<a href="http://leftlogic.com/lounge/articles/jquery_spy2">jQuery Spy - awesome plugin</a>.<br />
<a href="http://www.learningjquery.com/2007/01/effect-delay-trick">Effect Delay Trick</a>.<br />
<a href="http://jquick.sullof.com/jquick/">jQuick - a quick tag creator for jQuery</a>.<a href="http://noteslog.com/post/metaobjects-11-released-today/"><br />
Metaobjects</a>.<br />
<a href="http://www.thunderguy.com/semicolon/2007/08/14/elementready-jquery-plugin/">elementReady</a>.</p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1133">点击查看详细</a>] ]]></description>
	<pubDate>Thu, 6 Jan 2011 13:04:59 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1133</comments>
	</item>

	<item>
	<title><![CDATA[jQuery1.4.2与json格式兼容问题]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1132</link>
	<description><![CDATA[<p>原来使用jQuery1.3.2编写的代码，更换到1.4.2后，使用jQuery.ajax()加载的json文件，不能正常加载。(使用jQuery.getJSON()也一样)</p>
<p>&nbsp;</p>
<p>原json文件内容为：</p>
<p>{<br />
&nbsp;&nbsp;&nbsp; label: 'Europe (EU27)',<br />
&nbsp;&nbsp;&nbsp;  data: [[1999, 3.0], [2000, 3.9],  [2001, 2.0], [2002, 1.2], [2003,  1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1],  [2007, 2.9], [2008, 0.9]]<br />
}</p>
<p>&nbsp;</p>
<p><span style="font-size: small; color: #800080;">解决方法一：</span></p>
<p>改成标准的json格式，要求对字符串都使用&quot;&quot;限定，修改后的内容为：</p>
<p>{<br />
&nbsp;&nbsp;&nbsp; &quot;label&quot;: &quot;Europe (EU27)&quot;,<br />
&nbsp;&nbsp;&nbsp;  &quot;data&quot;: [[1999, 3.0], [2000, 3.9],  [2001, 2.0], [2002, 1.2], [2003,  1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1],  [2007, 2.9], [2008, 0.9]]<br />
}</p>
<p>&nbsp;</p>
<p>这样就可以正常加载了。</p>
<p>&nbsp;</p>
<p><span style="font-size: small; color: #800080;">解决方法二：</span></p>
<p>在jQuery-1.4.2.js中找到&quot;parseJSON: function&quot;，可发现有如下代码：</p>
<div>
<div>
<div>Js代码</div>
</div>
<ol>
    <li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>//&nbsp;Logic&nbsp;borrowed&nbsp;from&nbsp;http://json.org/json2.js  </span>&nbsp;&nbsp;</span></li>
    <li>if&nbsp;(&nbsp;/^[\],:{}\s]*$/.test(data.replace(/\\(?:[&quot;\\\/bfnrt]|u[0-9a-fA-F]{4})/g,&nbsp;&quot;<span>@&quot;)  &nbsp;&nbsp;</span></li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;.replace(/&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,&nbsp;&quot;<span>]&quot;)  &nbsp;&nbsp;</span></li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;.replace(/(?:^|:|,)(?:\s*\[)+/g,&nbsp;&quot;&quot;))&nbsp;)&nbsp;{ &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;<span>//&nbsp;Try&nbsp;to&nbsp;use&nbsp;the&nbsp;native&nbsp;JSON&nbsp;parser&nbsp;first  </span>&nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;return<span>&nbsp;window.JSON&nbsp;&amp;&amp;&nbsp;window.JSON.parse&nbsp;?  &nbsp;&nbsp;</span></li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.JSON.parse(&nbsp;data&nbsp;)&nbsp;: &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Function(&quot;return&nbsp;&quot;&nbsp;+&nbsp;data))(); &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;</li>
    <li>}&nbsp;else&nbsp;{ &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;jQuery.error(&nbsp;&quot;Invalid&nbsp;JSON:&nbsp;&quot;&nbsp;+&nbsp;data&nbsp;); &nbsp;&nbsp;</li>
    <li>}&nbsp;&nbsp;</li>
</ol>
</div>
<p>&nbsp;</p>
<p><span style="font-size: small; color: #800080;" /></p>
<p>在httpData: function中用到了parseJSON函数：</p>
<div>
<div>
<div>Js代码</div>
</div>
<ol>
    <li><span><span>//&nbsp;Get&nbsp;the&nbsp;JavaScript&nbsp;object,&nbsp;if&nbsp;JSON&nbsp;is&nbsp;used.  </span>&nbsp;&nbsp;</span></li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;type&nbsp;===&nbsp;&quot;json&quot;&nbsp;||&nbsp;!type&nbsp;&amp;&amp;&nbsp;ct.indexOf(&quot;json&quot;)&nbsp;&gt;=&nbsp;0&nbsp;)&nbsp;{ &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;=&nbsp;jQuery.parseJSON(&nbsp;data&nbsp;);&nbsp;&nbsp;</li>
</ol>
</div>
<p>&nbsp;</p>
<p>在jQuery1.3.2中，没有parseJSON这个方法，而是直接使用下面的代码。</p>
<div>
<div>
<div>Js代码</div>
</div>
<ol>
    <li><span><span>//&nbsp;Get&nbsp;the&nbsp;JavaScript&nbsp;object,&nbsp;if&nbsp;JSON&nbsp;is&nbsp;used.  </span>&nbsp;&nbsp;</span></li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;type&nbsp;==&nbsp;&quot;json&quot;&nbsp;) &nbsp;&nbsp;</li>
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;=&nbsp;window[&quot;eval&quot;](&quot;(&quot;&nbsp;+&nbsp;data&nbsp;+&nbsp;&quot;)&quot;);&nbsp;&nbsp;</li>
</ol>
</div>
<p>替换成原来1.3.2的代码就可以了。</p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1132">点击查看详细</a>] ]]></description>
	<pubDate>Thu, 6 Jan 2011 12:53:16 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1132</comments>
	</item>

	<item>
	<title><![CDATA[Android 2.2.1 获取 Root 方法]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1131</link>
	<description><![CDATA[<p>1。<a href="http://www.13com.net/article/userfiles/Andorid.rootfiles.rar"><span href="http://bbs.gfan.com/tag.php?name=%E4%B8%8B%E8%BD%BD" class="t_tag">下载</span>rootfiles附件</a>，并解压到D盘的files目录中<br />
2。下载adb。<br />
<br />
3。点开始，运行，输入CMD，回车，出来的控制台窗口里输入：<br />
<font color="Navy"><strong>adb push d:\files\rootnow /data/local/tmp/rootnow<br />
adb shell chmod 700 /data/local/tmp/rootnow</strong></font><br />
<br />
4。这时我们要切到<span href="http://bbs.gfan.com/tag.php?name=%E7%B3%BB%E7%BB%9F" class="t_tag">系统</span>的shell里，继续输入：<br />
<strong><font color="Navy">adb shell<br />
cd /data/local/tmp<br />
./rootnow</font></strong><br />
5。这时候你可以看到一大堆信息出现在你的控制台窗口里了，并且ADB会<span href="http://bbs.gfan.com/tag.php?name=%E8%87%AA%E5%8A%A8" class="t_tag">自动</span>重启。<br />
接下来输入：<br />
<font color="Navy"><strong>adb kill-server<br />
adb start-server</strong></font><br />
再次输入：<br />
<strong><font color="Navy">adb shell</font></strong><br />
6。这时候你可以看到原本命令行最左边的的美元号$变成了#，这时候就代表已经root了，如果没成功就重复4和5。还没完，别急着离开，还有第二部分，你需要安装守护<span href="http://bbs.gfan.com/tag.php?name=%E7%A8%8B%E5%BA%8F" class="t_tag">程序</span>。<br />
输入：<br />
<strong><font color="Navy">exit</font></strong><br />
关闭shell<br />
7。关掉控制台窗口，再次 点开始，运行，输入CMD，回车，出来的控制台窗口里输入（直接从这里复制吧，右键点击控制台的窗口栏就可以/编辑/粘贴了，记得是一行一行地来，每次粘贴后都要回车一下）：<br />
<strong><font color="Navy">adb push d:\files\superuser.<span href="http://bbs.gfan.com/tag.php?name=apk" class="t_tag">apk</span> /data/local/tmp/superuser.apk<br />
adb push d:\files\su /data/local/tmp/su<br />
adb push d:\files\busybox /data/local/tmp/busybox<br />
adb shell<br />
cd /data/local/tmp/<br />
chmod 755 busybox<br />
./busybox mount -o remount,rw /dev/block/mtdblock3 /system<br />
./busybox cp busybox /system/bin<br />
chmod 4755 /system/bin/busybox<br />
busybox cp superuser.apk /system/app<br />
busybox cp su /system/bin<br />
chmod 4755 /system/bin/su</font></strong><br />
<br />
好了，现在已经root成功了。</p>
<p>&nbsp;</p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1131">点击查看详细</a>] ]]></description>
	<pubDate>Fri, 19 Nov 2010 15:22:43 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1131</comments>
	</item>

	<item>
	<title><![CDATA[OWC绘图控件研究 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1130</link>
	<description><![CDATA[<DIV class=postText>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 17.95pt"><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">，即</SPAN><SPAN lang=EN-US>Office Web Components</SPAN><SPAN style="FONT-FAMILY: 宋体">，是微软随</SPAN><SPAN lang=EN-US>Office</SPAN><SPAN style="FONT-FAMILY: 宋体">提供的绘图控件，使用它能够绘制绝大部分的图形，但不幸的是</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">的帮助文件并不好用，网上关于</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">的文章也都很简单，稍微深入一点的问题就很难搜到。所以，把自己研究</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">的一些心得写在这里，希望能帮助有需要的朋友，使他们不必再去翻看长长的对象（属性、方法）列表。除此之外，也有一些功能还未实现，希望与大家一起探讨。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 17.95pt"><SPAN style="FONT-SIZE: 10pt">注：本文只谈论OWC使用中的技术问题，不涉及OWC引用，授权，版本等方面。文中给出的示例代码基于OWC11 ＋ VS.NET ＋ C＃。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN><SPAN lang=EN-US>OWC</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">有帮助吗？它在哪儿？</SPAN><SPAN lang=EN-US><?XML:NAMESPACE PREFIX = O /><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">有的。安装</SPAN><SPAN lang=EN-US>Office</SPAN><SPAN style="FONT-FAMILY: 宋体">之后，在</SPAN><SPAN lang=EN-US>C:\Program Files\Common Files\Microsoft Shared\Web Components\11\2052</SPAN><SPAN style="FONT-FAMILY: 宋体">目录下面，有几个</SPAN><SPAN lang=EN-US>*.chm</SPAN><SPAN style="FONT-FAMILY: 宋体">文件，便是，如果你没有这几个文件，尝试把</SPAN><SPAN lang=EN-US>Office</SPAN><SPAN style="FONT-FAMILY: 宋体">完全安装一下试试，或者自定义安装的时候选中相应的选项。但它们是针对如何在</SPAN><SPAN lang=EN-US>Excel</SPAN><SPAN style="FONT-FAMILY: 宋体">中使用，而不是在</SPAN><SPAN lang=EN-US>.Net</SPAN><SPAN style="FONT-FAMILY: 宋体">或</SPAN><SPAN lang=EN-US>Java</SPAN><SPAN style="FONT-FAMILY: 宋体">或</SPAN><SPAN lang=EN-US>Dephi</SPAN><SPAN style="FONT-FAMILY: 宋体">中如何使用的，它只是按字母顺序列出了</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">组件所有的对象、集合、方法、属性、枚举，以及少量的示例代码，查找很不方便。我主要参看了其中的</SPAN><SPAN lang=EN-US>OWCDCH11.CHM</SPAN><SPAN style="FONT-FAMILY: 宋体">文件。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：OWC的帮助好难用啊，有没有什么办法能更高效地使用它？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">如果有，那可能是借助</SPAN><SPAN lang=EN-US>Excel</SPAN><SPAN style="FONT-FAMILY: 宋体">罢。先打开</SPAN><SPAN lang=EN-US>Excel</SPAN><SPAN style="FONT-FAMILY: 宋体">的录制宏功能，在</SPAN><SPAN lang=EN-US>Excel</SPAN><SPAN style="FONT-FAMILY: 宋体">里把你要实现的图形样式调出来，再去查看宏代码中用到了哪些</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">的特性。理论上，只要是在</SPAN><SPAN lang=EN-US>Excel</SPAN><SPAN style="FONT-FAMILY: 宋体">里面能实现的，通过程序里面也能实现。我用这种方法解决了好几个问题。什么？你不会录制宏？……请使用</SPAN><SPAN lang=EN-US>Google</SPAN><SPAN style="FONT-FAMILY: 宋体">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN><SPAN lang=EN-US>OWC</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">能绘制哪些类型的图形？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">提供面积图、柱状图、条形图、折线图、平滑曲线图、饼图、圆环图、股价图、散点图、雷达图。其中有些图形包括二维和三维的，有些图形又包含好几种，比如柱状图包括单柱状图，簇形柱状图，一个柱好几个颜色的柱状图等。具体类型请参看</SPAN><SPAN lang=EN-US>OWCDCH11.CHM</SPAN><SPAN style="FONT-FAMILY: 宋体">文件中的枚举：</SPAN><SPAN lang=EN-US>ChartChartTypeEnum</SPAN><SPAN style="FONT-FAMILY: 宋体">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：介绍一下</SPAN><SPAN lang=EN-US>OWC</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">的主要对象、属性、方法罢。</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><SPAN><STRONG>A：</STRONG>请参看下面的示例图。<BR></SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US><?XML:NAMESPACE PREFIX = V /><V:SHAPETYPE id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><V:STROKE joinstyle="miter"></V:STROKE><V:FORMULAS><V:F eqn="if lineDrawn pixelLineWidth 0"></V:F><V:F eqn="sum @0 1 0"></V:F><V:F eqn="sum 0 0 @1"></V:F><V:F eqn="prod @2 1 2"></V:F><V:F eqn="prod @3 21600 pixelWidth"></V:F><V:F eqn="prod @3 21600 pixelHeight"></V:F><V:F eqn="sum @0 0 1"></V:F><V:F eqn="prod @6 1 2"></V:F><V:F eqn="prod @7 21600 pixelWidth"></V:F><V:F eqn="sum @8 21600 0"></V:F><V:F eqn="prod @7 21600 pixelHeight"></V:F><V:F eqn="sum @10 21600 0"></V:F></V:FORMULAS><V:PATH o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></V:PATH><O:LOCK v:ext="edit" aspectratio="t"></O:LOCK></V:SHAPETYPE><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US><IMG height=365 alt="" src="/article/userfiles/20101118124857519.gif" width=599 border=0><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChartSpace</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">对象</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">：图形容器对象，也是顶层对象。如果要使用</SPAN><SPAN lang=EN-US>OWC</SPAN><SPAN style="FONT-FAMILY: 宋体">绘制图形，至少要创建一个</SPAN><SPAN lang=EN-US>ChartSpace</SPAN><SPAN style="FONT-FAMILY: 宋体">对象。所谓容器，就是说</SPAN><SPAN lang=EN-US>ChartSpace</SPAN><SPAN style="FONT-FAMILY: 宋体">对象中可以包含多个图形对象，最多</SPAN><SPAN lang=EN-US>16</SPAN><SPAN style="FONT-FAMILY: 宋体">个。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>ChChart</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">对象、</SPAN><SPAN lang=EN-US>ChCharts</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">集合、</SPAN><SPAN lang=EN-US>ChCharts.Add()</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">方法</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN><SPAN lang=EN-US>ChChart</SPAN><SPAN style="FONT-FAMILY: 宋体">是图形对象。一个柱状图、饼状图、散点图等都是一个图形对象，多个图形对象构成</SPAN><SPAN lang=EN-US>ChCharts</SPAN><SPAN style="FONT-FAMILY: 宋体">集合。</SPAN><SPAN lang=EN-US>ChartSpace</SPAN><SPAN style="FONT-FAMILY: 宋体">对象就包含一个</SPAN><SPAN lang=EN-US>ChCharts</SPAN><SPAN style="FONT-FAMILY: 宋体">集合，这些</SPAN><SPAN lang=EN-US>ChChart</SPAN><SPAN style="FONT-FAMILY: 宋体">之间互相叠加，比如簇状条形图就是多个单柱状图的叠加，圆环套圆环图就是两个单圆环图的叠加。通过</SPAN><SPAN lang=EN-US>ChCharts.Add()</SPAN><SPAN style="FONT-FAMILY: 宋体">方法增加一个图形。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>ChSeries</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">对象、</SPAN><SPAN lang=EN-US>ChSeriesCollection</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">集合、</SPAN><SPAN lang=EN-US>ChSeriesCollection.Add()</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">方法</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">：帮助中说：一个</SPAN><SPAN lang=EN-US>ChSeries</SPAN><SPAN style="FONT-FAMILY: 宋体">对象表示图中的一个系列。实际上，你可以这样理解，当图形容器中包含多个图形时，一个</SPAN><SPAN lang=EN-US>ChSeries</SPAN><SPAN style="FONT-FAMILY: 宋体">对象就表示其中的一个图形，可以通过</SPAN><SPAN lang=EN-US>ChSeriesCollection</SPAN><SPAN style="FONT-FAMILY: 宋体">集合，可以使用数组的方式访问各个</SPAN><SPAN lang=EN-US>ChSeries</SPAN><SPAN style="FONT-FAMILY: 宋体">，比如</SPAN><SPAN lang=EN-US>ChSeriesCollection[0]</SPAN><SPAN style="FONT-FAMILY: 宋体">表示第一个图形。使用</SPAN><SPAN lang=EN-US>ChSeriesCollection.Add()</SPAN><SPAN style="FONT-FAMILY: 宋体">方法在当前容器中新增一个图形。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Point</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">属性和</SPAN><SPAN lang=EN-US>Points</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">集合：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">一个</SPAN><SPAN lang=EN-US>Point</SPAN><SPAN style="FONT-FAMILY: 宋体">代表图形中的一个部分，比如柱状图的一条柱，饼状图的一个扇区等。</SPAN><STRONG><SPAN lang=EN-US>ChChart</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">对象提供</SPAN><SPAN lang=EN-US>Points</SPAN><SPAN style="FONT-FAMILY: 宋体">集合，可以使用数组的形式访问各个</SPAN><SPAN lang=EN-US>Point</SPAN><SPAN style="FONT-FAMILY: 宋体">，比如</SPAN><SPAN lang=EN-US>Points[0]</SPAN><SPAN style="FONT-FAMILY: 宋体">表示第</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体">个部分。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Interior</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">属性：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">代表一个形状的内部空间。比如，</SPAN><SPAN lang=EN-US>ChartSpace</SPAN><SPAN style="FONT-FAMILY: 宋体">对象的</SPAN><SPAN lang=EN-US>Interior</SPAN><SPAN style="FONT-FAMILY: 宋体">属性代表图形容器内、图形外的空间，一个扇区</SPAN><SPAN lang=EN-US>Interior</SPAN><SPAN style="FONT-FAMILY: 宋体">属性表示该扇区的内部空间。该属性在设置图形各个部分的颜色时起到重要作用。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 17.95pt"><SPAN style="FONT-FAMILY: 宋体">窃以为，以上对象和属性的理解、使用非常关键，顺着它们找下去，标题、图例、数据标签、字体等重要的特性都能顺利找到。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：所有不同类型的图形都能叠加么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">不是。经测试，柱状图＋柱状图叠加可以，散点图＋平滑曲线图叠加也可以，但柱状图＋饼状图就不行，至于什么图形能叠加，什么图形不能叠加，似乎帮助中并没有明确给出。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：标题的字体、图例的位置、图形边框的颜色，这些可以自定义么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_62_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_62_Open_Text.style.display='none'; Codehighlighter1_2_62_Closed_Image.style.display='inline'; Codehighlighter1_2_62_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top name=Codehighlighter1_2_62_Open_Image><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_62_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartDetail()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_93_1577_Open_Image onclick="this.style.display='none'; Codehighlighter1_93_1577_Open_Text.style.display='none'; Codehighlighter1_93_1577_Closed_Image.style.display='inline'; Codehighlighter1_93_1577_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_93_1577_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_93_1577_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypeColumnStacked;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">13</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.Border.Color&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">White</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">18</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Title.Caption&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">;<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">20</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Title.Font.Size&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">22</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Title.Font.Bold&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">24</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Title.Font.Color&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">27</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">29</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Legend.Font.Size&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">31</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Legend.Position&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartLegendPositionEnum.chLegendPositionBottom;<BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">34</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">36</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">39</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">43</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">44</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartDetail.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">45</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image1.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartDetail.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">46</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">47</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN><SPAN lang=EN-US>OWC</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">提供的颜色好难看，我可以自定义饼状图、柱状图各个部分的颜色么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面对柱状图设置颜色的示例程序，饼状图与此同理。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_49_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_49_Open_Text.style.display='none'; Codehighlighter1_2_49_Closed_Image.style.display='inline'; Codehighlighter1_2_49_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_49_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartColor()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_79_1363_Open_Image onclick="this.style.display='none'; Codehighlighter1_79_1363_Open_Text.style.display='none'; Codehighlighter1_79_1363_Closed_Image.style.display='inline'; Codehighlighter1_79_1363_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_79_1363_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_79_1363_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypeColumnStacked;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Title.Caption&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">;<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">18</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">21</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">26</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">将柱状图的第一条柱设置为红色<BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Point：代表图中的一部分，比如柱图的一条柱，饼图的一个扇区<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Interior：表示指定对象的内部</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Interior.Color&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartColor.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image2.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartColor.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：饼状图能显示各个部分的值以及所占的百分比么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_55_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_55_Open_Text.style.display='none'; Codehighlighter1_2_55_Closed_Image.style.display='inline'; Codehighlighter1_2_55_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_55_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartPersent()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_87_1342_Open_Image onclick="this.style.display='none'; Codehighlighter1_87_1342_Open_Text.style.display='none'; Codehighlighter1_87_1342_Closed_Image.style.display='inline'; Codehighlighter1_87_1342_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_87_1342_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_87_1342_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/arti, cle/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection.Add();<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">25</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasValue&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">27</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasPercentage&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartPersent.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image3.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartPersent.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能将饼状图的某个部分抽出来以表示它与众不同么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_49_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_49_Open_Text.style.display='none'; Codehighlighter1_2_49_Closed_Image.style.display='inline'; Codehighlighter1_2_49_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_49_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartPart()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_78_1235_Open_Image onclick="this.style.display='none'; Codehighlighter1_78_1235_Open_Text.style.display='none'; Codehighlighter1_78_1235_Closed_Image.style.display='inline'; Codehighlighter1_78_1235_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_78_1235_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_78_1235_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">将第三个扇区抽离出来<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Explosion：返回或设置指定饼图或圆环图扇面的分离程度值。有效范围为&nbsp;0&nbsp;到&nbsp;1000。分离程度值等于图表半径的百分比。<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Long&nbsp;类型，可读写。</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">].Explosion&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">45</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartPart.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image4.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartPart.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能将饼状图的某个部分设置纹理以表示它与众不同么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_52_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_52_Open_Text.style.display='none'; Codehighlighter1_2_52_Closed_Image.style.display='inline'; Codehighlighter1_2_52_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_52_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartText()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_81_2312_Open_Image onclick="this.style.display='none'; Codehighlighter1_81_2312_Open_Text.style.display='none'; Codehighlighter1_81_2312_Closed_Image.style.display='inline'; Codehighlighter1_81_2312_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_81_2312_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_81_2312_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44\t55</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Interior.SetTextured(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">E:\\Projects\\DotNetNuke\\images\\add.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChartTextureFormatEnum.chTile,<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">,<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChartTexturePlacementEnum.chFrontSides);<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].Interior.SetOneColorGradient(OWC11.ChartGradientStyleEnum.chGradientFromCenter,<BR>&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantStart,</SPAN><SPAN style="COLOR: #000000">0.3</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Blue</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">].Interior.SetTwoColorGradient(OWC11.ChartGradientStyleEnum.chGradientDiagonalDown,<BR>&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantCenter,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Green</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给第四个扇区设置OWC预设的纹理，并设置纹理的背景色为淡绿色，前景色为红色<BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了很多纹理，这是其中一种<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">具体的纹理样式可以参看帮助中的ChartPatternTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">].Interior.SetPatterned(OWC11.ChartPatternTypeEnum.chPatternDiagonalBrick,<BR>&nbsp; </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">LightGreen</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给第五个扇区设置OWC预设的倾斜，<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了许多种的倾斜，这是其中一种<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">具体的倾斜可以参看帮助中的ChartPresetGradientTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">].Interior.SetPresetGradient(OWC11.ChartGradientStyleEnum.chGradientDiagonalUp,<BR>&nbsp;&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantEdges,OWC11.ChartPresetGradientTypeEnum.chGradientGoldII);<BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartText.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">43</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image5.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartText.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">44</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">45</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能给散点图加上一条趋势线么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_49_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_49_Open_Text.style.display='none'; Codehighlighter1_2_49_Closed_Image.style.display='inline'; Codehighlighter1_2_49_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_49_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartLine()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_78_1785_Open_Image onclick="this.style.display='none'; Codehighlighter1_78_1785_Open_Text.style.display='none'; Codehighlighter1_78_1785_Closed_Image.style.display='inline'; Codehighlighter1_78_1785_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_78_1785_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_78_1785_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN s, tyle="COLOR: #008000">创建一个图形容器对象</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypeScatterMarkers;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">添加一个series</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定series的名字</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">生产率</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定X值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimXValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定Y值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimYValues,<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5\t10\t12</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">26</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines.Add();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].IsDisplayingEquation&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].IsDisplayingRSquared&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">32</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">TrendLine</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">设置趋势线类型，<BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了4种趋势线类型，具体可参看帮助的ChartTrendlineTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartTrendlineTypeEnum.chTrendlineTypePolynomial;<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartLine.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image6.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartLine.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：哪些功能还没实现？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">如下功能我还没有实现：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">设置坐标轴的刻度（找到了方法，帮助中也有相应的示例代码，但我这里运行失败）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">去掉图形边框（目前只能设置颜色，还不知如何彻底去掉）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">将饼图的数值、百分比标签显示在饼图周围（目前只能显示在扇区中）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">显示数据标签的引导线（未找到）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">其他</SPAN></P></DIV>
<DIV></DIV>
<DIV></DIV></SPAN>﻿ 
<DIV class=wenzhang_bt_list></DIV>, cle/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection.Add();<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">25</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasValue&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">27</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].DataLabelsCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].HasPercentage&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartPersent.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image3.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartPersent.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能将饼状图的某个部分抽出来以表示它与众不同么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_49_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_49_Open_Text.style.display='none'; Codehighlighter1_2_49_Closed_Image.style.display='inline'; Codehighlighter1_2_49_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_49_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartPart()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_78_1235_Open_Image onclick="this.style.display='none'; Codehighlighter1_78_1235_Open_Text.style.display='none'; Codehighlighter1_78_1235_Closed_Image.style.display='inline'; Codehighlighter1_78_1235_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_78_1235_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_78_1235_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">将第三个扇区抽离出来<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Explosion：返回或设置指定饼图或圆环图扇面的分离程度值。有效范围为&nbsp;0&nbsp;到&nbsp;1000。分离程度值等于图表半径的百分比。<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Long&nbsp;类型，可读写。</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">].Explosion&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">45</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartPart.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">30</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image4.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartPart.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能将饼状图的某个部分设置纹理以表示它与众不同么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_52_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_52_Open_Text.style.display='none'; Codehighlighter1_2_52_Closed_Image.style.display='inline'; Codehighlighter1_2_52_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_52_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartText()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_81_2312_Open_Image onclick="this.style.display='none'; Codehighlighter1_81_2312_Open_Text.style.display='none'; Codehighlighter1_81_2312_Closed_Image.style.display='inline'; Codehighlighter1_81_2312_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_81_2312_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_81_2312_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypePie;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">指标</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58\t55\t44\t55</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">23</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Interior.SetTextured(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">E:\\Projects\\DotNetNuke\\images\\add.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChartTextureFormatEnum.chTile,<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">,<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChartTexturePlacementEnum.chFrontSides);<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">].Interior.SetOneColorGradient(OWC11.ChartGradientStyleEnum.chGradientFromCenter,<BR>&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantStart,</SPAN><SPAN style="COLOR: #000000">0.3</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Blue</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">].Interior.SetTwoColorGradient(OWC11.ChartGradientStyleEnum.chGradientDiagonalDown,<BR>&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantCenter,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Green</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给第四个扇区设置OWC预设的纹理，并设置纹理的背景色为淡绿色，前景色为红色<BR></SPAN><SPAN style="COLOR: #008080">32</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了很多纹理，这是其中一种<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">具体的纹理样式可以参看帮助中的ChartPatternTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">].Interior.SetPatterned(OWC11.ChartPatternTypeEnum.chPatternDiagonalBrick,<BR>&nbsp; </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Red</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">LightGreen</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给第五个扇区设置OWC预设的倾斜，<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了许多种的倾斜，这是其中一种<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">具体的倾斜可以参看帮助中的ChartPresetGradientTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Points[</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">].Interior.SetPresetGradient(OWC11.ChartGradientStyleEnum.chGradientDiagonalUp,<BR>&nbsp;&nbsp; OWC11.ChartGradientVariantEnum.chGradientVariantEdges,OWC11.ChartPresetGradientTypeEnum.chGradientGoldII);<BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartText.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">43</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image5.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartText.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">44</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">45</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：我能给散点图加上一条趋势线么？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">可以。请参看下面的示例程序。<BR></SPAN></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%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_2_49_Open_Image onclick="this.style.display='none'; Codehighlighter1_2_49_Open_Text.style.display='none'; Codehighlighter1_2_49_Closed_Image.style.display='inline'; Codehighlighter1_2_49_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_2_49_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 alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 alt="" src="/article/userfiles/20101118130122882.gif" align=top>&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><BR><SPAN style="COLOR: #008080">&nbsp;4</SPAN><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;ChartLine()<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_78_1785_Open_Image onclick="this.style.display='none'; Codehighlighter1_78_1785_Open_Text.style.display='none'; Codehighlighter1_78_1785_Closed_Image.style.display='inline'; Codehighlighter1_78_1785_Closed_Text.style.display='inline';" alt="" src="/article/userfiles/20101118125902180.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN id=Codehighlighter1_78_1785_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_78_1785_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN s, tyle="COLOR: #008000">创建一个图形容器对象</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;OWC11.ChartSpaceClass();<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OWC11.ChChart&nbsp;objChart&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">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">11</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartChartTypeEnum.chChartTypeScatterMarkers;<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">添加一个series</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection.Add(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定series的名字</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimSeriesNames,<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">生产率</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定X值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimXValues,<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">10\t40\t58</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">给定Y值</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].SetData&nbsp;(OWC11.ChartDimensionsEnum.chDimYValues,<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">)OWC11.ChartSpecialDataSourcesEnum.chDataLiteral,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5\t10\t12</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">26</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines.Add();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">28</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].IsDisplayingEquation&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">29</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">30</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].IsDisplayingRSquared&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">31</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&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: #008080">32</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Caption&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">TrendLine</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">33</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">设置趋势线类型，<BR></SPAN><SPAN style="COLOR: #008080">34</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">OWC提供了4种趋势线类型，具体可参看帮助的ChartTrendlineTypeEnum枚举</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">35</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objChart.SeriesCollection[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Trendlines[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">].Type&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;OWC11.ChartTrendlineTypeEnum.chTrendlineTypePolynomial;<BR></SPAN><SPAN style="COLOR: #008080">36</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">37</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">显示数据，创建GIF文件的相对路径.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">38</SPAN><SPAN style="COLOR: #008000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">string</SPAN><SPAN style="COLOR: #000000">&nbsp;FileName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Hour.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Minute.ToString() </SPAN><SPAN style="COLOR: #000000"><BR>&nbsp; +</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Second.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;DateTime.Now.Millisecond.ToString()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">39</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objCSpace.ExportPicture(</SPAN><SPAN style="COLOR: #000000">@"</SPAN><SPAN style="COLOR: #000000">E:\Projects\Study\OwcImg\ChartLine.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">GIF</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">450</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">);&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">40</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118124945914.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Image6.ImageUrl&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Http://localhost/Study/OwcImg/ChartLine.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">41</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130122882.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008080">42</SPAN><SPAN style="COLOR: #000000"><IMG alt="" src="/article/userfiles/20101118130145792.gif" align=top></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>Q</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：哪些功能还没实现？</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></STRONG></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 18pt"><STRONG><SPAN lang=EN-US>A</SPAN></STRONG><STRONG><SPAN style="FONT-FAMILY: 宋体">：</SPAN></STRONG><SPAN style="FONT-FAMILY: 宋体">如下功能我还没有实现：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">设置坐标轴的刻度（找到了方法，帮助中也有相应的示例代码，但我这里运行失败）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">去掉图形边框（目前只能设置颜色，还不知如何彻底去掉）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">将饼图的数值、百分比标签显示在饼图周围（目前只能显示在扇区中）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">显示数据标签的引导线（未找到）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 56.9pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings"><SPAN>ü<SPAN style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">其他</SPAN></P></DIV>
<DIV></DIV>
<DIV></DIV></SPAN>﻿ 
<DIV class=wenzhang_bt_list></DIV>…… [<a href="http://www.13com.net/article/article.asp?articleid=1130">点击查看详细</a>] ]]></description>
	<pubDate>Thu, 18 Nov 2010 05:05:17 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1130</comments>
	</item>

	<item>
	<title><![CDATA[JS中setTimeout()的用法详解 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1129</link>
	<description><![CDATA[<p><strong>1. SetTimeOut()</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1.1 SetTimeOut()语法例子</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1.2 用SetTimeOut()执行Function</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1.3 SetTimeOut()语法例子</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1.4 设定条件使SetTimeOut()停止</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  1.5 计分及秒的counter</strong></p>
<p><strong>&nbsp;&nbsp;  2. ClearTimeout()</strong></p>
<p><strong>&nbsp;&nbsp;  3.  Set Flag&nbsp;&nbsp;  </strong></p>
<p><strong>10.1　setTimeout( )<br />
setTimeout( ) 是屬於 window 的 method, 但我們都是略去 window 這頂層物件名稱, 這是用來設定一個時間,  時間到了, 就會執行一個指定的 method。請先看以下一個簡單, 這是沒有實際用途的例子, 只是用來示範 setTimeout( )  的語法。 </strong></p>
<p><strong>　</strong></p>
<p><strong>1.　setTimeout( ) 語法例子<br />
</strong></p>
<p><strong>練習-69　等候三秒才執行的 alert( ) </strong></p>
<p><strong>　　在 第 3 章 說到 alert 對話盒, 一般是用按鈕叫出來, 在這練習, 你會看到網頁開啟後 3 秒, 就會自動出現一個 alert 對話盒。 </strong></p>
<p><strong>1.　請用瀏覽器開啟示範磁碟中的 timeout1.htm, 這檔案有以下內容: </strong></p>
<p><strong>&lt;html&gt; &lt;body bgcolor=lightcyan text=red&gt;<br />
&lt;h1&gt; &lt;font color=blue&gt; 示範網頁 &lt;/font&gt; &lt;/h1&gt; &lt;p&gt; &lt;/br&gt;<br />
&lt;p&gt; 請等三秒!</strong></p>
<p><strong>&lt;script&gt;<br />
setTimeout(&quot;alert('對不起, 要你久候')&quot;, 3000 )<br />
&lt;/script&gt;</strong></p>
<p><strong>&lt;/body&gt; &lt;/html&gt;</strong></p>
<p><strong>2.　留意網頁開啟後三秒, 就會出現一個 alert 對話盒。 </strong></p>
<p><strong>　</strong></p>
<p><strong>　　setTimeout( ) 是設定一個指定等候時間 (單位是千分之一秒, millisecond), 時間到了, 瀏覽器就會執行一個指定的 method 或 function, 有以下語法: </strong></p>
<p><strong> </strong></p>
<p><strong>　　今次例子是設定等 3 秒 (3000 milliseconds), 瀏覽器就會執行 alert( ) 這一個method。 </strong></p>
<p><strong>　</strong></p>
<p><strong>2.　用 setTimeout( ) 來執行 function<br />
setTimeout( ) 通常是與 function 一起使用, 以下是一個較上個練習複雜的例子。 </strong></p>
<p><strong>練習-70　狀態列中自動消失的文字 </strong></p>
<p><strong>　　在練習-20, 你看過如何用按鈕在狀態列顯示文字, 然後再用按鈕消除文字, 在這練習, 你看到如何用按鈕在狀態列顯示文字, 而這文字會在三秒後自動消失。 </strong></p>
<p><strong>1.　請用瀏覽器開啟示範磁碟中的 timeout2.htm, 這檔案有以下內容: </strong></p>
<p><strong>&lt;html&gt; &lt;body bgcolor=lightcyan text=red&gt;<br />
&lt;h1&gt; &lt;font color=blue&gt; 示範網頁 &lt;/font&gt; &lt;/h1&gt; &lt;p&gt; &lt;/br&gt;</strong></p>
<p><strong>&lt;script&gt;<br />
function clearWord( )<br />
{　window.status=&quot;&quot;　}<br />
&lt;/script&gt;</strong></p>
<p><strong>&lt;form&gt;<br />
&lt;input type=&quot;button&quot; value=&quot;在狀態列顯示文字&quot;<br />
onClick=&quot;window.status='Hello' , setTimeout('clearWord( )', 3000) &quot;&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt; &lt;/html&gt;</strong></p>
<p><strong>2.　請在按鈕上按一下, 你應見到狀態列出現 Hello 這字, 留意過了三秒, 這字就會消失。</strong></p>
<p><strong>　</strong></p>
<p><strong>1.　這處先設定一個名為 clearWord( ) 的 function, 作以下定義:</strong></p>
<p><strong>window.status=&quot;&quot;</strong></p>
<p><strong>　　這是用來消除狀態列的文字 (請看練習-20 的說明), 瀏覽器執行 clearWord( ) , 就會消除狀態列的文字。</strong></p>
<p><strong>2.　今次按鈕設定了啟動以下兩項工作, 用 ， 分隔, 瀏覽器會順序執行這兩項工作:</strong></p>
<p><strong>onClick=&quot;window.status='Hello' , setTimeout('clearWord( )', 3000) &quot;</strong></p>
<p><strong>3.　今次的 setTimeout( ) 有以下設定:</strong></p>
<p><strong>
<p>&nbsp;</p>
<p>　　這是設定等 3 秒 (3000 milliseconds) 瀏覽器就會執行 clearWord( ) 這一個function。</p>
<p>　　在第 2 章, 你看過如何使到父視窗開啟時自動開啟一個子視窗, 若觀看者不關閉這子視窗, 這子視窗就會一路開啟。看過以上的練習, 請你設計一個會開啟子視窗的網頁, 而這子視窗在開啟後兩秒, 就會自動關閉。</p>
<p>　</p>
<p>3.　不斷重複執行的 setTimeout( )<br />
setTimeout( ) 預設只是執行一次, 但我們可以使用一個循環方式, 使到一個setTimeout( ) 再啟動自己一次,  就會使到第二個 setTimeout( ) 執行, 第二個又啟動第三個, 這樣循環下去, 這 setTimeout( ) 就會不斷執行。</p>
<p>　</p>
<p>練習-71　自動每秒加 1 的 function</p>
<p>　　在這練習, 你看到如何使用 setTimeout( ) 令文字框的數值每秒就加 1, 當然你也可以設定其他遞增的速度, 例如每五秒就加 5, 或每五秒就加 1。</p>
<p>1.　請用瀏覽器開啟示範磁碟中的 timeout3.htm, 這檔案有以下內容:</p>
<p>&lt;html&gt; &lt;head&gt;<br />
&lt;script&gt;<br />
x = 0<br />
function countSecond( )<br />
{　x = x+1<br />
document.fm.displayBox.value=x<br />
setTimeout(&quot;countSecond( )&quot;, 1000)<br />
}<br />
&lt;/script&gt; &lt;/head&gt;<br />
&lt;body bgcolor=lightcyan text=red&gt; &lt;p&gt; &lt;/br&gt;</p>
<p>&lt;form name=fm&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;displayBox&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;/form&gt;</p>
<p>&lt;script&gt;<br />
countSecond( )<br />
&lt;/script&gt;</p>
<p>&lt;/body&gt; &lt;/html&gt;</p>
<p>2.　網頁開啟後, 請你留意文字框中的數值轉變。</p>
<p>3.　請你將這檔案複製去硬碟, 更改一些設定, 例如 x = x+5, 或將等候時間改為5000, 看有什麼反應。</p>
<p>　</p>
<p>1.　這網頁有兩個 script, 第一個是設定 countSecond( ) 這個 function, 第二個在後的是在網頁完全載入後, 就啟動這 function。</p>
<p>2.　留意今次以下的設定:</p>
<p>function countSecond( )<br />
{　x = x+1<br />
document.fm.displayBox.value = x<br />
setTimeout(&quot;countSecond( )&quot;, 1000)<br />
}</p>
<p>　　當 countSecond( ) 啟動後, 就會啟動 setTimeout( ), 這個 method 在一秒後又啟動  countSecond( ), countSecond( ) 啟動後又啟動 setTimeout( ) , 所以得出的結果是  countSecond( ) 每秒執行一次。</p>
<p>3.　在 JavaScript, 我們是使用這處說的方法使到一些事項不斷執行, 其中一個用途是顯示轉動時間, 另一個用途是設定跑動文字, 隨後的章節會有例子。</p>
<p>　　用上述的方法設定時間, setTimeout( ) 雖然設定了是一秒, 但瀏覽器還有另外兩項功能要執行, 所以一個循環的時間是稍多於一秒, 例如一分鐘可能只有58 個循環。</p>
<p>　</p>
<p>4.　設定條件使 setTimeout( ) 停止<br />
setTimeout( ) 的迴圈開始後, 就會不斷重複, 在上個練習, 你看到文字框的數字不斷跳動,  但我們是有方法使到數字跳到某一個數值就停下來, 其中一個方法是用 if...else 設定一個條件, 若是 TRUE 就繼續執行  setTimeout( ) , 若是 FALSE 就停止。</p>
<p>　　例如要使到上個練習的 counter 跳到 20 就停下, 可將有關的 function 作以下的更改。</p>
<p>function countSecond( )<br />
{　if ( x &lt; 20 )<br />
{　x = x + 1<br />
document.displaySec.displayBox.value = x<br />
setTimeout(&quot;countSecond( )&quot;, 1000)<br />
&nbsp;&nbsp;&nbsp;  　　}<br />
}</p>
<p>　</p>
<p>5.　計分及計秒的 counter<br />
在前面的練習, 相信你已學識如何使用 setTimeout( ), 現在請你看一個較複習的例子。</p>
<p>　</p>
<p>練習-72　計時的 counter</p>
<p>　　在這練習, 你要設定兩個文字框, 一個顯示分鐘, 另一個顯示秒, 網頁開啟後, 就會在這兩個文字框中自動計時。</p>
<p>1.　請用瀏覽器開啟示範磁碟中的 timeout4.htm, 這檔案有以下內容:</p>
<p>&lt;html&gt; &lt;head&gt;<br />
&lt;script&gt;<br />
x=0<br />
y=-1</p>
<p>function countMin( )<br />
{　y=y+1<br />
document.displayMin.displayBox.value=y<br />
setTimeout(&quot;countMin( )&quot;,60000)<br />
}</p>
<p>function countSec( )<br />
{　x = x + 1<br />
z =x % 60<br />
document.displaySec.displayBox.value=z<br />
setTimeout(&quot;countSec( )&quot;, 1000)<br />
}<br />
&lt;/script&gt; &lt;/head&gt;</p>
<p>&lt;body bgcolor=lightcyan text=red&gt; &lt;p&gt; &lt;/br&gt;</p>
<p>&lt;table&gt; &lt;tr valign=top&gt; &lt;td&gt; 你在本網頁的連線時間是: &lt;/td&gt;</p>
<p>&lt;td&gt; &lt;form name=displayMin&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;displayBox&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;/form&gt; &lt;/td&gt;<br />
&lt;td&gt; 分 &lt;/td&gt;</p>
<p>&lt;td&gt; &lt;form name=displaySec&gt; &lt;/td&gt;<br />
&lt;td&gt; &lt;input type=&quot;text&quot; name=&quot;displayBox&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;/form&gt; &lt;/td&gt;<br />
&lt;td&gt; 秒。&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;</p>
<p>&lt;script&gt;<br />
countMin( )<br />
countSec( )<br />
&lt;/script&gt;<br />
&lt;/body&gt; &lt;/html&gt;</p>
<p>2.　請你留意兩個文字框中的數字轉變。</p>
<p>　</p>
<p>1.　這網頁有兩個 function, 一個用來計分鐘, 一個用來計秒。在這處, 筆者只是示範setTimeout( ) 的操作, 因為計時器有其他更精簡的寫法。(留意: 這方式的計時並不準確。)</p>
<p>2.　留意計秒的 function:</p>
<p>function countSec( )<br />
{　x = x + 1<br />
z = x % 60<br />
document.displaySec.displayBox.value=z<br />
setTimeout(&quot;countSec( )&quot;, 1000)</p>
<p>}</p>
<p>　　這處的 % 符號是 modulus (餘數), 例如 z = x % 60 表示先進行 x / 60, 得出的餘數作為 z 這變數, 例如 82 秒, modulus 就是 22, 所以文字框會顯示 22 而不是 82。</p>
<p>3.　若你要將單位數字在前加上 0, 例如 01, 02, 03 等, 可用以下方法:</p>
<p>function countSec( )<br />
{　x = x + 1<br />
z = x % 60<br />
if (z &lt; 10)　{　z = &quot;0&quot; + z　}<br />
document.displaySec.displayBox.value=z<br />
setTimeout(&quot;countSec( )&quot;, 1000)<br />
}</p>
<p>　</p>
<p>　</p>
<p><br />
--------------------------------------------------------------------------------</p>
<p>10.2　clearTimeout( )<br />
在前一節, 你看過如何使用 setTimeout( ) 來使到瀏覽器不斷執行一個 function, 當一個 setTimeout( ) 開始了循環的工作, 我們要使它停下來, 可使用 clearTimeout( ) 這 method。</p>
<p>　　clearTimout( ) 有以下語法:　clearTimeout(timeoutID)</p>
<p>　　要使用 clearTimeout( ), 我們設定 setTimeout( ) 時, 要給予這 setTimout( ) 一個名稱,  這名稱就是 timeoutID , 我們叫停時, 就是用這 timeoutID來叫停, 這是一個自訂名稱, 但很多程式員就以 timeoutID  為名。</p>
<p>　　在下面的例子, 筆者設定兩個 timeoutID, 分別命名為 meter1 及 meter2, 如下:</p>
<p>timeoutID<br />
&darr;<br />
meter1 = setTimeout(&quot;count1( )&quot;, 1000)<br />
meter2 = setTimeout(&quot;count2( )&quot;, 1000)</p>
<p>　　使用這 meter1 及 meter2 這些 timeoutID 名稱, 在設定 clearTimeout( ) 時, 就可指定對哪一個 setTimeout( ) 有效, 不會擾及另一個 setTimeout( ) 的操作。</p>
<p>　</p>
<p>練習-73　可停止的 setTimeout( )</p>
<p>　　這練習以練習-71 為藍本, 但作了兩個改變: (1) 有兩個 setTimeout( ), (2) 有兩個按鈕, 分別可停止這兩個 setTimout( )。</p>
<p>1.　請用瀏覽器開啟示範磁碟中的 clear.htm, 這檔案有以下內容:</p>
<p>&lt;html&gt; &lt;head&gt;<br />
&lt;script&gt;<br />
x = 0<br />
y = 0</p>
<p>function count1( )<br />
{　x = x + 1<br />
document.display1.box1.value = x<br />
meter1=setTimeout(&quot;count1( )&quot;, 1000)<br />
}</p>
<p>function count2( )<br />
{　y = y + 1<br />
document.display2.box2.value = y<br />
meter2=setTimeout(&quot;count2( )&quot;, 1000)<br />
} <br />
&lt;/script&gt; &lt;/head&gt;</p>
<p><br />
&lt;body bgcolor=lightcyan text=red&gt; &lt;p&gt; &lt;/br&gt;</p>
<p>&lt;form name=display1&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;box1&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;input type=button value=&quot;停止計時&quot; onClick=&quot;clearTimeout(meter1) &quot; &gt;<br />
&lt;input type=button value=&quot;繼續計時&quot; onClick=&quot;count1( ) &quot; &gt;<br />
&lt;/form&gt;<br />
&lt;p&gt;<br />
&lt;form name=display2&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;box2&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;input type=button value=&quot;停止計時&quot; onClick=&quot;clearTimeout(meter2) &quot; &gt;<br />
&lt;input type=button value=&quot;繼續計時&quot; onClick=&quot;count2( ) &quot; &gt;<br />
&lt;/form&gt;</p>
<p>&lt;script&gt;<br />
count1( )<br />
count2( )<br />
&lt;/script&gt;</p>
<p>&lt;/body&gt; &lt;/html&gt;</p>
<p>2.　留意網頁中的兩個文字框及內裡變動的數字, 每個文字框旁有兩個按鈕, 請你試試兩個按鈕的反應。</p>
<p>3.　請你連續按多次 [繼續計時] 的按鈕, 留意數值的跳動加快了, 原因是每按一次就啟動 function 一次, 每個 function 都令數值跳動, 例如啟動同一的 function 四次, 就會一秒跳四次。(請看下一節)</p>
<p>　</p>
<p>　</p>
<p><br />
--------------------------------------------------------------------------------</p>
<p>10.3　Set flag<br />
前個練習說到我們用一個按鈕來啟動一個 function, 每按一下就會啟動這 function 一次, 請看以下例子。</p>
<p>　</p>
<p>練習-74　效果重複的 setTimeout( )</p>
<p>　　這練習實際是將 練習-73 簡化, 只有一個計時器, 筆者想示範的是每按 [繼續計時] 一次, 就會啟動 count( ) 這 function 一次。</p>
<p>1.　請用瀏覽器開啟示範磁碟中的 flag1.htm, 這檔案有以下內容:</p>
<p>&lt;html&gt; &lt;head&gt;<br />
&lt;script&gt;<br />
x=0<br />
function count( )<br />
{　x = x + 1<br />
document.display.box.value= x<br />
timeoutID=setTimeout(&quot;count( )&quot;, 1000)<br />
}<br />
&lt;/script&gt; &lt;/head&gt; &lt;body bgcolor=lightcyan text=red&gt; &lt;p&gt; &lt;/br&gt;<br />
&lt;form name=display&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;box&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;input type=button value=&quot;停止計時&quot; onClick=&quot;clearTimeout(timeoutID) &quot; &gt;<br />
&lt;input type=button value=&quot;繼續計時&quot; onClick=&quot;count( ) &quot; &gt;<br />
&lt;/form&gt; &lt;p&gt;</p>
<p>&lt;script&gt;<br />
count( )<br />
&lt;/script&gt;<br />
&lt;/body&gt; &lt;/html&gt;</p>
<p>2.　網頁開啟後, 你應見到文字框中的數字跳動, 請你按四次 [繼續計時], 留意這會加快數字跳動, 原因是有關的 function 被開啟了多個, 每個都會使數字轉變。</p>
<p>3.　按了四次 [繼續計時] 的按鈕後, 請你按 [停止計時] 的按鈕, 你會發現要按五次才能停止數字跳動。</p>
<p>　</p>
<p>　　在編寫程式時, 我們常要提防使用者作出一些特別動作, 例如使用者按兩次 [繼續計時] 按鈕, 這計時器就失準了。我們是否有辦法使到一個按鈕被按一次就失效呢? 這就不會產生重複效果。</p>
<p>　　筆者藉這處的例子 (隨後還有多個例子), 解說程式中一個 set flag (設定旗標) 的概念, flag 是一個記認, 一般來說,  這可以是 0 或是 1 (也可用 on 或 off, 或任何兩個自選的名稱或數字), 但也可以是 2、3、4 或更大的數字,  在這例子有以下設定:</p>
<p>1.　程式開啟時 flag=0。</p>
<p>2.　當 counter( ) 執行時會順便將 flag 變為 1。</p>
<p>3.　在 [繼續計時] 這按鈕的反應中, 會先檢查 flag 是 0 或是 1, 若是 0 就會產生作用, 若是 1 就沒有反應。</p>
<p>4.　使用這 flag 的方式, count( ) 這 function 開啟後, [繼續計時] 這按鈕就沒有作用。</p>
<p>　</p>
<p>　　這處的 flag 是一個變數, 可任意取名, 我們用 flag來稱呼這變數的原因, 是因為這變數好處一支旗, 將旗豎起 (flag is on), 就會產生一個作用, 將旗放下 (flag is off), 就產生另一個作用。</p>
<p>　</p>
<p>練習-75　只可開啟一次的 function</p>
<p>　　這練習是將上個練習加多一個 flag, 使到每次只能有一個 count( ) 這 function 在進行。</p>
<p>1.　請用瀏覽器開啟示範磁碟中的 flag2.htm, 這檔案有以下內容:</p>
<p>&lt;html&gt; &lt;head&gt;<br />
&lt;script&gt;<br />
x = 0<br />
flag = 0<br />
function count( )<br />
{　x = x + 1<br />
document.display.box.value = x<br />
timeoutID=setTimeout(&quot;count( )&quot;, 1000)<br />
flag = 1<br />
}</p>
<p>function restart( )<br />
{　if (flag==0)<br />
{　count( )　}<br />
}<br />
&lt;/script&gt; &lt;/head&gt;</p>
<p>&lt;body bgcolor=lightcyan text=red&gt; &lt;p&gt; &lt;/br&gt;<br />
&lt;form name=display&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;box&quot; value=&quot;0&quot; size=4 &gt;<br />
&lt;input type=button value=&quot;停止計時&quot;<br />
onClick=&quot;clearTimeout(timeoutID); flag=0 &quot; &gt;<br />
&lt;input type=button value=&quot;繼續計時&quot; onClick=&quot;restart( ) &quot; &gt;<br />
&lt;/form&gt; &lt;p&gt;</p>
<p>&lt;script&gt;<br />
count( )<br />
&lt;/script&gt;</p>
<p>&lt;form&gt;<br />
&lt;input type=button value=&quot;Show flag&quot;<br />
onClick=&quot;alert('The flag now is '+ flag) &quot; &gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt; &lt;/html&gt;</p>
<p>2.　在網頁中, 你應見到三個按鈕及文字框中的數字跳動。</p>
<p>3.　請你按 [Show flag] 這按鈕, 應見到一個話對盒顯示 flag 是 1。</p>
<p>4.　請你按 [停止計時] 這按鈕, 數字停止跳動, 請你按 [Show flag] 這按鈕, 應見到話對盒顯示 flag 是 0。</p>
<p>5.　請你按多次 [繼續計時] 這按鈕, 你應見到數字不會加快, 請你按 [Show flag] 這按鈕, 應見到話對盒顯示 flag 變回 1。</p>
<p>　</p>
<p>1.　這網頁第 4 行有這一句: flag=0 , 這是設定 flag 這變數及將初始值定為 0, 你也可將初始值定為 1, 隨後有關的 0 和 1 對調。</p>
<p>2.　count( ) 這 function 最後一句是 flag=1 , 所以啟動 count( ) 後, flag 就會變為 1。</p>
<p>3.　[繼續計時] 的按鈕是用來啟動 restart( ), 這 function 有以下設定:</p>
<p>function restart( )<br />
{　if (flag==0) <br />
{　count( )　}<br />
}</p>
<p>　　這處的 if statement 檢查 flag 是否等於 0, 若是 0 就啟動 count( ), 若是 1 (即不是 0) 就沒有反應, 使用這方法, 若 count( ) 已在執行中, [繼續計時] 這按鈕不會有作用。</p>
<p>　　這處的 flag=1 設定, 實際設為 1 或 2 或 3 等數值都是一樣的, 只要不是 0 就可以了, 所以這兩個相對的旗標, 看似是 &quot;0&quot; 和 &quot;1&quot;, 實際是 &quot;0&quot; 和 &quot;non-zero&quot; (非-0)。</p>
<p>4.　[停止計時] 的按鈕有以下設定:</p>
<p>onClick=&quot;clearTimeout(timeoutID); flag=0 &quot;</p>
<p>　　這是停止 setTimeout( ) 的操作時, 同時將 flag 轉回 0, 這使到 restart( ) 這 function 可以重新啟動 count( )。</p>
</strong></p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1129">点击查看详细</a>] ]]></description>
	<pubDate>Thu, 18 Nov 2010 03:19:33 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1129</comments>
	</item>

	<item>
	<title><![CDATA[OWC 用Ungroup方法生成双轴图表]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1128</link>
	<description><![CDATA[<p>继续研究图表，看来看去，感觉还是owc比较合适，更底层点儿的东西操作起来也会更灵活一些，更先进一些的控件可能在使用的时候会方便不少，但应对一些特殊的要求往往会更让人伤脑筋。所以，还是用owc算了。<br />
<br />
一、owc的位置<br />
<br />
该控件是office提供，可在以下位置找到：%system%\Program Files\Common Files\Microsoft Shared\Web Components\11，相对office2003 ，其中有个owc11.dll的就是，当然，这是一个com组件，在部署到服务器时会麻烦点，应该需要在服务器上安装。记得我在浏览这个文件夹时，不小心把web componets移动了一个位置，结果就造成程序的错误。在其中的2052文件夹下，有该控件的帮助文档，可以做为参考。<br />
<br />
二、基本用法<br />
<br />
首先当然是引用该组件。代码页顶部需要申明using OWC= Microsoft.Office.Interop.Owc11;OWC这个别名可以方便程序的使用。在使用时，先创建一个ChartSpace对象，然后在其中添加一个CHChart对象，如下：<br />
<br />
OWC.ChartSpace objCSpace = new OWC.ChartSpaceClass();<br />
<br />
OWC.ChChart objChart = objCSpace.Charts.Add(0);<br />
<br />
下一步就是往CHChart图表对象中添加Series系列对象了。所谓Seires就是具体的图形了，如柱形图、饼图之类的。CHChart对象有个SeriesCollection属性，是CHChart对象中所有系列的集合，最多可包含256个系列。SeriesCollection有个 Add方法，可用来往集合中添加Series系列。添加了系列后，可以用其SetData方法为该系列指定名称、属性、值了。例如：<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //添加一个series<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objChart.SeriesCollection.Add(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objChart.SeriesCollection[0].Type = OWC.ChartChartTypeEnum.chChartTypeColumnClustered;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //给定series的名字<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimSeriesNames,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //给定属性<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strCategory);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //给定objChart[0]的值<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OWC.ChSeries sDispDppm = objChart.SeriesCollection[0];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sDispDppm.SetData<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (OWC.ChartDimensionsEnum.chDimValues,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);<br />
<br />
三、用Ungroup方法生成双轴图表<br />
<br />
CHSeries对象有个Ungroup方法，唯一的参数是逻辑型的，指示该系列是否采用与前一层次不同的刻度。默认为false，而 Ungroup(true)则会采用不同的刻度。当然，你需要为图表对象增加一个刻度，并设置相应的刻度，CHChart对象下有个Axes属性，用来返回图表的ChAxes轴集合，其有个Add方法，用来添加新的轴ChAxis对象。例如：<br />
<br />
OWC.ChSeries sDispLar = objChart.SeriesCollection.Add(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sDispLar.Ungroup(true);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OWC.ChAxis MyAxis = objChart.Axes.Add(sDispLar.get_Scalings(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyAxis.Position = OWC.ChartAxisPositionEnum.chAxisPositionRight;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyAxis.HasMinorGridlines = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyAxis.NumberFormat = &quot;0.00%&quot;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyAxis.HasTitle = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyAxis.Title.Caption = &quot;报废率(%)&quot;;<br />
<br />
该系列名称、属性、值的设置方法和前面一样。<br />
<br />
更多用法和技巧待日后使用中再做总结。</p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1128">点击查看详细</a>] ]]></description>
	<pubDate>Tue, 16 Nov 2010 06:48:13 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1128</comments>
	</item>

	<item>
	<title><![CDATA[Office Web Components - Line Graph (Date as X-Axis) Office Web组件-线路图（如X轴日期）]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1127</link>
	<description><![CDATA[<p>Office Web Components - Line Graph (Date as X-Axis)<br />
Office Web组件-线路图（如X轴日期）<br />
<br />
Background<br />
背景 <br />
Office Web Components are a collection of Component Object Model  (COM) controls for publishing spreadsheets, charts, and databases to the  Web. But it can be used in Windows Application too. You can download it  from the Microsoft download center.<br />
Office Web Components是组件对象模型（COM）控件的集合，用于将电子表格，图表和数据库发布到Web。但它可以用在Windows应用程序了。你可以从微软下载中心下载。  <br />
After installation, you have to add the reference named (Microsoft  Office Web Components 11.0) to your project as well as your toolbox.<br />
安装后，你必须添加一个名为（Microsoft Office Web组件11.0）到项目以及您的工具箱中的参考。<br />
<br />
Using the Code<br />
使用代码 <br />
Although I built my project in Visual Studio 2008, the code relating  to OWC is absolutely applicable in .NET 2.0. I will describe the whole  process in building the line graph here.<br />
虽然我建我在Visual Studio 2008项目，该代码与OWC的是绝对的。NET 2.0适用。我将描述在建立线图这里的整个过程。  <br />
<br />
Prepare the Source Data<br />
准备源数据 <br />
There are different methods in preparing and feeding the data into  OWC. Many examples use a comma-seperated value, e.g. Jan,Feb. However, I  prefer using Array, you can set an OBJECT ARRAY to the series using the  function SetData. (Well, it MUST be an OBJECT ARRAY, other types of  arrays does not work!)<br />
有不同的方法编制，并用OWC的数据。许多例子使用逗号分隔的值，例如2008年1月，2月不过，我更喜欢使用数组，您可以设置一个对象数组，该系列使用函数SetData。 （那么，它必须是一个对象数组，数组没有其他工作！）  <br />
Assuming that you have the graph values, you have to convert them to  object array. (I am lazy, so, I use LINQ.)Why do I use yyyy-MM-dd as  the format? The answer is simple, I don't want OWC to mix up dd/MM/yyyy  and mm/dd/yyyy.<br />
假设你有图形的价值观，你必须将它们转换为对象的数组。 （我很懒惰，所以，我使用LINQ。）为什么我使用YYYY - MM -作为格式日日？答案很简单，我不想OWC的混淆日/月/年和月/日/年。  </p>
<pre lang="vb.net"><font color="#0000ff">Dim XValues As New List(Of DateTime)<br />Dim YValues As New List(Of Double)</font></pre>
<p><font color="#0000ff"></font></p>
<pre lang="vb.net"><font color="#0000ff">Dim xObjects, yObjects As Object()<br />Dim tmp = From x In XValues Select CObj(x.ToString(&quot;yyyy-MM-dd&quot;))<br />xObjects = tmp.ToArray()<br />Dim tmp2 = From y In YValues Select CObj(y)<br />yObjects = tmp2.ToArray()</font></pre>
<p><br />
I prefer manual calculation for the maxima and minima of the y-Axis of the graph.<br />
我喜欢手工计算的最大值和最小值的Y -图的轴。  </p>
<pre lang="vb.net"><font color="#0000ff">'Determine maxima and minima of Y<br />Dim yMax As Decimal = YValues.Max()</font></pre>
<pre lang="vb.net"><font color="#0000ff">Dim yMin As Decimal = YValues.Min()<br />yMin = Math.Floor(yMin / 10) * 10 'Round the minimum to standard number<br />yMax = Math.Ceiling(yMax / 10) * 10 'Round the maximum to standard number</font></pre>
<pre lang="vb.net">Creating the Chart Body<br />创建图表机构</pre>
<p>In Windows application, pull a control named Microsoft Office Chart  11.0 from the toolbox, and it should be named AxChartSpace1 in the form.<br />
在Windows应用程序，拉从工具箱名为Microsoft Office图表11.0控制，并应名为形式AxChartSpace1。  <br />
Remove the charts in the control using the following code. (Why is there no Clear() method?)<br />
删除控件中的图表使用以下代码。 （为什么没有清除（）方法？）  <br />
If AxChartSpace1.Charts.Count &gt; 0 Then AxChartSpace1.Charts.Delete(0) <br />
The following code prepare the chart body. (Sorry, I am going to use lots of With statement here.)<br />
下面的代码编制图表机构。 （对不起，我会使用这里有许多的声明。）  <br />
<br />
<font color="#0000ff">Dim chart As ChChart = AxChartSpace1.Charts.Add()<br />
With chart<br />
.HasTitle = True<br />
.Title.Caption = &quot;Line Graph using date in x-axis&quot;<br />
.Title.Font.Name = &quot;Arial&quot;<br />
.Type = ChartChartTypeEnum.chChartTypeSmoothLine<br />
.PlotArea.Interior.SetSolid(&quot;White&quot;)<br />
End With</font> <br />
<br />
Series<br />
系列 <br />
We are going to set the Series data (The X, Y valeus data), using  the SetData commands.For X Axis, use  ChartDimensionsEnum.chDimCategories.For Y Axis, use  ChartDimensionsEnum.chDimValues.And then put the X, Y object values that  you have created earlier here.<br />
我们将设置系列数据（在X，Y valeus数据），使用使用SetData  commands.For  X轴，Y轴使用ChartDimensionsEnum.chDimCategories.For，使用 ChartDimensionsEnum.chDimValues.And然后将在X，Y的值对象你先前创建这里。  <br />
<br />
<font color="#0000ff">Dim series As ChSeries series = chart.SeriesCollection.Add(0)<br />
With series<br />
.Name = &quot;Series 1&quot;<br />
.Caption = &quot;Caption 1&quot;<br />
.SetData(ChartDimensionsEnum.chDimCategories, _<br />
ChartSpecialDataSourcesEnum.chDataLiteral, xObjects)<br />
.SetData(ChartDimensionsEnum.chDimValues, _<br />
ChartSpecialDataSourcesEnum.chDataLiteral, yObjects)<br />
.Line.Color = &quot;Blue&quot;<br />
.Line.Weight = LineWeightEnum.owcLineWeightThin<br />
End With</font> <br />
<br />
Data Labels<br />
数据标签 <br />
Sometimes you want to add data labels or markers to the graph.<br />
有时候你要添加数据标签或图形标记。<br />
<br />
<font color="#0000ff">With series<br />
.DataLabelsCollection.Add()<br />
.DataLabelsCollection(0).Font.Name = &quot;Verdana&quot;<br />
.DataLabelsCollection(0).Font.Size = 8<br />
.Marker.Style = ChartMarkerStyleEnum.chMarkerStyleCircle<br />
.Marker.Size = 6<br />
End With</font> <br />
<br />
Configuring X-Axis (Important)<br />
配置X轴（重要）  <br />
Recall that I encountered a strange problem when using date as  X-Axis. The problem is that the Y values are all summed up every 7 days.  This strange behavior can in fact be adjusted manually in the X-Axis,  after modifying the GroupingType, GroupingUnit and GroupingTotalFunction  properties. The default GroupingUnit is 1 week and the  GroupingTotalFunction is SUM. That's why such behavior is resulted when  nothing is set in advance. <br />
回想一下，我遇到了一个奇怪的问题，当使用日期为X轴。但问题是，Y值都总结了每7天。 这种奇怪的现象，其实可以手动调整X轴，后修改GroupingType，GroupingUnit和GroupingTotalFunction属性。 默认GroupingUnit是1个星期的GroupingTotalFunction是SUM。这就是为什么这种行为是在没有结果的预先设定。  <br />
I have seen many web examples use chart.Axes(0) as X-Axis. Personally, I  am not comfortable with it, please use  chart.Axes(ChartAxisPositionEnum.chAxisPositionCategory) instead.<br />
我见过很多网站的例子使用chart.Axes（0）为X轴。我个人不舒服，请使用chart.Axes（ChartAxisPositionEnum.chAxisPositionCategory）代替。  <br />
Also, to avoid the crowd tick in X-Axis, you can set the tick to display weekly but not daily.<br />
此外，为了避免人群蜱在X轴，您可以设置要显示的刻度每周而不是每天。  </p>
<pre lang="vb.net"><font color="#0000ff">With chart.Axes(ChartAxisPositionEnum.chAxisPositionCategory)<br />.HasTitle = True<br />.Title.Caption = &quot;Date&quot;<br />.Title.Font.Name = &quot;Arial&quot;<br />.Title.Font.Size = 8<br />.Font.Size = 8<br />.Font.Name = &quot;Arial&quot;<br />.NumberFormat = &quot;dd/MM/yy&quot;<br />.GroupingType = ChartAxisGroupingEnum.chAxisGroupingManual<br />.GroupingUnitType = ChartAxisUnitTypeEnum.chAxisUnitDay<br />.GroupingUnit = 1<br />.GroupingTotalFunction = ChartGroupingTotalFunctionEnum.chFunctionAvg<br />.TickLabelUnitType = ChartAxisUnitTypeEnum.chAxisUnitWeek<br />.TickMarkUnitType = ChartAxisUnitTypeEnum.chAxisUnitWeek<br />End With</font></pre>
<p><br />
Configuring Y-Axis<br />
配置Y -轴 <br />
The Y-Axis is straightforward, put the Maxima and Minma that you  have calculated earlier here. Also, set the major and minor grid lines.<br />
Y轴很简单，把Maxima和Minma你已经在这里前面计算。此外，设置主要和次要网格线。  <br />
For Y-Axis, use chart.Axes(ChartAxisPositionEnum.chAxisPositionValue).<br />
为Y轴，使用chart.Axes（ChartAxisPositionEnum.chAxisPositionValue）。  </p>
<pre lang="vb.net"><font color="#0000ff">With chart.Axes(ChartAxisPositionEnum.chAxisPositionValue)<br />.HasTitle = True<br />.Title.Caption = &quot;Price&quot;<br />.Title.Font.Name = &quot;Arial&quot;<br />.Title.Font.Size = 8<br />.Font.Size = 8<br />.Font.Name = &quot;Arial&quot;<br />.Scaling.Maximum = yMax<br />.Scaling.Minimum = yMin<br />.MajorUnit = 50<br />.MajorGridlines.Line.Color = &quot;Gray&quot;<br />.MinorUnit = 10<br />.MinorGridlines.Line.Color = &quot;LightGray&quot;<br />.MinorGridlines.Line.DashStyle = ChartLineDashStyleEnum.chLineSolid<br />.HasMinorGridlines = True<br />End With</font></pre>
<p><br />
Finish and Export<br />
完成进出口 <br />
If you have configured correctly, you should have seen a Line graph  with data point plotted every day, and a weekly X-Axis tick label. If  you would like to export your graph to a file, Microsoft provides an  easy way using the following code. You can set the rendering file format  (JPG, GIF) and the image size.<br />
如果您有配置正确，您应该看到一个数据点线图绘制，每天和每周一次的X轴刻度标签。如果你想你的图形输出到一个文件，Microsoft提供了一个简单的方法使用以下代码。您可以设置渲染文件格式（JPG，GIF）和图像的大小。  </p>
<pre lang="vb.net"><font color="#0000ff">Dim filePath As String = System.IO.Path.GetTempFileName() &amp; &quot;.gif&quot;<br />Dim chartBytes As Byte() = AxChartSpace1.GetPicture(&quot;GIF&quot;, 1280, 960)<br />System.IO.File.WriteAllBytes(filePath, chartBytes) 'Save to image<br />Dim process As New System.Diagnostics.Process()<br />process.Start(filePath)</font></pre>
<p><br />
Points of Interest<br />
兴趣点 <br />
I understand that it's difficult to use OWC at first, because OWC  does not have a comment in both functions and properties. Sometimes, I  have to open Microsoft Excel to understand what it means. Also, I have  tried hard to include the properties that would be used commonly in this  article, and hope it can help the beginner in OWC.<br />
据我所知，很难在第一次使用OWC的，因为OWC的没有在这两个函数和属性的评论。有时候，我要打开Microsoft Excel明白这意味着什么。此外，我曾努力，包括将用于本文中常用的属性，并希望能够帮助初学者在OWC的。  <br />
If you are using .NET 3.5, you can try &quot;Microsoft Chart Controls for Microsoft .NET Framework 3.5&quot; which is a new chart control written by Microsoft.<br />
如果您正在使用。NET 3.5，您可以尝试&ldquo;微软微软图表控件。NET框架3.5&rdquo;，这是一个新的图表控件微软写的。</p>…… [<a href="http://www.13com.net/article/article.asp?articleid=1127">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 15 Nov 2010 07:54:07 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1127</comments>
	</item>

	<item>
	<title><![CDATA[英文标点符号]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1126</link>
	<description><![CDATA[<SPAN style="FONT-SIZE: small"><SPAN style="FONT-SIZE: 14px">
<P><SPAN style="FONT-SIZE: 18pt"><FONT size=3>+　 plus　加号；正号<BR>-　 minus　减号；负号<BR>±　plus or minus　正负号<BR>×　is multiplied by　乘号<BR>÷　is divided by　除号<BR>＝　is equal to　等于号<BR>≠　is not equal to　不等于号<BR>≡　is equivalent to　全等于号<BR>≌　is equal to or approximately equal to　等于或约等于号<BR>≈　is approximately equal to　约等于号<BR>＜　is less than　小于号<BR>＞　is&nbsp;greater than　大于号<BR>≮　is not less than　不小于号<BR>≯　is not more than　不大于号<BR>≤　is less than or equal to　小于或等于号<BR>≥　is more than or equal to　大于或等于号<BR>%　 per cent　百分之…<BR>‰　per mill　千分之…<BR>∞　infinity　无限大号<BR>∝　varies as　与…成比例<BR>√　(square) root　平方根<BR>∵　since; because　因为<BR>∴　hence　所以<BR>∷　equals, as (proportion)　等于，成比例<BR>∠　angle　角<BR>⌒　semicircle　半圆<BR>⊙　circle　圆<BR>○　circumference　圆周<BR>π　pi 圆周率<BR>△　triangle　三角形<BR>⊥　perpendicular to　垂直于<BR>∪　union of　并，合集<BR>∩　intersection of 交，通集<BR>∫　the integral of …的积分<BR>∑　(sigma) summation of　总和<BR>°　degree　度<BR>′　minute　分<BR>″　second　秒<BR>℃　Celsius system　摄氏度<BR></FONT></SPAN><SPAN style="FONT-SIZE: 18pt"><FONT size=3>{　open brace, open curly　左花括号<BR>}　close brace, close curly　右花括号<BR>(　open parenthesis, open paren　左圆括号<BR>)　close parenthesis, close paren　右圆括号<BR>() brakets/ parentheses　括号<BR>[　open bracket 左方括号<BR>]　close bracket 右方括号<BR>[] square brackets　方括号<BR>.　period, dot　句号，点<BR>|　vertical bar, vertical virgule　竖线<BR>&amp;　ampersand, and, reference, ref　和，引用<BR>*　asterisk, multiply, star, pointer　星号，乘号，星，指针<BR>/　slash, divide, oblique 斜线，斜杠，除号<BR>//　slash-slash, comment 双斜线，注释符<BR>#　pound　井号<BR>\　backslash, sometimes escape　反斜线转义符，有时表示转义符或续行符<BR>~　tilde　波浪符<BR>.　full stop　句号<BR>,　comma　逗号<BR>:　colon　冒号<BR>;　semicolon　分号<BR>?　question mark　问号<BR>!　exclamation mark (英式英语) exclamation point (美式英语)<BR>'　apostrophe　撇号<BR>-　hyphen　连字号<BR>-- dash 破折号<BR>...　dots/ ellipsis　省略号<BR>"　single quotation marks 单引号<BR>""　double quotation marks 双引号<BR>‖ parallel 双线号<BR>&amp;　ampersand = and<BR>～　swung dash 代字号<BR>§　section; division 分节号<BR>→　arrow 箭号；参见号</FONT></SPAN></P></SPAN></SPAN>…… [<a href="http://www.13com.net/article/article.asp?articleid=1126">点击查看详细</a>] ]]></description>
	<pubDate>Sat, 9 Oct 2010 08:12:43 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1126</comments>
	</item>

	<item>
	<title><![CDATA[SQL注入漏洞全接触入门篇]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1125</link>
	<description><![CDATA[<P class=allcss>&nbsp;&nbsp; 随着B/S模式应用开发的发展，使用这种模式编写应用程序的程序员也越来越多。但是由于这个行业的入门门槛不高，程序员的水平及经验也参差不齐，相当大一部分程序员在编写代码的时候，没有对用户输入数据的合法性进行判断，使应用程序存在安全隐患。用户可以提交一段数据库查询代码，根据程序返回的结果，获得某些他想得知的数据，这就是所谓的SQL Injection，即SQL注入。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp; SQL注入是从正常的WWW端口访问，而且表面看起来跟一般的Web页面访问没什么区别，所以目前市面的防火墙都不会对SQL注入发出警报，如果管理员没查看IIS日志的习惯，可能被入侵很长时间都不会发觉。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;但是，SQL注入的手法相当灵活，在注入的时候会碰到很多意外的情况。能不能根据具体情况进行分析，构造巧妙的SQL语句，从而成功获取想要的数据，是高手与“菜鸟”的根本区别。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;根据国情，国内的网站用ASP+Access或SQLServer的占70%以上，PHP+MySQ占 L20%，其他的不足10%。在本文，我们从分入门、进阶至高级讲解一下ASP注入的方法及技巧，PHP注入的文章由NB联盟的另一位朋友zwell撰写，希望对安全工作者和程序员都有用处。了解ASP注入的朋友也请不要跳过入门篇，因为部分人对注入的基本判断方法还存在误区。大家准备好了吗？Let's Go...</P>
<H1>入 门 篇</H1>
<P class=allcss>&nbsp;&nbsp;&nbsp;如果你以前没试过SQL注入的话，那么第一步先把IE菜单=&gt;工具=&gt;Internet选项=&amp; gt;高级=&gt;显示友好 HTTP 错误信息前面的勾去掉。否则，不论服务器返回什么错误，IE都只显示为HTTP 500服务器错误，不能获得更多的提示信息。</P>
<H1>第一节、SQL注入原理</H1>
<P class=allcss>&nbsp;&nbsp;&nbsp;以下我们从一个网站www.19cn.com开始（注：本文发表前已征得该站站长同意，大部分都是真实数据）。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;在网站首页上，有名为“IE不能打开新窗口的多种解决方法”的链接，地址为：http://www.19cn.com/showdetail.asp?id=49，我们在这个地址后面加上单引号’，服务器会返回下面的错误提示：</P>
<P class=allcss>Microsoft JET Database Engine 错误 '80040e14' <BR>字符串的语法错误 在查询表达式 'ID=49'' 中。<BR>/showdetail.asp，行8</P>
<P class=allcss>从这个错误提示我们能看出下面几点：</P>
<P class=allcss>1.网站使用的是Access数据库，通过JET引擎连接数据库，而不是通过ODBC。<BR>2.程序没有判断客户端提交的数据是否符合程序要求。<BR>3.该SQL语句所查询的表中有一名为ID的字段。</P>
<P class=allcss>从上面的例子我们可以知道，ＳＱＬ注入的原理，就是从客户端提交特殊的代码，从而收集程序及服务器的信息，从而获取你想到得到的资料。</P>
<H2>第二节、判断能否进行ＳＱＬ注入</H2>
<P class=allcss>看完第一节，有一些人会觉得：我也是经常这样测试能否注入的，这不是很简单吗？其实，这并不是最好的方法，为什么呢？</P>
<P class=allcss>首先，不一定每台服务器的IIS都返回具体错误提示给客户端，如果程序中加了cint(参数)之类语句的话，ＳＱＬ注入是不会成功的，但服务器同样会报错，具体提示信息为处理 URL 时服务器上出错。请和系统管理员联络。</P>
<P class=allcss>其次，部分对ＳＱＬ注入有一点了解的程序员，认为只要把单引号过滤掉就安全了，这种情况不为少数，如果你用单引号测试，是测不到注入点的</P>
<P class=allcss>那么，什么样的测试方法才是比较准确呢？答案如下：</P>
<P class=allcss>① http://www.19cn.com/showdetail.asp?id=49<BR>② http://www.19cn.com/showdetail.asp?id=49 and 1=1<BR>③ http://www.19cn.com/showdetail.asp?id=49 and 1=2</P>
<P class=allcss>这就是经典的1=1、1=2测试法了，怎么判断呢？看看上面三个网址返回的结果就知道了：</P>
<P class=allcss>可以注入的表现：</P>
<P class=allcss>① 正常显示（这是必然的，不然就是程序有错误了）<BR>② 正常显示，内容基本与①相同<BR>③ 提示BOF或EOF（程序没做任何判断时）、或提示找不到记录（判断了rs.eof时）、或显示内容为空（程序加了on error resume next）</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;不可以注入就比较容易判断了，①同样正常显示，②和③一般都会有程序定义的错误提示，或提示类型转换时出错。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;当然，这只是传入参数是数字型的时候用的判断方法，实际应用的时候会有字符型和搜索型参数，我将在中级篇的“ＳＱＬ注入一般步骤”再做分析。</P>
<H1>第三节、判断数据库类型及注入方法</H1>
<P class=allcss>&nbsp;&nbsp;&nbsp;不同的数据库的函数、注入方法都是有差异的，所以在注入之前，我们还要判断一下数据库的类型。一般ASP最常搭配的数据库是Access和SQLServer，网上超过99%的网站都是其中之一。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;怎么让程序告诉你它使用的什么数据库呢？来看看：</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;SQLServer有一些系统变量，如果服务器IIS提示没关闭，并且SQLServer返回错误提示的话，那可以直接从出错信息获取，方法如下：</P>
<P class=allcss>http://www.19cn.com/showdetail.asp?id=49 and user&gt;0</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;这句语句很简单，但却包含了SQLServer特有注入方法的精髓，我自己也是在一次无意的测试中发现这种效率极高的猜解方法。让我看来看看它的含义：首先，前面的语句是正常的，重点在and user&gt;0，我们知道，user是SQLServer的一个内置变量，它的值是当前连接的用户名，类型为nvarchar。拿一个 nvarchar的值跟int的数0比较，系统会先试图将nvarchar的值转成int型，当然，转的过程中肯定会出错，SQLServer的出错提示是：将nvarchar值 ”abc” 转换数据类型为 int 的列时发生语法错误，呵呵，abc正是变量user的值，这样，不废吹灰之力就拿到了数据库的用户名。在以后的篇幅里，大家会看到很多用这种方法的语句。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;顺便说几句，众所周知，SQLServer的用户sa是个等同Adminstrators权限的角色，拿到了 sa权限，几乎肯定可以拿到主机的Administrator了。上面的方法可以很方便的测试出是否是用sa登录，要注意的是：如果是sa登录，提示是将”dbo”转换成int的列发生错误，而不是”sa”。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;如果服务器IIS不允许返回错误提示，那怎么判断数据库类型呢？我们可以从Access和SQLServer 和区别入手，Access和SQLServer都有自己的系统表，比如存放数据库中所有对象的表，Access是在系统表[msysobjects]中，但在Web环境下读该表会提示“没有权限”，SQLServer是在表[sysobjects]中，在Web环境下可正常读取。</P>
<P class=allcss>在确认可以注入的情况下，使用下面的语句：</P>
<P class=allcss>http://www.19cn.com/showdetail.asp?id=49 and (select count(*) from sysobjects)&gt;0<BR>http://www.19cn.com/showdetail.asp?id=49 and (select count(*) from msysobjects)&gt;0</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;如果数据库是SQLServer，那么第一个网址的页面与原页面http://www.19cn.com /showdetail.asp?id=49是大致相同的；而第二个网址，由于找不到表msysobjects，会提示出错，就算程序有容错处理，页面也与原页面完全不同。</P>
<P class=allcss>&nbsp;&nbsp;&nbsp;如果数据库用的是Access，那么情况就有所不同，第一个网址的页面与原页面完全不同；第二个网址，则视乎数据库设置是否允许读该系统表，一般来说是不允许的，所以与原网址也是完全不同。大多数情况下，用第一个网址就可以得知系统所用的数据库类型，第二个网址只作为开启IIS错误提示时的验证。</P>
<H1>第一节、SQL注入的一般步骤</H1>
<P class=allcss>首先，判断环境，寻找注入点，判断数据库类型，这在入门篇已经讲过了。</P>
<P class=allcss>其次，根据注入参数类型，在脑海中重构SQL语句的原貌，按参数类型主要分为下面三种：</P>
<P class=allcss>(A) ID=49 这类注入的参数是数字型，SQL语句原貌大致如下：<BR>Select * from 表名 where 字段=49<BR>注入的参数为ID=49 And [查询条件]，即是生成语句：<BR>Select * from 表名 where 字段=49 And [查询条件]</P>
<P class=allcss>(B) Class=连续剧 这类注入的参数是字符型，SQL语句原貌大致概如下：<BR>Select * from 表名 where 字段=’连续剧’ <BR>注入的参数为Class=连续剧’ and [查询条件] and ‘’=’ ，即是生成语句：<BR>Select * from 表名 where 字段=’连续剧’ and [查询条件] and ‘’=’’</P>
<P class=allcss>(C) 搜索时没过滤参数的，如keyword=关键字，SQL语句原貌大致如下：<BR>Select * from 表名 where 字段like ’%关键字%’ <BR>注入的参数为keyword=’ and [查询条件] and ‘%25’=’， 即是生成语句：<BR>Select * from 表名 where字段like ’%’ and [查询条件] and ‘%’=’%’</P>
<P class=allcss>接着，将查询条件替换成SQL语句，猜解表名，例如：</P>
<P class=allcss>ID=49 And (Select Count(*) from Admin)&gt;=0</P>
<P class=allcss>如果页面就与ID=49的相同，说明附加条件成立，即表Admin存在，反之，即不存在（请牢记这种方法）。如此循环，直至猜到表名为止。</P>
<P class=allcss>表名猜出来后，将Count(*)替换成Count(字段名)，用同样的原理猜解字段名。</P>
<P class=allcss>有人会说：这里有一些偶然的成分，如果表名起得很复杂没规律的，那根本就没得玩下去了。说得很对，这世界根本就不存在100%成功的黑客技术，苍蝇不叮无缝的蛋，无论多技术多高深的黑客，都是因为别人的程序写得不严密或使用者保密意识不够，才有得下手。</P>
<P class=allcss>有点跑题了，话说回来，对于SQLServer的库，还是有办法让程序告诉我们表名及字段名的，我们在高级篇中会做介绍。</P>
<P class=allcss>最后，在表名和列名猜解成功后，再使用SQL语句，得出字段的值，下面介绍一种最常用的方法－Ascii逐字解码法，虽然这种方法速度很慢，但肯定是可行的方法。</P>
<P class=allcss>我们举个例子，已知表Admin中存在username字段，首先，我们取第一条记录，测试长度：</P>
<P class=allcss>http://www.19cn.com/showdetail.asp?id=49 and (select top 1 len(username) from Admin)&gt;0</P>
<P class=allcss>先说明原理：如果top 1的username长度大于0，则条件成立；接着就是&gt;1、&gt;2、&gt;3这样测试下去，一直到条件不成立为止，比如&gt;7成立，&gt;8不成立，就是len(username)=8</P>
<P class=allcss>当然没人会笨得从0,1,2,3一个个测试，怎么样才比较快就看各自发挥了。在得到username的长度后，用mid(username,N,1)截取第N位字符，再asc(mid(username,N,1))得到ASCII码，比如：</P>
<P class=allcss>id=49 and (select top 1 asc(mid(username,1,1)) from Admin)&gt;0</P>
<P class=allcss>同样也是用逐步缩小范围的方法得到第1位字符的ASCII码，注意的是英文和数字的ASCII码在1-128之间，可以用折半法加速猜解，如果写成程序测试，效率会有极大的提高。</P>
<H1>第二节、SQL注入常用函数</H1>
<P class=allcss>有SQL语言基础的人，在SQL注入的时候成功率比不熟悉的人高很多。我们有必要提高一下自己的SQL水平，特别是一些常用的函数及命令。</P>
<P class=allcss>Access：asc(字符) SQLServer：unicode(字符)<BR>作用：返回某字符的ASCII码</P>
<P class=allcss>Access：chr(数字) SQLServer：nchar(数字)<BR>作用：与asc相反，根据ASCII码返回字符</P>
<P class=allcss>Access：mid(字符串,N,L) SQLServer：substring(字符串,N,L)<BR>作用：返回字符串从N个字符起长度为L的子字符串，即N到N+L之间的字符串</P>
<P class=allcss>Access：abc(数字) SQLServer：abc (数字)<BR>作用：返回数字的绝对值（在猜解汉字的时候会用到）</P>
<P class=allcss>Access：A between B And C SQLServer：A between B And C<BR>作用：判断A是否界于B与C之间</P>
<H1>第三节、中文处理方法</H1>
<P class=allcss>在注入中碰到中文字符是常有的事，有些人一碰到中文字符就想打退堂鼓了。其实只要对中文的编码有所了解，“中文恐惧症”很快可以克服。</P>
<P class=allcss>先说一点常识：</P>
<P class=allcss>Access中，中文的ASCII码可能会出现负数，取出该负数后用abs()取绝对值，汉字字符不变。</P>
<P class=allcss>SQLServer中，中文的ASCII为正数，但由于是UNICODE的双位编码，不能用函数ascii()取得ASCII码，必须用函数unicode ()返回unicode值，再用nchar函数取得对应的中文字符。</P>
<P class=allcss>看完入门篇和进阶篇后，稍加练习，破解一般的网站是没问题了。但如果碰到表名列名猜不到，或程序作者过滤了一些特殊字符，怎么提高注入的成功率？怎么样提高猜解效率？请大家接着往下看高级篇。</P>
<H1>第一节、利用系统表注入SQLServer数据库</H1>
<P class=allcss>SQLServer是一个功能强大的数据库系统，与操作系统也有紧密的联系，这给开发者带来了很大的方便，但另一方面，也为注入者提供了一个跳板，我们先来看看几个具体的例子：</P>
<P class=allcss>① http://Site/url.asp?id=1;exec master..xp_cmdshell “net user name password /add”--</P>
<P class=allcss>　　分号;在SQLServer中表示隔开前后两句语句，--表示后面的语句为注释，所以，这句语句在 SQLServer中将被分成两句执行，先是Select出ID=1的记录，然后执行存储过程xp_cmdshell，这个存储过程用于调用系统命令，于是，用net命令新建了用户名为name、密码为password的windows的帐号，接着：</P>
<P class=allcss>② http://Site/url.asp?id=1;exec master..xp_cmdshell “net localgroup name administrators /add”--</P>
<P class=allcss>　　将新建的帐号name加入管理员组，不用两分钟，你已经拿到了系统最高权限！当然，这种方法只适用于用sa连接数据库的情况，否则，是没有权限调用xp_cmdshell的。</P>
<P class=allcss>　　③ http://Site/url.asp?id=1 ;;and db_name()&gt;0</P>
<P class=allcss>前面有个类似的例子and user&gt;0，作用是获取连接用户名，db_name()是另一个系统变量，返回的是连接的数据库名。</P>
<P class=allcss>④ http://Site/url.asp?id=1;backup database 数据库名 to disk=’c:\inetpub\wwwroot\1.db’;--</P>
<P class=allcss>这是相当狠的一招，从③拿到的数据库名，加上某些IIS出错暴露出的绝对路径，将数据库备份到Web目录下面，再用 HTTP把整个数据库就完完整整的下载回来，所有的管理员及用户密码都一览无遗！在不知道绝对路径的时候，还可以备份到网络地址的方法（如\\202.96.xx.xx\Share\1.db），但成功率不高。</P>
<P class=allcss>　　⑤ http://Site/url.asp?id=1 ;;and (Select Top 1 name from sysobjects where xtype=’U’ and status&gt;0)&gt;0</P>
<P class=allcss>前面说过，sysobjects是SQLServer的系统表，存储着所有的表名、视图、约束及其它对象，xtype=’U’ and status&gt;0，表示用户建立的表名，上面的语句将第一个表名取出，与0比较大小，让报错信息把表名暴露出来。第二、第三个表名怎么获取？还是留给我们聪明的读者思考吧。</P>
<P class=allcss>⑥ http://Site/url.asp?id=1 ;;and (Select Top 1 col_name(object_id(‘表名’),1) from sysobjects)&gt;0</P>
<P class=allcss>从⑤拿到表名后，用object_id(‘表名’)获取表名对应的内部ID，col_name(表名ID,1)代表该表的第1个字段名，将1换成2,3,4...就可以逐个获取所猜解表里面的字段名。</P>
<P class=allcss>　　以上6点是我研究SQLServer注入半年多以来的心血结晶，可以看出，对SQLServer的了解程度，直接影响着成功率及猜解速度。在我研究SQLServer注入之后，我在开发方面的水平也得到很大的提高，呵呵，也许安全与开发本来就是相辅相成的吧。</P>
<H1>第二节、绕过程序限制继续注入</H1>
<P class=allcss>在入门篇提到，有很多人喜欢用’号测试注入漏洞，所以也有很多人用过滤’号的方法来“防止”注入漏洞，这也许能挡住一些入门者的攻击，但对ＳＱＬ注入比较熟悉的人，还是可以利用相关的函数，达到绕过程序限制的目的。</P>
<P class=allcss>在“ＳＱＬ注入的一般步骤”一节中，我所用的语句，都是经过我优化，让其不包含有单引号的；在“利用系统表注入SQLServer数据库”中，有些语句包含有’号，我们举个例子来看看怎么改造这些语句：</P>
<P class=allcss>简单的如where xtype=’U’，字符U对应的ASCII码是85，所以可以用where xtype=char(85)代替；如果字符是中文的，比如where name=’用户’，可以用where name=nchar(29992)+nchar(25143)代替。</P>
<H1>第三节、经验小结</H1>
<P class=allcss>1.有些人会过滤Select、Update、Delete这些关键字，但偏偏忘记区分大小写，所以大家可以用selecT这样尝试一下。</P>
<P class=allcss>2.在猜不到字段名时，不妨看看网站上的登录表单，一般为了方便起见，字段名都与表单的输入框取相同的名字。</P>
<P class=allcss>3.特别注意：地址栏的+号传入程序后解释为空格，%2B解释为+号，%25解释为%号，具体可以参考URLEncode的相关介绍。</P>
<P class=allcss>4.用Get方法注入时，IIS会记录你所有的提交字符串，对Post方法做则不记录，所以能用Post的网址尽量不用Get。</P>
<P class=allcss>5. 猜解Access时只能用Ascii逐字解码法，SQLServer也可以用这种方法，只需要两者之间的区别即可，但是如果能用SQLServer的报错信息把值暴露出来，那效率和准确率会有极大的提高。</P>
<H1>防 范 方 法</H1>
<P class=allcss>ＳＱＬ注入漏洞可谓是“千里之堤，溃于蚁穴”，这种漏洞在网上极为普遍，通常是由于程序员对注入不了解，或者程序过滤不严格，或者某个参数忘记检查导致。在这里，我给大家一个函数，代替ASP中的Request函数，可以对一切的SQL注入Say NO，函数如下：</P>
<P class=allcss><BR>Function SafeRequest(ParaName,ParaType)<BR>'--- 传入参数 ---<BR>'ParaName:参数名称-字符型<BR>'ParaType:参数类型-数字型(1表示以上参数是数字，0表示以上参数为字符)</P>
<P class=allcss>Dim ParaValue<BR>ParaValue=Request(ParaName)<BR>If ParaType=1 then<BR>If ParaValue="" or not isNumeric(ParaValue) then<BR>Response.write "参数" &amp; ParaName &amp; "必须为数字型！"<BR>Response.end<BR>End if<BR>Else<BR>ParaValue=replace(ParaValue,"'","''")<BR>End if<BR>SafeRequest=ParaValue<BR>End function</P>
<P class=allcss>文章到这里就结束了，不管你是安全人员、技术爱好者还是程序员，我都希望本文能对你有所帮助。</P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1125">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 30 Aug 2010 07:51:00 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1125</comments>
	</item>

	<item>
	<title><![CDATA[如何修改数据库的服务器名称 ]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1124</link>
	<description><![CDATA[<P>最近我要在SQL Server 2008上做数据库复制的实验，需要用到两台服务器，所以我需要同时开2个虚拟机（VPC），当然我不可能去单独安装2个SQL Server，安装过程太费时了，所以我是在一个虚拟机中安装了SQL2008，然后将该虚拟机文件复制了一个出来，然后还原成另外一个虚拟机，这样我就可以同时使用2个虚拟机来做复制的实验了。我先在虚拟机SQL2008RC0中安装了Windows2003操作系统，机器名为MS-ZY，然后安装 SQL Server 2008，所以数据库的服务器名也就是MS-ZY。</P>
<P><A href="/article/userfiles/20100830154930166.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=251 alt=clip_image001 src="/article/userfiles/20100830154931332.jpg" width=377 border=0></A></P>
<P>接下来复制过去还原成虚拟机SQL2008RC02，当两个虚拟机都打开的情况下，如果都是MS-ZY的服务器名，那将无法识别，所以我将第二个虚拟机的机器名修改为MS-ZY2。这个我就可以使用SSMS通过这个名字来访问第二个数据库了。</P>
<P><A href="/article/userfiles/20100830154931358.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=249 alt=clip_image001[6] src="/article/userfiles/20100830154931313.jpg" width=374 border=0></A></P>
<P>一起看起来都不错，已经将这两个服务器通过名字分开了，而且我们通过SSMS也的确看到了2个不同的服务器：</P>
<P><A href="/article/userfiles/20100830154931651.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=347 alt=clip_image001[8] src="/article/userfiles/20100830154931945.jpg" width=376 border=0></A></P>
<P>但是在配置复制的时候却出了问题，我在MS-ZY上配置了数据库分发，配置成功，接下来想在MS-ZY2上配置订阅，可是却报错。于是我就试一下在MS-ZY2上配置分发，同样报错，报错内容为：</P>
<P><A href="/article/userfiles/20100830154931734.jpg"><IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=126 alt=clip_image001[10] src="/article/userfiles/20100830154932590.jpg" width=464 border=0></A></P>
<P>显然，我虽然在操作系统中将机器名修改为MS-ZY2了，但是在数据库中仍然使用的MS-ZY作为服务器名。怎么办呢唯一的办法就是修改数据库的服务器名。</P>
<P>请教了一下公司的同事，具体修改过程：</P>
<P>1.使用select @@ServerName可以看到当前数据库的服务器名，果然还是MS-ZY！</P>
<P>2.从Sys.SysServers表中可以看到当前的所有服务器名，也是MS-ZY！</P>
<P>3.使用 sp_dropserver 'MS-ZY' 将这个服务器名删除。</P>
<P>4.使用 sp_addserver 'MS-ZY2','LOCAL'将本地服务器重新添加到服务器表中，并且命名为MS-ZY2.</P>
<P>5.查询Sys.SysServers表，果然已经修改了。</P>
<P>6.重启数据库服务，修改完成，可以正常使用复制功能了 :)</P>
<P>其实操作还是十分的简单，但是由于修改服务器名这种情况实在太少见了，一般都是使用默认的，所以很多人都不知道如果修改，写下此文，希望对遇到和我相同问题的人有所帮助。</P>
<P>&nbsp;</P>…… [<a href="http://www.13com.net/article/article.asp?articleid=1124">点击查看详细</a>] ]]></description>
	<pubDate>Mon, 30 Aug 2010 07:49:33 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1124</comments>
	</item>

	<item>
	<title><![CDATA[APK反编译过程及用到的工具]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1123</link>
	<description><![CDATA[<DIV id=blog_text>
<P><FONT face=Calibri>一、</FONT>用<FONT face=Calibri>.rar</FONT>打开<FONT face=Calibri>apk</FONT>文档，得到文档结构图如下所示</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <IMG src="/article/userfiles/20100827131458248.jpg" border=0></P>
<P></P>
<P><FONT face=Calibri>二、</FONT>将<FONT face=Calibri>classes.dex</FONT>文件解压出来，然后使用工具反编译成<FONT face=Calibri>.jar</FONT>文件，再进一步反编译出<FONT face=Calibri>java</FONT>文件</P>
<P><FONT face=Calibri>1.</FONT>在<FONT face=Calibri>cmd</FONT>下进入<FONT face=Calibri>dex2jar.bat</FONT>所在路径，然后输入<FONT face="Times New Roman"><STRONG>“dex2jar.bat XXX”，XXX</STRONG></FONT>指的是你要反编译的<FONT face=Calibri>apk</FONT>中的<FONT face=Calibri>classes.dex</FONT>文件所在路径及名称，比如：我的<FONT face=Calibri>dex2jar.bat</FONT>在<FONT face=Calibri>D:\Android\apk_decode\dex2jar-0.0.7-SNAPSHOT</FONT>路径下<FONT face=Calibri>, classes.dex</FONT>在<FONT face=Calibri>D:\Android</FONT>下，所以：<FONT face=Calibri> </FONT>你进入<FONT face=Calibri>dex2jar.bat</FONT>路径下后，输入<FONT face="Times New Roman"><STRONG>dex2jar.bat D:\Android\classes.dex</STRONG></FONT>，这样会生成一个<FONT face=Calibri>jar</FONT>文件。</P>
<P><FONT face=Calibri>2.</FONT>用<FONT face=Calibri>rar</FONT>解压出<FONT face=Calibri>jar</FONT>文件中的<FONT face=Calibri>class</FONT>文件，然后用<FONT face=Calibri>jad</FONT>或<FONT face=Calibri>DJ Java Decompiler</FONT>反编译工具将<FONT face=Calibri>.class</FONT>文件反编译成<FONT face=Calibri>.java</FONT>文件</P>
<P><FONT face=Calibri>3.</FONT>不解压出<FONT face=Calibri>jar</FONT>中的<FONT face=Calibri>class</FONT>文件，直接用<FONT face=Calibri>JD GUI</FONT>工具打开<FONT face=Calibri>jar</FONT>文件</P>
<P><FONT face=Calibri>4.</FONT>步骤<FONT face=Calibri>2</FONT>和<FONT face=Calibri>3</FONT>选择其中一个即可，建议用步骤<FONT face=Calibri>2</FONT>，步骤<FONT face=Calibri>3</FONT>可能出现乱码</P>
<P><FONT face=Calibri>三、</FONT>上面操作只能得到<FONT face=Calibri>class</FONT>文件，下面利用<FONT face=Calibri>Google</FONT>提供的<FONT face=Calibri>apktool</FONT>得到<FONT face=Calibri>xml</FONT>文件</P>
<P><FONT face=Calibri>1. </FONT>下载<FONT face=Calibri>apktool</FONT>，可以去<FONT face=Calibri>Google</FONT>的官方下载，地址：<A href="http://code.google.com/p/android-apktool/"><FONT face="Times New Roman"><STRONG>http://code.google.com/p/android-apktool/</STRONG></FONT></A>得，<FONT face="Times New Roman"><STRONG>apktool-1.0.0.tar.bz2和apktool-install-windows-2.1_r01-1.zip</STRONG></FONT>两个包都要下。解压<FONT face=Calibri>apktool.jar</FONT>到<FONT face=Calibri> C:\Windows </FONT>，解压<FONT face=Calibri>apktool-install-windows.zip</FONT>到任意文件夹<FONT face=Calibri>(</FONT>例如<FONT face=Calibri>E</FONT>盘根目录<FONT face=Calibri>)</FONT>。</P>
<P><FONT face=Calibri>2. </FONT><FONT face=Calibri>Win+R </FONT>运行<FONT face=Calibri>CMD</FONT>，用<FONT face=Calibri>cd</FONT>命令转到<FONT face=Calibri>apktool-install-windows</FONT>所在文件夹，输入<FONT face=Calibri>apktool</FONT>看看。会列出一些帮助的话就成功了（解释<FONT face=Calibri>d</FONT>为加压<FONT face=Calibri> </FONT>第一个路径为你的<FONT face=Calibri>apk</FONT>所在的位置。第二个是要输出的位置）</P>
<P align=left><FONT face="Times New Roman"><STRONG><FONT color=#ff0000>apktool d XXX.apk ABC&nbsp;&nbsp;&nbsp; <EM>反编译XXX.apk到文件夹ABC</EM></FONT></STRONG></FONT></P>
<P><FONT face=Calibri>3. </FONT>在解压后的文件夹中可以得到<FONT face=Calibri>apk</FONT>的<FONT face=Calibri>xml</FONT>配置文件</P>
<P>四、将“二”中得到的<FONT face=Calibri>class</FONT>文件和“三”中得到的<FONT face=Calibri>xml</FONT>文件组合成一个<FONT face=Calibri>android</FONT>工程，即可得到完整的<FONT face=Calibri>apk</FONT>源码。</P>
<P>apktool下载：<A style="FONT-SIZE: 140%" onclick="generateDownloadEvent(); return true;" href="http://android-apktool.googlecode.com/files/apktool-install-windows-2.2_r01-2.tar.bz2"><FONT style="FONT-SIZE: 13px" color=#0000ff size=5>apktool-install-windows-2.2_r01-2.tar.bz2</FONT></A><BR>dex2jar下载：<A href="http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip">http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip</A></P></DIV>…… [<a href="http://www.13com.net/article/article.asp?articleid=1123">点击查看详细</a>] ]]></description>
	<pubDate>Fri, 27 Aug 2010 05:22:40 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1123</comments>
	</item>

	<item>
	<title><![CDATA[摩托罗拉 Droid 2 拆解]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1122</link>
	<description><![CDATA[<P align=center><A href="http://news.mydrivers.com/Img/20100813/04185354.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185818246.jpg"></A><BR>零售版包装盒</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04185409.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185820726.jpg"></A><BR>左侧为原版Droid，右侧为新的Droid 2，可以看到两款机型外观的差别</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04185464.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185821600.jpg"></A><BR>背部对比，金色的装饰条换成了新的银色</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04185520.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185823245.jpg"></A><BR>左侧为iPhone 4，右侧为Droid 2</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04194698.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185824931.jpg"></A><BR>厚度对比，如果不算全键盘的话，Droid 2还是一款很薄的手机</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04194746.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04194746.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04194807.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04194807.jpg"></A><BR>拆下电池盖并取出电池</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04194875.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04194875.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04194937.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185830991.jpg"></A><BR>Droid 2使用的1390 mAh锂离子电池，可以提供9.5小时通话时间</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04204254.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04204254.jpg"></A><BR>Droid 2预装有一个8GB的MicroSD存储卡</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04204310.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04204310.jpg"></A><BR>撬开背部的金属装饰条</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04204370.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04204370.jpg"></A><BR>撕开电池仓底部的贴纸</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04204431.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04204431.jpg"></A><BR>镜头附近的塑料盖也需要翘起</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04204492.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04204492.jpg"></A><BR>现在就可以发现隐藏的螺丝</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04213803.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04213803.jpg"></A><BR>拆下螺丝之后，需要只用撬棒将使用卡扣连接的前后机身分开</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04213867.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04213867.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04213928.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04213928.jpg"></A><BR>五个金属条和对应的接触点，给耳机插孔进行信号传输</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04213992.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04213992.jpg"></A><BR>底部话筒单元可以单手取下</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04214051.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185848708.jpg"></A><BR>这样的话筒看起来和Droid为同一型号，得益于摩托罗拉的噪音消除技术，其手机的通话质量一直得到用户的称赞</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04223482.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185849457.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04223534.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04223534.jpg"></A><BR>下面进行的是主板部分</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04223598.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04223598.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04223664.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04223664.jpg"></A><BR>断开扬声器单元使用的排线</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04223728.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04223728.jpg"></A><BR>卸下螺丝</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04240201.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04240201.jpg"></A><BR>小心的翘起主板，注意下方的键盘连接线</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04240270.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04240270.jpg"></A><BR>这就是Droid 2的主板，其最值得炫耀的部分</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04240329.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04240329.jpg"></A><BR>黄色部分为高通QSC6085 CDMA芯片，红色部分为尔必达K4332C1PD-50-F，德州仪器OMAP 3630处理器有可能就在这下面，橙色部分为Numonyx NANDA9R4N4 1 Gbit (x16) NAND和DDR 512 Mbits (x16) LPSDRAM，就是Droid 2的ROM和RAM芯片，绿色部分为AKM 8973N 019A电子罗盘芯片，蓝色部分为S202 7927麦克风<SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Arial,'Trebuchet MS','Bitstream Vera Sans',sans-serif; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="TEXT-ALIGN: left; LINE-HEIGHT: 18px; FONT-SIZE: 12px" class=Apple-style-span></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P align=center><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span></SPAN></SPAN></SPAN><A href="http://news.mydrivers.com/Img/20100813/04240414.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04240414.jpg"></A><BR>红色部分为SanDisk的SDIN4C2 8GB NAND存储芯片， 橙色部分为TriQuint的TQM613029 CDMA双工放大器，黄色部分为Avago的FEM-7758 CDMA前端模块，蓝色部分为德州仪器51001582002电源管理IC，绿色部分为德州仪器WL1271B无线/蓝牙/FM芯片<SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN class=Apple-converted-space><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04240498.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04240498.jpg"></A><BR>红色部分为意法半导体的G 40N 025，旁边是不明用途的OST芯片<SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=Apple-style-span><SPAN style="FONT-FAMILY: arial; FONT-SIZE: 13px" class=Apple-style-span></SPAN></SPAN></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04250146.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04250146.jpg"></A><BR>Droid 2的500万像素摄像头和LED闪光灯</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04250215.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04250215.jpg"></A><BR>先断开天线连接器和连接震动电机的排线，准备拆下触摸屏</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04250281.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04250281.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04250342.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185922407.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04250392.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04250392.jpg"></A><BR>分离时要注意排线</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04255968.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04255968.jpg"></A><BR>继续拆下剩余的螺丝</P>
<DIV id=ArticleCnt>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04260032.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04260032.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04260093.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04260093.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04260159.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185932550.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04260212.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04260212.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04263364.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="/article/userfiles/20100813185936855.jpg"></A><BR>触摸屏面板成功拆下</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04263412.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04263412.jpg"></A><BR>QWERTY全键盘与滑动支架连接在一起</P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04263475.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04263475.jpg"></A></P>
<P align=center><A href="http://news.mydrivers.com/Img/20100813/04265581.jpg" target=_blank><IMG style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" alt="摩托罗拉雄起之作  Droid 2首发拆解" src="http://news.mydrivers.com/Img/20100813/S04265581.jpg" width=550 height=412></A><BR>全家福，现在最头疼的就是怎么组装起来</P></DIV>…… [<a href="http://www.13com.net/article/article.asp?articleid=1122">点击查看详细</a>] ]]></description>
	<pubDate>Fri, 13 Aug 2010 11:01:48 GMT</pubDate>
	<comments>http://www.13com.net/article/review.asp?articleid=1122</comments>
	</item>

	<item>
	<title><![CDATA[swing组件介绍]]></title>
	<link>http://www.13com.net/article/article.asp?articleid=1121</link>
	<description><![CDATA[<p>学习swing组件,主要有三个内容 <br />
  一是组件的显示,二是对组件支持的事件进行侦听,三是是自定义组件 <br />
  1.JFrame <br />
  JFrame是主窗口,它和JDialog,JApplet的地位并列.但是,一个JFrame可以添加JDialog和JApplet进去它的内容面板,而反过来就不行 <br />
  下面来看JFrame的例子 <br />
  ================================================= <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class  JFrameDemo <br />
  { <br />
  JFrame mainFrame; <br />
  public JFrameDemo() { <br />
  mainFrame = new JFrame ( &quot;JFrameDemo Title&quot; ); //创建一个JFrame <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );//设置关闭动作 <br />
  mainFrame.setSize( 300,300 );//设置窗口大小 <br />
  mainFrame.setLocationRelativeTo(null);//使窗口显示在屏幕中央 <br />
  <br />
  mainFrame.addWindowListener( new WindowListener(){ <br />
  public void windowOpened( WindowEvent e ){ System.out.println( &quot;window opened&quot; ); } <br />
  public void windowClosing( WindowEvent e ){ System.out.println( &quot;window closing&quot; ); } <br />
  public void windowClosed( WindowEvent e ){ System.out.println( &quot;window closed&quot; ); } <br />
  public void windowIconified( WindowEvent e ){ System.out.println( &quot;window iconified&quot; ); } <br />
  public void windowDeiconified( WindowEvent e ){ System.out.println( &quot;window deiconified&quot; ); } <br />
  public void windowActivated( WindowEvent e ){ System.out.println( &quot;window activated&quot; ); } <br />
  public void windowDeactivated( WindowEvent e ){ System.out.println( &quot;window deactivated&quot; ); } <br />
  }); <br />
  mainFrame.addWindowFocusListener( new WindowFocusListener(){ <br />
  public void windowGainedFocus( WindowEvent e ){ System.out.println( &quot;gained focus&quot; ); } <br />
  public void windowLostFocus( WindowEvent e ){ System.out.println( &quot;lost focus&quot; ); } <br />
  }); <br />
  mainFrame.addWindowStateListener( new WindowStateListener(){ <br />
  public void windowStateChanged( WindowEvent e ){ System.out.println( &quot;state changed&quot; ); } <br />
  }); <br />
  <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JFrameDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class  JFrameDemo<br />
  {<br />
  JFrame mainFrame;<br />
  public JFrameDemo() {<br />
  mainFrame = new JFrame ( &quot;JFrameDemo Title&quot; ); //创建一个JFrame <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );//设置关闭动作<br />
  mainFrame.setSize( 300,300 );//设置窗口大小<br />
  mainFrame.setLocationRelativeTo(null);//使窗口显示在屏幕中央</p>
<p> mainFrame.addWindowListener( new WindowListener(){<br />
  public void windowOpened( WindowEvent e ){ System.out.println( &quot;window opened&quot; ); }<br />
  public void windowClosing( WindowEvent e ){ System.out.println( &quot;window closing&quot; ); }<br />
  public void windowClosed( WindowEvent e ){ System.out.println( &quot;window closed&quot; ); }<br />
  public void windowIconified( WindowEvent e ){ System.out.println( &quot;window iconified&quot; ); }<br />
  public void windowDeiconified( WindowEvent e ){ System.out.println( &quot;window deiconified&quot; ); }<br />
  public void windowActivated( WindowEvent e ){ System.out.println( &quot;window activated&quot; ); }<br />
  public void windowDeactivated( WindowEvent e ){ System.out.println( &quot;window deactivated&quot; ); }<br />
  });<br />
  mainFrame.addWindowFocusListener( new WindowFocusListener(){<br />
  public void windowGainedFocus( WindowEvent e ){ System.out.println( &quot;gained focus&quot; ); }<br />
  public void windowLostFocus( WindowEvent e ){ System.out.println( &quot;lost focus&quot; ); }<br />
  });<br />
  mainFrame.addWindowStateListener( new WindowStateListener(){<br />
  public void windowStateChanged( WindowEvent e ){ System.out.println( &quot;state changed&quot; ); }<br />
  });</p>
<p> mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JFrameDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>========================================================== <br />
  这里出现了三个不同的窗口事件侦听器,并实现了它们所有的方法 <br />
  WindowListener和WindowFocusListener都可以对窗口失去,获得焦点进行侦听,不同的是,非帧窗口和对话框窗口不能接收WindowListener的windowActivated和windodwDeactivated事件 <br />
  虽然可以用WindowListener对窗口的一些状态进行侦听,但是WindowStateListener提供了更多的支持.例如,WindowStateListener可以处理还原窗口的事件,可以判断一个窗口是不是在垂直和水平两个方向都可以最大化(命令提示符窗口只可以在垂直方向上最大化),而这些都是WindowListener都无能为力 <br />
  2.JLabel <br />
  JLabel是一标签.在它的文本里嵌入html标签,可以简单实现一个超链接组件 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import java.io.*; <br />
  class  JLabelDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JLabel simpleLabel; <br />
  public JLabelDemo() { <br />
  mainFrame = new JFrame ( &quot;JLabelDemo&quot; ); <br />
  simpleLabel = new JLabel (&quot;&lt;html&gt;&lt;a href=aaa&gt;百度搜索&lt;/a&gt;&lt;/html&gt;&quot;);//嵌入了html标签 <br />
  simpleLabel.addMouseListener( new MouseAdapter(){//添加鼠标事件侦听器,当单击标签时,打开网页 <br />
  public void mouseClicked( MouseEvent e ){ <br />
  try{ <br />
  Runtime.getRuntime().exec(&quot;cmd /c start http://www.baidu.com&quot;); <br />
  }catch( IOException ee ){ <br />
  ee.printStackTrace(); <br />
  } <br />
  } <br />
  }); <br />
  simpleLabel.setCursor( new Cursor(Cursor.HAND_CURSOR) );//设置手形鼠标 <br />
  mainFrame.getContentPane().add( simpleLabel );//将标签添加到窗口 <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack();//使窗口自动根据添加了的组件调整大小 <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JLabelDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import java.io.*;<br />
  class  JLabelDemo<br />
  {<br />
  JFrame mainFrame;<br />
  JLabel simpleLabel;<br />
  public JLabelDemo() {<br />
  mainFrame = new JFrame ( &quot;JLabelDemo&quot; );<br />
  simpleLabel = new JLabel (&quot;&lt;html&gt;&lt;a href=aaa&gt;百度搜索&lt;/a&gt;&lt;/html&gt;&quot;);//嵌入了html标签<br />
  simpleLabel.addMouseListener( new MouseAdapter(){//添加鼠标事件侦听器,当单击标签时,打开网页<br />
  public void mouseClicked( MouseEvent e ){<br />
  try{<br />
  Runtime.getRuntime().exec(&quot;cmd /c start http://www.baidu.com&quot;);<br />
  }catch( IOException ee ){<br />
  ee.printStackTrace();<br />
  }<br />
  }<br />
  });<br />
  simpleLabel.setCursor( new Cursor(Cursor.HAND_CURSOR) );//设置手形鼠标<br />
  mainFrame.getContentPane().add( simpleLabel );//将标签添加到窗口<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();//使窗口自动根据添加了的组件调整大小<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JLabelDemo();<br />
  }<br />
  }<br />
</p>
<p>3.JButton <br />
  JButton是一个按钮.它和JLabel一样的简单 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import java.io.*; <br />
  <br />
  class JButtonDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JButton simpleButton; <br />
  public JButtonDemo() { <br />
  mainFrame = new JFrame ( &quot;JButtonDemo&quot; ); <br />
  simpleButton = new JButton(&quot;百度搜索&quot;); <br />
  mainFrame.getContentPane().add( simpleButton ); <br />
  simpleButton.addActionListener( new ActionListener(){//添加动作侦听器,当按钮被按下时执行这里的代码以打开网页 <br />
  public void actionPerformed( ActionEvent e){ <br />
  try{ <br />
  Runtime.getRuntime().exec(&quot;cmd /c start http://www.baidu.com&quot;); <br />
  }catch( IOException ee ){ <br />
  ee.printStackTrace(); <br />
  } <br />
  } <br />
  }); <br />
  simpleButton.setCursor( new Cursor(Cursor.HAND_CURSOR) ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JButtonDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import java.io.*;</p>
<p>class JButtonDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JButton simpleButton;<br />
  public JButtonDemo() {<br />
  mainFrame = new JFrame ( &quot;JButtonDemo&quot; );<br />
  simpleButton = new JButton(&quot;百度搜索&quot;); <br />
  mainFrame.getContentPane().add( simpleButton );<br />
  simpleButton.addActionListener( new ActionListener(){//添加动作侦听器,当按钮被按下时执行这里的代码以打开网页<br />
  public void actionPerformed( ActionEvent e){<br />
  try{<br />
  Runtime.getRuntime().exec(&quot;cmd /c start http://www.baidu.com&quot;);<br />
  }catch( IOException ee ){<br />
  ee.printStackTrace();<br />
  }<br />
  }<br />
  });<br />
  simpleButton.setCursor( new Cursor(Cursor.HAND_CURSOR) );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JButtonDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>4.JTextField <br />
  一个文本框 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JTextFieldDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JTextField simpleTextField; <br />
  public JTextFieldDemo() { <br />
  mainFrame = new JFrame ( &quot;JTextFieldDemo&quot; ); <br />
  simpleTextField = new JTextField(20);//构造宽度为20个字符的文本框 <br />
  mainFrame.getContentPane().add( simpleTextField ); <br />
  simpleTextField.addActionListener( new ActionListener(){//在输入字符后按回车执行行代码,在标准输出窗口输出它的内容 <br />
  public void actionPerformed( ActionEvent e){ <br />
  System.out.println( simpleTextField.getText() ); <br />
  } <br />
  }); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JTextFieldDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JTextFieldDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JTextField simpleTextField;<br />
  public JTextFieldDemo() {<br />
  mainFrame = new JFrame ( &quot;JTextFieldDemo&quot; );<br />
  simpleTextField = new JTextField(20);//构造宽度为20个字符的文本框 <br />
  mainFrame.getContentPane().add( simpleTextField );<br />
  simpleTextField.addActionListener( new ActionListener(){//在输入字符后按回车执行行代码,在标准输出窗口输出它的内容<br />
  public void actionPerformed( ActionEvent e){<br />
  System.out.println( simpleTextField.getText() );<br />
  }<br />
  });<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JTextFieldDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>5.JTextArea <br />
  文本区域,与文本框不同的是它是多行的 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JTextAreaDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JTextArea simpleTextArea; <br />
  JButton appendButton; <br />
  public JTextAreaDemo() { <br />
  mainFrame = new JFrame ( &quot;JTextAreaDemo&quot; ); <br />
  simpleTextArea = new JTextArea(10,20);//创建一个显示10行20列的文本域 <br />
  simpleTextArea.setLineWrap(true);//设置它自动换行 <br />
  simpleTextArea.setWrapStyleWord(true);//设置它自动换行时根据单词换行,而不是根据字符 <br />
  appendButton = new JButton (&quot;append text to the text area&quot;); <br />
  mainFrame.getContentPane().add( simpleTextArea,BorderLayout.PAGE_START ); <br />
  mainFrame.getContentPane().add( appendButton,BorderLayout.PAGE_END ); <br />
  appendButton.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  simpleTextArea.append(&quot;button appended text here&quot;); <br />
  System.out.println( simpleTextArea.getText() ); <br />
  } <br />
  }); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JTextAreaDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JTextAreaDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JTextArea simpleTextArea;<br />
  JButton appendButton;<br />
  public JTextAreaDemo() {<br />
  mainFrame = new JFrame ( &quot;JTextAreaDemo&quot; );<br />
  simpleTextArea = new JTextArea(10,20);//创建一个显示10行20列的文本域<br />
  simpleTextArea.setLineWrap(true);//设置它自动换行<br />
  simpleTextArea.setWrapStyleWord(true);//设置它自动换行时根据单词换行,而不是根据字符<br />
  appendButton = new JButton (&quot;append text to the text area&quot;);<br />
  mainFrame.getContentPane().add( simpleTextArea,BorderLayout.PAGE_START );<br />
  mainFrame.getContentPane().add( appendButton,BorderLayout.PAGE_END );<br />
  appendButton.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  simpleTextArea.append(&quot;button appended text here&quot;);<br />
  System.out.println( simpleTextArea.getText() );<br />
  }<br />
  });<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JTextAreaDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>6.JPasswordField <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JPasswordFieldDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JPasswordField simplePasswordField; <br />
  public JPasswordFieldDemo() { <br />
  mainFrame = new JFrame ( &quot;JPasswordFieldDemo&quot; ); <br />
  simplePasswordField = new JPasswordField(10); <br />
  simplePasswordField.setEchoChar('*');//设定要显示的字符 <br />
  mainFrame.getContentPane().add( simplePasswordField ); <br />
  simplePasswordField.addActionListener( new ActionListener(){//回车时执行的动作 <br />
  public void actionPerformed( ActionEvent e){ <br />
  char[] input = simplePasswordField.getPassword(); <br />
  for( char c : input ) <br />
  System.out.print( c ); <br />
  } <br />
  }); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JPasswordFieldDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JPasswordFieldDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JPasswordField simplePasswordField;<br />
  public JPasswordFieldDemo() {<br />
  mainFrame = new JFrame ( &quot;JPasswordFieldDemo&quot; );<br />
  simplePasswordField = new JPasswordField(10);<br />
  simplePasswordField.setEchoChar('*');//设定要显示的字符<br />
  mainFrame.getContentPane().add( simplePasswordField );<br />
  simplePasswordField.addActionListener( new ActionListener(){//回车时执行的动作<br />
  public void actionPerformed( ActionEvent e){<br />
  char[] input = simplePasswordField.getPassword();<br />
  for( char c : input )<br />
  System.out.print( c );<br />
  }<br />
  });<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JPasswordFieldDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>7.JPanel <br />
  一个面板.一般用作控制组件的布局. <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  <br />
  class JPanelDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JPanel simplePanel; <br />
  JButton simpleButton; <br />
  JLabel simpleLabel; <br />
  public JPanelDemo() { <br />
  mainFrame = new JFrame ( &quot;JPanelDemo&quot; ); <br />
  simplePanel = new JPanel(); <br />
  simpleButton = new JButton (&quot;button&quot;); <br />
  simpleLabel = new JLabel (&quot;label&quot;); <br />
  simplePanel.add( simpleLabel ); <br />
  simplePanel.add( simpleButton ); <br />
  mainFrame.getContentPane().add( simplePanel ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JPanelDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;</p>
<p>class JPanelDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JPanel simplePanel;<br />
  JButton simpleButton;<br />
  JLabel simpleLabel;<br />
  public JPanelDemo() {<br />
  mainFrame = new JFrame ( &quot;JPanelDemo&quot; );<br />
  simplePanel = new JPanel();<br />
  simpleButton = new JButton (&quot;button&quot;);<br />
  simpleLabel = new JLabel (&quot;label&quot;);<br />
  simplePanel.add( simpleLabel );<br />
  simplePanel.add( simpleButton );<br />
  mainFrame.getContentPane().add( simplePanel );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JPanelDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>8.JCheckBox <br />
  复选框 <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JCheckBoxDemo implements ItemListener <br />
  { <br />
  JFrame mainFrame; <br />
  JPanel mainPanel; <br />
  JCheckBox simpleCheckBox1; <br />
  JCheckBox simpleCheckBox2; <br />
  public JCheckBoxDemo() { <br />
  mainFrame = new JFrame ( &quot;JCheckBoxDemo&quot; ); <br />
  mainPanel = new JPanel (); <br />
  simpleCheckBox1 = new JCheckBox(&quot;checkbox1&quot;); <br />
  simpleCheckBox1.setMnemonic('1'); <br />
  simpleCheckBox1.addItemListener(this); <br />
  simpleCheckBox2 = new JCheckBox(&quot;checkbox2&quot;); <br />
  simpleCheckBox2.setMnemonic('2'); <br />
  simpleCheckBox2.addItemListener(this); <br />
  mainPanel.add(simpleCheckBox1); <br />
  mainPanel.add(simpleCheckBox2); <br />
  mainFrame.getContentPane().add( mainPanel ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public void itemStateChanged( ItemEvent e ){ <br />
  JCheckBox cb = (JCheckBox)e.getSource(); <br />
  if( cb== simpleCheckBox1 ) <br />
  System.out.println( &quot;simpleCheckBox1&quot; ); <br />
  else <br />
  System.out.println( &quot;simpleCheckBox2&quot; ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JCheckBoxDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JCheckBoxDemo implements ItemListener<br />
  {<br />
  JFrame mainFrame;<br />
  JPanel mainPanel;<br />
  JCheckBox simpleCheckBox1;<br />
  JCheckBox simpleCheckBox2;<br />
  public JCheckBoxDemo() {<br />
  mainFrame = new JFrame ( &quot;JCheckBoxDemo&quot; );<br />
  mainPanel = new JPanel ();<br />
  simpleCheckBox1 = new JCheckBox(&quot;checkbox1&quot;);<br />
  simpleCheckBox1.setMnemonic('1');<br />
  simpleCheckBox1.addItemListener(this);<br />
  simpleCheckBox2 = new JCheckBox(&quot;checkbox2&quot;);<br />
  simpleCheckBox2.setMnemonic('2');<br />
  simpleCheckBox2.addItemListener(this);<br />
  mainPanel.add(simpleCheckBox1);<br />
  mainPanel.add(simpleCheckBox2);<br />
  mainFrame.getContentPane().add( mainPanel );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public void itemStateChanged( ItemEvent e ){<br />
  JCheckBox cb = (JCheckBox)e.getSource();<br />
  if( cb== simpleCheckBox1 )<br />
  System.out.println( &quot;simpleCheckBox1&quot; );<br />
  else<br />
  System.out.println( &quot;simpleCheckBox2&quot; );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JCheckBoxDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>9.JRadioButton <br />
  单选按钮.单选按钮要用到ButtonGroup.添加到同一个ButtonGroup的单选按钮表示在它们之间只可选其一.不同ButtonGroup里的单选按钮相互之间的选择不受影响. <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JRadioButtonDemo implements ItemListener <br />
  { <br />
  JFrame mainFrame; <br />
  JPanel mainPanel; <br />
  ButtonGroup buttonGroup; <br />
  JRadioButton simpleRadioButton1; <br />
  JRadioButton simpleRadioButton2; <br />
  public JRadioButtonDemo() { <br />
  mainFrame = new JFrame ( &quot;JRadioButtonDemo&quot; ); <br />
  mainPanel = new JPanel (); <br />
  simpleRadioButton1 = new JRadioButton(&quot;RadioButton1&quot;); <br />
  simpleRadioButton1.setMnemonic('1'); <br />
  simpleRadioButton1.addItemListener(this); <br />
  simpleRadioButton2 = new JRadioButton(&quot;RadioButton2&quot;); <br />
  simpleRadioButton2.setMnemonic('2'); <br />
  simpleRadioButton2.addItemListener(this); <br />
  buttonGroup = new ButtonGroup(); <br />
  buttonGroup.add(simpleRadioButton1); <br />
  buttonGroup.add(simpleRadioButton2); <br />
  mainPanel.add(simpleRadioButton1); <br />
  mainPanel.add(simpleRadioButton2); <br />
  mainFrame.getContentPane().add( mainPanel ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public void itemStateChanged( ItemEvent e ){ <br />
  JRadioButton cb = (JRadioButton)e.getSource(); <br />
  if( cb== simpleRadioButton1 ) <br />
  System.out.println( &quot;simpleRadioButton1&quot; ); <br />
  else <br />
  System.out.println( &quot;simpleRadioButton2&quot; ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JRadioButtonDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JRadioButtonDemo implements ItemListener<br />
  {<br />
  JFrame mainFrame;<br />
  JPanel mainPanel;<br />
  ButtonGroup buttonGroup;<br />
  JRadioButton simpleRadioButton1;<br />
  JRadioButton simpleRadioButton2;<br />
  public JRadioButtonDemo() {<br />
  mainFrame = new JFrame ( &quot;JRadioButtonDemo&quot; );<br />
  mainPanel = new JPanel ();<br />
  simpleRadioButton1 = new JRadioButton(&quot;RadioButton1&quot;);<br />
  simpleRadioButton1.setMnemonic('1');<br />
  simpleRadioButton1.addItemListener(this);<br />
  simpleRadioButton2 = new JRadioButton(&quot;RadioButton2&quot;);<br />
  simpleRadioButton2.setMnemonic('2');<br />
  simpleRadioButton2.addItemListener(this);<br />
  buttonGroup = new ButtonGroup();<br />
  buttonGroup.add(simpleRadioButton1);<br />
  buttonGroup.add(simpleRadioButton2);<br />
  mainPanel.add(simpleRadioButton1);<br />
  mainPanel.add(simpleRadioButton2);<br />
  mainFrame.getContentPane().add( mainPanel );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public void itemStateChanged( ItemEvent e ){<br />
  JRadioButton cb = (JRadioButton)e.getSource();<br />
  if( cb== simpleRadioButton1 )<br />
  System.out.println( &quot;simpleRadioButton1&quot; );<br />
  else<br />
  System.out.println( &quot;simpleRadioButton2&quot; );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JRadioButtonDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>10.JScrollPane <br />
  JScrollPane由四个角,两个头部,和一个视口组成.四个角和两个头部都是由Component组成.四个角并不是总是显示出来的.左上角只有当两个头部同时存在才显示,右下角只有两个滚动条同时出现才会出现.其他两个角可同理知道什么时候会出现.视口是显示内容的部分,由 JViewport对象表示.而真正显示的内容,由JViewport的view表示 <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JScrollPaneDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JScrollPane simpleScrollPane; <br />
  JTextArea simpleTextArea; <br />
  JButton changeViewport; <br />
  public JScrollPaneDemo() { <br />
  mainFrame = new JFrame ( &quot;JScrollPaneDemo&quot; ); <br />
  simpleTextArea = new JTextArea(10,20); <br />
  simpleScrollPane = new JScrollPane( simpleTextArea );//创建一个滚动窗格,里面显示的内容是文本区域 <br />
  simpleScrollPane.setRowHeaderView( new JLabel (&quot;this is a row header&quot;) );//设置行标题 <br />
  simpleScrollPane.setColumnHeaderView( new JLabel (&quot;this is a column header&quot;) );//设置列标题 <br />
  simpleScrollPane.setCorner( JScrollPane.LOWER_RIGHT_CORNER,new JButton(&quot;corner&quot;) );//设置右下角 <br />
  simpleScrollPane.setCorner( JScrollPane.UPPER_LEFT_CORNER,new JButton(&quot;corner&quot;) );//设置左上角 <br />
  changeViewport = new JButton (&quot;changeViewport&quot;); <br />
  changeViewport.addActionListener( new ActionListener(){//当单击按钮时,滚动窗口显示的内容变为另一个文本区域 <br />
  public void actionPerformed( ActionEvent e){ <br />
  simpleScrollPane.getViewport().setView( new JTextArea(&quot;changeViewpot&quot;) ); <br />
  } <br />
  }); <br />
  mainFrame.getContentPane().add( simpleScrollPane,BorderLayout.PAGE_START ); <br />
  mainFrame.getContentPane().add( changeViewport,BorderLayout.PAGE_END ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JScrollPaneDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JScrollPaneDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JScrollPane simpleScrollPane;<br />
  JTextArea simpleTextArea;<br />
  JButton changeViewport;<br />
  public JScrollPaneDemo() {<br />
  mainFrame = new JFrame ( &quot;JScrollPaneDemo&quot; );<br />
  simpleTextArea = new JTextArea(10,20);<br />
  simpleScrollPane = new JScrollPane( simpleTextArea );//创建一个滚动窗格,里面显示的内容是文本区域<br />
  simpleScrollPane.setRowHeaderView( new JLabel (&quot;this is a row header&quot;) );//设置行标题<br />
  simpleScrollPane.setColumnHeaderView( new JLabel (&quot;this is a column header&quot;) );//设置列标题<br />
  simpleScrollPane.setCorner( JScrollPane.LOWER_RIGHT_CORNER,new JButton(&quot;corner&quot;) );//设置右下角<br />
  simpleScrollPane.setCorner( JScrollPane.UPPER_LEFT_CORNER,new JButton(&quot;corner&quot;) );//设置左上角<br />
  changeViewport = new JButton (&quot;changeViewport&quot;);<br />
  changeViewport.addActionListener( new ActionListener(){//当单击按钮时,滚动窗口显示的内容变为另一个文本区域<br />
  public void actionPerformed( ActionEvent e){<br />
  simpleScrollPane.getViewport().setView( new JTextArea(&quot;changeViewpot&quot;) );<br />
  }<br />
  });<br />
  mainFrame.getContentPane().add( simpleScrollPane,BorderLayout.PAGE_START );<br />
  mainFrame.getContentPane().add( changeViewport,BorderLayout.PAGE_END );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JScrollPaneDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>现在开始讲相对复杂一点的组件 <br />
  11.JList <br />
  JList是一个列表.这里将首次引入Model这个概念,中文翻译是模型,不好理解,其实就是数据的意思.JList用ListModel保存它的数据.简单应用可以用实现了ListModel的AbstraceListModel的子类DefaultListModel来保存它的数据(尽管它的名字有Default,但是只有你使用了它创建JList,它才存在.即如果你没有用DefaultListModel创建JList,则你用 getModel()返回的ListModel不能强制转换为DefaultListModel). <br />
  很多组件的Model都有这种结构,即 XXXModel--AbstractXXXModel--DefaultXXXModel <br />
  下面讲一下DefaultListModel,它的方法基本上和Vector&lt;E&gt;一样,另外添加了一个Object getElementAt(int index) <br />
  添加元素: void add(int index, Object element),void addElement(Object obj),void insertElementAt(Object obj, int index) <br />
  删除元素: Object remove(int index),boolean removeElement(Object obj),void removeElementAt(int index), <br />
  void removeAllElements(),void removeRange(int fromIndex, int toIndex),void clear() <br />
  查询元素: Object elementAt(int index),Object get(int index),Object getElementAt(int index), Object firstElement(),Object lastElement() <br />
  修改元素: Object set(int index, Object element),void setElementAt(Object obj, int index) <br />
  JList自身没有对单个元素处理的方法,只有void setListData(Object[] listData),void setListData(Vector&lt;?&gt; listData),void setModel(ListModel model) <br />
  来设置全部元素的方法 <br />
  当要对单个元素进行处理时,用ListModel getModel()返回Model后,再对Model操作 <br />
  通过void addListDataListener(ListDataListener l)可以在ListModel被修改时被通知 <br />
  和JList相关的还有ListSelectionModel,它管理JList的选择项.它没有AbstractListSelectionModel这个子类,而直接有一个DefaultListSelectionModel这个实现类, <br />
  JList默认也是使用的这个实现类. 和上面讲的DefaultListModel不同,这个Model不用你自己创建就已存在. <br />
  通过void addListSelectionListener(ListSelectionListener x)可以在选择改变时被通知. <br />
  void setSelectionMode(int selectionMode)可以设置多选(待续或非连续)或是单选 <br />
  DefaultListSelectionModel没有返回选择了的元素的方法,它只负责去选择哪些项 <br />
  修改选择项的方法: <br />
  void addSelectionInterval(int index0, int index1), <br />
  void removeSelectionInterval(int index0, int index1) <br />
  void setSelectionInterval(int index0, int index1) <br />
  void clearSelection() <br />
  下面这两个方法在ListModel被更改时更改选择项会更方便,因为不用根据ListModel的变动计算索引 <br />
  void removeIndexInterval(int index0, int index1) <br />
  void insertIndexInterval(int index, int length, boolean before) <br />
  另外的一些方法 <br />
  int getMaxSelectionIndex(),int getMinSelectionIndex() <br />
  boolean isSelectedIndex(int index),boolean isSelectionEmpty() <br />
  很多在DefaultListSelectionModel里的方法,在JList自身里也有.例如上面的XXXSelectionInnterval(...)和addListSelectionListener(...) <br />
  另外它还有: <br />
  int getSelectedIndex(),int[] getSelectedIndices() <br />
  Object getSelectedValue(), Object[] getSelectedValues() <br />
  void setSelectedIndex(int index),void setSelectedIndices(int[] indices) <br />
  void setSelectedValue(Object anObject, boolean shouldScroll) <br />
  最后一个内容是,自定义JList <br />
  默认JList显示的内容是String.在创建它的时候,如果你把其他非String的对象传给它要它显示,它会调用toString,然后显示返回的String. <br />
  通过void setCellRenderer(ListCellRenderer cellRenderer)可以自定义JList显示内容的类型. <br />
  参数是一个&quot;渲染器&quot;.很多组件在自定义的时候都是用渲染器来实现的.它只一个方法: <br />
  Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) <br />
  下面举例说明一下它如何工作:假设你调用了setCellRenderer,而且把&quot;label&quot;这个String传给JList要它显示.那么&quot;label&quot;这个值就会传给上面这个方法的value这个值. <br />
  这时你可以用&quot;label&quot;构造一个组件,然后返回.例如,你可以JLabel label = new JLabel( (String)value ); return label.这样,在JList就会显示一个JLabel了. <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.event.*; <br />
  import javax.swing.*; <br />
  class  JListCustomDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JList simpleList; <br />
  public JListCustomDemo(){ <br />
  mainFrame = new JFrame (&quot;JListCustomDemo&quot;); <br />
  <br />
  final DefaultListModel model = new DefaultListModel(); <br />
  model.addElement(&quot;button1&quot;); <br />
  model.addElement(&quot;button2&quot;); <br />
  simpleList = new JList(model); <br />
  simpleList.setCellRenderer( new CustomListCellRenderer() ); <br />
  <br />
  simpleList.addListSelectionListener( new ListSelectionListener(){ <br />
  public void valueChanged( ListSelectionEvent e){ <br />
  System.out.println( model.getElementAt( simpleList.getSelectedIndex() ) ); <br />
  } <br />
  }); <br />
  <br />
  mainFrame.add(simpleList); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.pack(); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JListCustomDemo(); <br />
  } <br />
  } <br />
  class CustomListCellRenderer implements ListCellRenderer{ <br />
  public Component getListCellRendererComponent( <br />
  JList list, <br />
  Object value, <br />
  int index, <br />
  boolean isSelected, <br />
  boolean cellHasFocus <br />
  ){ <br />
  return new JButton( (String)value ); <br />
  } <br />
  <br />
  } <br />
  <br />
  <br />
  <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.event.*;<br />
  import javax.swing.*;<br />
  class  JListCustomDemo<br />
  {<br />
  JFrame mainFrame;<br />
  JList simpleList;<br />
  public JListCustomDemo(){<br />
  mainFrame = new JFrame (&quot;JListCustomDemo&quot;);</p>
<p> final DefaultListModel model = new DefaultListModel();<br />
  model.addElement(&quot;button1&quot;);<br />
  model.addElement(&quot;button2&quot;);<br />
  simpleList = new JList(model);<br />
  simpleList.setCellRenderer( new CustomListCellRenderer() );</p>
<p> simpleList.addListSelectionListener( new ListSelectionListener(){<br />
  public void valueChanged( ListSelectionEvent e){<br />
  System.out.println( model.getElementAt( simpleList.getSelectedIndex() ) );<br />
  }<br />
  });</p>
<p> mainFrame.add(simpleList);<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.pack();<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JListCustomDemo();<br />
  }<br />
  }<br />
  class CustomListCellRenderer implements ListCellRenderer{<br />
  public Component getListCellRendererComponent(<br />
  JList list,<br />
  Object value,<br />
  int index,<br />
  boolean isSelected,<br />
  boolean cellHasFocus<br />
  ){<br />
  return new JButton( (String)value );<br />
  }<br />
  <br />
  }<br />
</p>
<p> <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.util.*; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class JListDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JList simpleList; <br />
  JButton changeSelections; <br />
  public JListDemo() { <br />
  mainFrame = new JFrame ( &quot;JListDemo&quot; ); <br />
  /*  Vector&lt;String&gt; listData = new Vector&lt;String&gt;(); <br />
  listData.add(&quot;data1&quot;); <br />
  listData.add(&quot;data2&quot;); <br />
  listData.add(&quot;data3&quot;); <br />
  listData.add(&quot;data4&quot;); <br />
  simpleList  = new JList( listData ); <br />
  */ <br />
  DefaultListModel dlm = new DefaultListModel(); <br />
  dlm.addElement(&quot;data1&quot;); <br />
  dlm.addElement(&quot;data2&quot;); <br />
  dlm.addElement(&quot;data3&quot;); <br />
  dlm.addElement(&quot;data4&quot;); <br />
  simpleList = new JList( dlm ); <br />
  changeSelections = new JButton (&quot;changeSelections&quot;); <br />
  changeSelections.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  DefaultListSelectionModel dlsm = (DefaultListSelectionModel)simpleList.getSelectionModel(); <br />
  //dlsm.addSelectionInterval(0,1); <br />
  //dlsm.removeSelectionInterval(0,1); <br />
  dlsm.setSelectionInterval(0,1); <br />
  /*    DefaultListModel dlm = (DefaultListModel)simpleList.getModel(); <br />
  dlm.remove(0); <br />
  dlm.remove(1); <br />
  */ <br />
  } <br />
  }); <br />
  mainFrame.getContentPane().add( simpleList,BorderLayout.PAGE_START ); <br />
  mainFrame.getContentPane().add( changeSelections,BorderLayout.PAGE_END ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JListDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.util.*;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class JListDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JList simpleList;<br />
  JButton changeSelections;<br />
  public JListDemo() {<br />
  mainFrame = new JFrame ( &quot;JListDemo&quot; );<br />
  /*  Vector&lt;String&gt; listData = new Vector&lt;String&gt;();<br />
  listData.add(&quot;data1&quot;);<br />
  listData.add(&quot;data2&quot;);<br />
  listData.add(&quot;data3&quot;);<br />
  listData.add(&quot;data4&quot;);<br />
  simpleList  = new JList( listData );<br />
  */<br />
  DefaultListModel dlm = new DefaultListModel();<br />
  dlm.addElement(&quot;data1&quot;);<br />
  dlm.addElement(&quot;data2&quot;);<br />
  dlm.addElement(&quot;data3&quot;);<br />
  dlm.addElement(&quot;data4&quot;);<br />
  simpleList = new JList( dlm );<br />
  changeSelections = new JButton (&quot;changeSelections&quot;);<br />
  changeSelections.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  DefaultListSelectionModel dlsm = (DefaultListSelectionModel)simpleList.getSelectionModel();<br />
  //dlsm.addSelectionInterval(0,1);<br />
  //dlsm.removeSelectionInterval(0,1);<br />
  dlsm.setSelectionInterval(0,1);<br />
  /*    DefaultListModel dlm = (DefaultListModel)simpleList.getModel(); <br />
  dlm.remove(0);<br />
  dlm.remove(1);<br />
  */<br />
  }<br />
  });<br />
  mainFrame.getContentPane().add( simpleList,BorderLayout.PAGE_START );<br />
  mainFrame.getContentPane().add( changeSelections,BorderLayout.PAGE_END );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JListDemo();<br />
  }<br />
  }</p>
<p>&nbsp;</p>
<p>12.JComboBox <br />
  组合框和JList很相似,它们都是用ListModel来保存数据.默认它是使用实现了ListModel的子接口ComboBoxModel 的DefaultComboBoxModel来保存数据的.与JList的情况不同,一个JComboBox总是有一个Model来保存数据的,而 JList则不然. <br />
  DefaultComboBoxModel的方法: <br />
  添加元素:addElement(Object object),insertElementAt(Object object,int index) <br />
  删除元素:removeElement(Object object),removeElementAt(int index),removeAllElements() <br />
  获取元素:getElementAt(int index) <br />
  和选择有关的:getSelectedItem(),setSelectedItem(Object object) <br />
  此外还有getSize(),getIndexOf(Object object) <br />
  JComboBox自身也有一些处理项的方法: <br />
  void addItem(Object anObject),void insertItemAt(Object anObject, int index) <br />
  void removeItem(Object anObject),void removeItemAt(int anIndex),void removeAllItems() <br />
  Object getItemAt(int index) <br />
  int getItemCount() <br />
  以上基本上是把DefaultComboBoxModel里的方法的Element改为Item <br />
  int getSelectedIndex(),Object getSelectedItem(),Object[] getSelectedObjects() <br />
  通过在JComboBox上添加ActionListener,可以在选择改变了的时候作出响应. <br />
  最后是自定义组合框.通过调用和JList一样的void setRenderer(ListCellRenderer aRenderer) 就可以自定义组合框. <br />
  下面的例子示范了在JComboBox里显示图片 <br />
</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import java.util.*; <br />
  <br />
  class JComboBoxDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JComboBox simpleComboBox; <br />
  public JComboBoxDemo() { <br />
  mainFrame = new JFrame ( &quot;JComboBoxDemo&quot; ); <br />
  Vector&lt;String&gt; cbData = new Vector&lt;String&gt;(); <br />
  cbData.add(&quot;images/Pig.gif&quot;); <br />
  cbData.add(&quot;images/Bird.gif&quot;); <br />
  cbData.add(&quot;images/Dog.gif&quot;); <br />
  cbData.add(&quot;images/Cat.gif&quot;); <br />
  simpleComboBox = new JComboBox( cbData); <br />
  simpleComboBox.setPreferredSize( new Dimension(200,130) ); <br />
  simpleComboBox.setMaximumRowCount(2); <br />
  simpleComboBox.setRenderer( new CustomComboBoxRenderer() ); <br />
  mainFrame.getContentPane().add( simpleComboBox ); <br />
  simpleComboBox.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  System.out.println( &quot;selection changed&quot; ); <br />
  System.out.println( simpleComboBox.getSelectedItem() ); <br />
  } <br />
  }); <br />
  simpleComboBox.setCursor( new Cursor(Cursor.HAND_CURSOR) ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  <br />
  public static void main(String[] args) <br />
  { <br />
  new JComboBoxDemo(); <br />
  } <br />
  <br />
  class CustomComboBoxRenderer extends JLabel implements ListCellRenderer{ <br />
  CustomComboBoxRenderer(){ <br />
  setOpaque(true); <br />
  setHorizontalAlignment(CENTER); <br />
  setVerticalAlignment(CENTER); <br />
  <br />
  } <br />
  public Component getListCellRendererComponent( <br />
  JList list, <br />
  Object value, <br />
  int index, <br />
  boolean isSelected, <br />
  boolean cellHasFocus) <br />
  { <br />
  if (isSelected) { <br />
  setBackground(list.getSelectionBackground()); <br />
  setForeground(list.getSelectionForeground()); <br />
  } else { <br />
  setBackground(list.getBackground()); <br />
  setForeground(list.getForeground()); <br />
  } <br />
  String imageFileName = (String)value; <br />
  ImageIcon labelIcon = new ImageIcon( imageFileName ); <br />
  setText( imageFileName.substring(imageFileName.lastIndexOf('/')+1) ); <br />
  setIcon( labelIcon ); <br />
  return this; <br />
  } <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import java.util.*;</p>
<p>class JComboBoxDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JComboBox simpleComboBox;<br />
  public JComboBoxDemo() {<br />
  mainFrame = new JFrame ( &quot;JComboBoxDemo&quot; );<br />
  Vector&lt;String&gt; cbData = new Vector&lt;String&gt;();<br />
  cbData.add(&quot;images/Pig.gif&quot;);<br />
  cbData.add(&quot;images/Bird.gif&quot;);<br />
  cbData.add(&quot;images/Dog.gif&quot;);<br />
  cbData.add(&quot;images/Cat.gif&quot;);<br />
  simpleComboBox = new JComboBox( cbData);<br />
  simpleComboBox.setPreferredSize( new Dimension(200,130) );<br />
  simpleComboBox.setMaximumRowCount(2);<br />
  simpleComboBox.setRenderer( new CustomComboBoxRenderer() );<br />
  mainFrame.getContentPane().add( simpleComboBox );<br />
  simpleComboBox.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  System.out.println( &quot;selection changed&quot; );<br />
  System.out.println( simpleComboBox.getSelectedItem() );<br />
  }<br />
  });<br />
  simpleComboBox.setCursor( new Cursor(Cursor.HAND_CURSOR) );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }</p>
<p> public static void main(String[] args) <br />
  {<br />
  new JComboBoxDemo();<br />
  }</p>
<p> class CustomComboBoxRenderer extends JLabel implements ListCellRenderer{<br />
  CustomComboBoxRenderer(){<br />
  setOpaque(true);<br />
  setHorizontalAlignment(CENTER);<br />
  setVerticalAlignment(CENTER);</p>
<p> }<br />
  public Component getListCellRendererComponent(<br />
  JList list,<br />
  Object value,<br />
  int index,<br />
  boolean isSelected,<br />
  boolean cellHasFocus)<br />
  {<br />
  if (isSelected) {<br />
  setBackground(list.getSelectionBackground());<br />
  setForeground(list.getSelectionForeground());<br />
  } else {<br />
  setBackground(list.getBackground());<br />
  setForeground(list.getForeground());<br />
  }<br />
  String imageFileName = (String)value;<br />
  ImageIcon labelIcon = new ImageIcon( imageFileName );<br />
  setText( imageFileName.substring(imageFileName.lastIndexOf('/')+1) );<br />
  setIcon( labelIcon );<br />
  return this;<br />
  }<br />
  }<br />
  }<br />
</p>
<p>13.JFileChooser <br />
  JFileChooser代表一个打开/保存文件对话框 <br />
  三个较简单的构造函数: <br />
  JFileChooser(),JFileChooser(File currentDirectory),JFileChooser(String currentDirectoryPath) <br />
  构造对象以后,调用int showOpenDialog(Component parent)或int showSaveDialog(Component parent)显示打开/保存对话框 <br />
  调用int showDialog(Component parent, String approveButtonText) 显示自定义打开/保存按钮文字的对话框 <br />
  三个方法的返回值都是整型.当按下打开/保存时,返回APPROVE_OPTION,否则返回CANCEL_OPTION <br />
  可以用javax.swing.filechooser.FileFilter来过滤不需要显示的文件.它只有两个方法 <br />
  boolean accept(File f)  通过通过判断f的后缀来决定显示与否.要显示则返回true,否则返回false <br />
  String getDescription() 返回对这个过滤器的描述 <br />
  和FileFilter有关的方法: <br />
  void setFileFilter(FileFilter filter),void addChoosableFileFilter(FileFilter filter) <br />
  当我们选择的文件改变(但是未按下打开或保存按钮)时,会有java.beans.PropertyChangeEvent产生 <br />
  通过void addPropertyChangeListener(PropertyChangeListener listener)可以对此事件进行侦听 <br />
  PropertyChangeEvent的方法有: <br />
  Object getNewValue(), Object getOldValue(), String getPropertyName() <br />
  Object getPropagationId(),void setPropagationId(Object propagationId) <br />
  通过void setAccessory(JComponent c)可以向JFileChooser添加自定义的部分. <br />
  其他有用的方法: <br />
  File getSelectedFile(),File[] getSelectedFiles() <br />
  void setFileSelectionMode(int):FILES_ONLY,DIRECTORIES_ONLY,FILES_AND_DIRECTORIES <br />
  void setMultiSelectionEnabled(boolean),setAcceptAllFileFilterUsed(boolean) <br />
  void setCurrentDirectory(File) ,void setFileHidingEnabled(boolean) </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import javax.swing.filechooser.FileFilter; <br />
  import java.io.File; <br />
  import java.beans.*; <br />
  <br />
  class JFileChooserDemo <br />
  { <br />
  JFileChooser simpleFileChooser; <br />
  JScrollPane previewScrollPane; <br />
  JLabel previewLabel; <br />
  public JFileChooserDemo() { <br />
  simpleFileChooser = new JFileChooser(); <br />
  previewLabel = new JLabel (); <br />
  previewLabel.setHorizontalAlignment(SwingConstants.CENTER); <br />
  previewScrollPane = new JScrollPane ( previewLabel ); <br />
  previewScrollPane.setPreferredSize(new Dimension(100,10)); <br />
  simpleFileChooser.setAccessory( previewScrollPane ); <br />
  simpleFileChooser.addChoosableFileFilter( new GifFileFilter() ); <br />
  simpleFileChooser.addChoosableFileFilter( new PngFileFilter() ); <br />
  simpleFileChooser.addChoosableFileFilter( new JpgFileFilter() ); <br />
  simpleFileChooser.addPropertyChangeListener( new PropertyChangeListener(){ <br />
  public void propertyChange( PropertyChangeEvent e ){ <br />
  if ( JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals( e.getPropertyName() ) ){ <br />
  File newSelectedFile = (File)e.getNewValue(); <br />
  if( newSelectedFile != null){ <br />
  ImageIcon icon = new ImageIcon( newSelectedFile.getPath() ); <br />
  previewLabel.setIcon( icon ); <br />
  } <br />
  } <br />
  } <br />
  }); <br />
  simpleFileChooser.showOpenDialog(null); <br />
  //simpleFileChooser.showDialog(null,&quot;自定义按钮文字&quot;); <br />
  } <br />
  class GifFileFilter extends FileFilter{ <br />
  public boolean accept( File f ){ <br />
  return f.getName().endsWith(&quot;.gif&quot;); <br />
  } <br />
  public String getDescription(){ <br />
  return &quot;Gif files(.gif)&quot;; <br />
  } <br />
  } <br />
  class PngFileFilter extends FileFilter{ <br />
  public boolean accept( File f ){ <br />
  return f.getName().endsWith(&quot;.png&quot;); <br />
  } <br />
  public String getDescription(){ <br />
  return &quot;Png files(.png)&quot;; <br />
  } <br />
  } <br />
  class JpgFileFilter extends FileFilter{ <br />
  public boolean accept( File f ){ <br />
  return f.getName().endsWith(&quot;.jpg&quot;); <br />
  } <br />
  public String getDescription(){ <br />
  return &quot;Jpg files(.jpg)&quot;; <br />
  } <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JFileChooserDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import javax.swing.filechooser.FileFilter;<br />
  import java.io.File;<br />
  import java.beans.*;</p>
<p>class JFileChooserDemo <br />
  {<br />
  JFileChooser simpleFileChooser;<br />
  JScrollPane previewScrollPane;<br />
  JLabel previewLabel;<br />
  public JFileChooserDemo() {<br />
  simpleFileChooser = new JFileChooser(); <br />
  previewLabel = new JLabel ();<br />
  previewLabel.setHorizontalAlignment(SwingConstants.CENTER);<br />
  previewScrollPane = new JScrollPane ( previewLabel );<br />
  previewScrollPane.setPreferredSize(new Dimension(100,10));<br />
  simpleFileChooser.setAccessory( previewScrollPane );<br />
  simpleFileChooser.addChoosableFileFilter( new GifFileFilter() );<br />
  simpleFileChooser.addChoosableFileFilter( new PngFileFilter() );<br />
  simpleFileChooser.addChoosableFileFilter( new JpgFileFilter() );<br />
  simpleFileChooser.addPropertyChangeListener( new PropertyChangeListener(){<br />
  public void propertyChange( PropertyChangeEvent e ){<br />
  if ( JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals( e.getPropertyName() ) ){<br />
  File newSelectedFile = (File)e.getNewValue();<br />
  if( newSelectedFile != null){<br />
  ImageIcon icon = new ImageIcon( newSelectedFile.getPath() );<br />
  previewLabel.setIcon( icon );<br />
  }<br />
  }<br />
  }<br />
  });<br />
  simpleFileChooser.showOpenDialog(null);<br />
  //simpleFileChooser.showDialog(null,&quot;自定义按钮文字&quot;);<br />
  }<br />
  class GifFileFilter extends FileFilter{<br />
  public boolean accept( File f ){<br />
  return f.getName().endsWith(&quot;.gif&quot;); <br />
  }<br />
  public String getDescription(){<br />
  return &quot;Gif files(.gif)&quot;;<br />
  }<br />
  }<br />
  class PngFileFilter extends FileFilter{<br />
  public boolean accept( File f ){<br />
  return f.getName().endsWith(&quot;.png&quot;); <br />
  } <br />
  public String getDescription(){<br />
  return &quot;Png files(.png)&quot;;<br />
  }<br />
  }<br />
  class JpgFileFilter extends FileFilter{<br />
  public boolean accept( File f ){<br />
  return f.getName().endsWith(&quot;.jpg&quot;);<br />
  } <br />
  public String getDescription(){<br />
  return &quot;Jpg files(.jpg)&quot;;<br />
  }<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JFileChooserDemo();<br />
  }<br />
  }<br />
</p>
<p>14.JColorChooser <br />
  一个颜色选择器.它的构造方法有: <br />
  JColorChooser(),JColorChooser(Color initialColor),JColorChooser(ColorSelectionModel model) <br />
  创建了对象以后,可以调用将它添加到JFrame,JPanel等其他容器里面. <br />
  也可调用它的静态方法static Color showDialog(Component component, String title, Color initialColor )来创建一个模态的对话框. <br />
  它用ColorSelectionModel来管理选择的颜色.通过调用它的void addChangeListener(ChangeListener listener)可以在选择的颜色变化时作出反应. <br />
  调用void setSelectedColor(Color color)更改选择的颜色,Color getSelectedColor()取得选择的颜色 <br />
  JColorChooser自身的获取颜色的方法是Color getColor(). <br />
  JColorChooser由颜色选择面板和预览面板组成,所以自定义它,就是对这两部分作文章 <br />
  void setPreviewPanel(JComponent) 可以设定预览面板.setPreviewPanel( new JPanel() )可以移除预览面板,将参数设为null,即setPreviewPanel(null)可以将预览面板设回默认. <br />
  void setChooserPanels(AbstractColorChooserPanel[])和void addChooserPanel(AbstractColorChooserPanel)分别可以设置和添加颜色选择面板 <br />
  void removeChooserPanel(AbstractColorChooserPanel)可以删除颜色选择面板 <br />
  AbstractColorChooserPanel代表差一个颜色选择面板,它在javax.swing.colorchooser包里.它有五个抽象方法,而其中两个是目前不用的.所以只需定义下面三个: <br />
  String getDisplayName()面板显示的文本. <br />
  void buildChooser() 负责创建一个颜色选择面板 <br />
  void updateChooser() 负责更新显示颜色面板 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import javax.swing.event.*; <br />
  <br />
  class JColorChooserDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JColorChooser simpleColorChooser; <br />
  JLabel sampleLabel; <br />
  public JColorChooserDemo() { <br />
  mainFrame = new JFrame ( &quot;JColorChooserDemo&quot; ); <br />
  sampleLabel = new JLabel (&quot;sample&quot;); <br />
  simpleColorChooser = new JColorChooser(); <br />
  simpleColorChooser.getSelectionModel().addChangeListener( new ChangeListener(){ <br />
  public void stateChanged( ChangeEvent e ){ <br />
  sampleLabel.setForeground( simpleColorChooser.getColor() ); <br />
  } <br />
  }); <br />
  mainFrame.getContentPane().add( simpleColorChooser,BorderLayout.PAGE_START ); <br />
  mainFrame.getContentPane().add( sampleLabel,BorderLayout.PAGE_END ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JColorChooserDemo(); <br />
  } <br />
  } <br />
  <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import javax.swing.event.*;</p>
<p>class JColorChooserDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JColorChooser simpleColorChooser;<br />
  JLabel sampleLabel;<br />
  public JColorChooserDemo() {<br />
  mainFrame = new JFrame ( &quot;JColorChooserDemo&quot; );<br />
  sampleLabel = new JLabel (&quot;sample&quot;);<br />
  simpleColorChooser = new JColorChooser();<br />
  simpleColorChooser.getSelectionModel().addChangeListener( new ChangeListener(){<br />
  public void stateChanged( ChangeEvent e ){<br />
  sampleLabel.setForeground( simpleColorChooser.getColor() );<br />
  }<br />
  });<br />
  mainFrame.getContentPane().add( simpleColorChooser,BorderLayout.PAGE_START );<br />
  mainFrame.getContentPane().add( sampleLabel,BorderLayout.PAGE_END );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JColorChooserDemo();<br />
  }<br />
  }<br />
</p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import javax.swing.event.*; <br />
  import javax.swing.colorchooser.*; <br />
  class JColorChooserCustomDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JColorChooser simpleColorChooserCustom; <br />
  JLabel sampleLabel; <br />
  public JColorChooserCustomDemo() { <br />
  mainFrame = new JFrame ( &quot;JColorChooserCustomDemo&quot; ); <br />
  sampleLabel = new JLabel (&quot;sample&quot;); <br />
  simpleColorChooserCustom = new JColorChooser(); <br />
  simpleColorChooserCustom.getSelectionModel().addChangeListener( new ChangeListener(){ <br />
  public void stateChanged( ChangeEvent e ){ <br />
  sampleLabel.setForeground( simpleColorChooserCustom.getColor() ); <br />
  } <br />
  }); <br />
  AbstractColorChooserPanel accps[] = { new CustomColorChooserPanel(), <br />
  new CustomColorChooserPanel()}; <br />
  simpleColorChooserCustom.setChooserPanels(accps); <br />
  mainFrame.getContentPane().add( simpleColorChooserCustom,BorderLayout.PAGE_START ); <br />
  mainFrame.getContentPane().add( sampleLabel,BorderLayout.PAGE_END ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  class CustomColorChooserPanel extends AbstractColorChooserPanel implements ActionListener{ <br />
  JButton redButton; <br />
  JButton greenButton; <br />
  JButton blueButton; <br />
  public CustomColorChooserPanel(){ <br />
  this.redButton = new JButton(&quot;red&quot;); <br />
  this.greenButton = new JButton(&quot;green&quot;); <br />
  this.blueButton = new JButton(&quot;blue&quot;); <br />
  redButton.addActionListener(this); <br />
  greenButton.addActionListener(this); <br />
  blueButton.addActionListener(this); <br />
  } <br />
  public void actionPerformed(ActionEvent ae) { <br />
  if((JButton)ae.getSource() == redButton){ <br />
  getColorSelectionModel().setSelectedColor(Color.red); <br />
  }else{ <br />
  if((JButton)ae.getSource() == greenButton){ <br />
  getColorSelectionModel().setSelectedColor(Color.green); <br />
  } <br />
  else{ <br />
  getColorSelectionModel().setSelectedColor(Color.blue); <br />
  } <br />
  } <br />
  } <br />
  public void buildChooser(){ <br />
  add(redButton); <br />
  add(greenButton); <br />
  add(blueButton); <br />
  } <br />
  public void updateChooser(){} <br />
  public String getDisplayName(){ <br />
  return &quot;CustomPanel&quot;; <br />
  } <br />
  public Icon getSmallDisplayIcon() { <br />
  return null; <br />
  } <br />
  public Icon getLargeDisplayIcon() { <br />
  return null; <br />
  } <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JColorChooserCustomDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import javax.swing.event.*;<br />
  import javax.swing.colorchooser.*;<br />
  class JColorChooserCustomDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JColorChooser simpleColorChooserCustom;<br />
  JLabel sampleLabel;<br />
  public JColorChooserCustomDemo() {<br />
  mainFrame = new JFrame ( &quot;JColorChooserCustomDemo&quot; );<br />
  sampleLabel = new JLabel (&quot;sample&quot;);<br />
  simpleColorChooserCustom = new JColorChooser();<br />
  simpleColorChooserCustom.getSelectionModel().addChangeListener( new ChangeListener(){<br />
  public void stateChanged( ChangeEvent e ){<br />
  sampleLabel.setForeground( simpleColorChooserCustom.getColor() );<br />
  }<br />
  });<br />
  AbstractColorChooserPanel accps[] = { new CustomColorChooserPanel(), <br />
  new CustomColorChooserPanel()};<br />
  simpleColorChooserCustom.setChooserPanels(accps);<br />
  mainFrame.getContentPane().add( simpleColorChooserCustom,BorderLayout.PAGE_START );<br />
  mainFrame.getContentPane().add( sampleLabel,BorderLayout.PAGE_END );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  class CustomColorChooserPanel extends AbstractColorChooserPanel implements ActionListener{ <br />
  JButton redButton;<br />
  JButton greenButton;<br />
  JButton blueButton; <br />
  public CustomColorChooserPanel(){ <br />
  this.redButton = new JButton(&quot;red&quot;);<br />
  this.greenButton = new JButton(&quot;green&quot;);<br />
  this.blueButton = new JButton(&quot;blue&quot;);<br />
  redButton.addActionListener(this);<br />
  greenButton.addActionListener(this);<br />
  blueButton.addActionListener(this);<br />
  }<br />
  public void actionPerformed(ActionEvent ae) {<br />
  if((JButton)ae.getSource() == redButton){<br />
  getColorSelectionModel().setSelectedColor(Color.red);<br />
  }else{<br />
  if((JButton)ae.getSource() == greenButton){<br />
  getColorSelectionModel().setSelectedColor(Color.green);<br />
  }<br />
  else{<br />
  getColorSelectionModel().setSelectedColor(Color.blue);<br />
  }<br />
  }<br />
  }<br />
  public void buildChooser(){<br />
  add(redButton);<br />
  add(greenButton);<br />
  add(blueButton);<br />
  }<br />
  public void updateChooser(){}<br />
  public String getDisplayName(){<br />
  return &quot;CustomPanel&quot;;<br />
  }<br />
  public Icon getSmallDisplayIcon() {<br />
  return null;<br />
  }<br />
  public Icon getLargeDisplayIcon() {<br />
  return null;<br />
  }<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JColorChooserCustomDemo();<br />
  }<br />
  } <br />
</p>
<p>15.JSlider <br />
  JSlider是一个滑动条.其实它还是比较容易使用的 <br />
  构造方法比较多: <br />
  JSlider(),JSlider(int orientation),JSlider(int min, int max) <br />
  JSlider(int min, int max, int value) ,JSlider(int orientation, int min, int max, int value) <br />
  通过void addChangeListener(ChangeListener l) 可以在它的值改变时作出反应 <br />
  最需要操作的是它的刻度.下面是和刻度有关的方法: <br />
  void setMajorTickSpacing(int n),void setMinorTickSpacing(int n) ,void setLabelTable(Dictionary labels) <br />
  void setPaintLabels(boolean b),void setPaintTicks(boolean b) <br />
  另外一些常用方法: <br />
  setValue(int n),void setOrientation(int orientation),void setMinimum(int minimum),void setMaximum(int maximum) <br />
  int getValue() ,int getOrientation() </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import javax.swing.event.*; <br />
  import java.util.*; <br />
  <br />
  class JSliderDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JSlider simpleSlider; <br />
  public JSliderDemo() { <br />
  mainFrame = new JFrame ( &quot;JSliderDemo&quot; ); <br />
  simpleSlider = new JSlider(SwingConstants.VERTICAL); <br />
  <br />
  Hashtable sliderLabelHashTable = simpleSlider.createStandardLabels(10); <br />
  for(int i=0; i&lt;sliderLabelHashTable.size()*10; i+=10){ <br />
  sliderLabelHashTable.put(new Integer(i),new JLabel(&quot;label &quot; + i)); <br />
  } <br />
  simpleSlider.setLabelTable(sliderLabelHashTable); <br />
  simpleSlider.setPaintLabels(true); <br />
  simpleSlider.setMinorTickSpacing(5); <br />
  simpleSlider.setMajorTickSpacing(10); <br />
  simpleSlider.setPaintTicks(true); <br />
  <br />
  mainFrame.getContentPane().add( simpleSlider ); <br />
  simpleSlider.addChangeListener( new ChangeListener(){ <br />
  public void stateChanged( ChangeEvent e){ <br />
  System.out.println( simpleSlider.getValue() ); <br />
  } <br />
  }); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JSliderDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import javax.swing.event.*;<br />
  import java.util.*;</p>
<p>class JSliderDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JSlider simpleSlider;<br />
  public JSliderDemo() {<br />
  mainFrame = new JFrame ( &quot;JSliderDemo&quot; );<br />
  simpleSlider = new JSlider(SwingConstants.VERTICAL);</p>
<p> Hashtable sliderLabelHashTable = simpleSlider.createStandardLabels(10);<br />
  for(int i=0; i&lt;sliderLabelHashTable.size()*10; i+=10){<br />
  sliderLabelHashTable.put(new Integer(i),new JLabel(&quot;label &quot; + i));<br />
  }<br />
  simpleSlider.setLabelTable(sliderLabelHashTable);<br />
  simpleSlider.setPaintLabels(true);<br />
  simpleSlider.setMinorTickSpacing(5);<br />
  simpleSlider.setMajorTickSpacing(10);<br />
  simpleSlider.setPaintTicks(true);<br />
  <br />
  mainFrame.getContentPane().add( simpleSlider );<br />
  simpleSlider.addChangeListener( new ChangeListener(){<br />
  public void stateChanged( ChangeEvent e){<br />
  System.out.println( simpleSlider.getValue() );<br />
  }<br />
  });<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JSliderDemo();<br />
  }<br />
  }<br />
</p>
<p>16.JLayeredPane <br />
  JFrame,JApplet,JDialog,JInternalFrame其实是由好几部分组成的 <br />
  JFrame,JApplet,JDialog,JInternalFrame <br />
  |__JRootPane:根层 <br />
  |__GlassPane(Component):GlassPane是用组件实现的,没有JGlassPane <br />
  |__JLayeredPane:分层.在这里可以定义组件的叠放次序 <br />
  |__ContentPane:ContentPane和GlassPane一样,只一个抽象层,没有对应的类.在它们上面可以放组件 <br />
  |__JMenuBar <br />
  但是,我们一般不直接使用JRootPane的JLayeredPane,而是自己定义一个. <br />
  它只有一个构造方法,无参的JLayeredPane() <br />
  用Component add(Component comp, int index)将组件添加到其上并指定层级,层级大的组件显示在小的上面. <br />
  以后可以动态改变所在层: <br />
  void moveToBack(Component c),void moveToFront(Component c):这两个方法改变的是层内的位置,而不是层间的位置 <br />
  void setPosition(Component c, int position):设置层内的位置.0表示最上面,-1表示最下面 <br />
  void setLayer(Component c, int layer) <br />
  void setLayer(Component c, int layer, int position) 设置组件的层级,position是指在层内的位置. </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import javax.swing.event.*; <br />
  <br />
  class JLayeredPaneDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JLayeredPane layeredPane; <br />
  JLabel blackLabel; <br />
  JComboBox layerList; <br />
  public JLayeredPaneDemo() { <br />
  mainFrame = new JFrame ( &quot;JLayeredPaneDemo&quot; ); <br />
  layeredPane = new JLayeredPane(); <br />
  layeredPane.setPreferredSize( new Dimension(200,300) ); <br />
  Color[] colors = { Color.red, Color.green, Color.yellow, Color.blue }; <br />
  for( int i=0; i&lt;4; i++){ <br />
  JLabel label = createLabel(i,colors[i]); <br />
  layeredPane.add( label, new Integer(i) ); <br />
  } <br />
  blackLabel = new JLabel ( &quot;lll&quot; ); <br />
  blackLabel.setBounds( 15,40,120,120); <br />
  blackLabel.setOpaque( true ); <br />
  blackLabel.setBackground( Color.black ); <br />
  layeredPane.add( blackLabel, new Integer(1), 0 ); <br />
  layeredPane.addMouseMotionListener( new MouseInputAdapter(){ <br />
  public void mouseMoved( MouseEvent e ){ <br />
  blackLabel.setBounds( e.getX(),e.getY(),120,120 ); <br />
  } <br />
  } ); <br />
  <br />
  String layerListItem[] = { &quot;PUT THE BLACK LABEL AT LAYER 0&quot;, <br />
  &quot;PUT THE BLACK LABEL AT LAYER 1&quot;,&quot;PUT THE BLACK LABEL AT LAYER 2&quot;, <br />
  &quot;PUT THE BLACK LABEL AT LAYER 3&quot;,&quot;PUT THE BLACK LABEL AT LAYER 4&quot; }; <br />
  layerList = new JComboBox( layerListItem ); <br />
  layerList.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e ){ <br />
  layeredPane.setLayer( blackLabel,layerList.getSelectedIndex() ); <br />
  } <br />
  } ); <br />
  mainFrame.getContentPane().add( layerList ,BorderLayout.PAGE_END); <br />
  mainFrame.getContentPane().add( layeredPane, BorderLayout.PAGE_START); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.setSize( 400,400 ); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  JLabel createLabel(int i,Color color){ <br />
  JLabel label = new JLabel ( &quot;&quot;+i); <br />
  label.setOpaque( true ); <br />
  label.setBounds( i*60,i*60,140,140 ); <br />
  label.setBackground( color ); <br />
  return label; <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JLayeredPaneDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import javax.swing.event.*;</p>
<p>class JLayeredPaneDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JLayeredPane layeredPane;<br />
  JLabel blackLabel;<br />
  JComboBox layerList;<br />
  public JLayeredPaneDemo() {<br />
  mainFrame = new JFrame ( &quot;JLayeredPaneDemo&quot; );<br />
  layeredPane = new JLayeredPane();<br />
  layeredPane.setPreferredSize( new Dimension(200,300) );<br />
  Color[] colors = { Color.red, Color.green, Color.yellow, Color.blue };<br />
  for( int i=0; i&lt;4; i++){<br />
  JLabel label = createLabel(i,colors[i]);<br />
  layeredPane.add( label, new Integer(i) );<br />
  }<br />
  blackLabel = new JLabel ( &quot;lll&quot; );<br />
  blackLabel.setBounds( 15,40,120,120);<br />
  blackLabel.setOpaque( true );<br />
  blackLabel.setBackground( Color.black );<br />
  layeredPane.add( blackLabel, new Integer(1), 0 );<br />
  layeredPane.addMouseMotionListener( new MouseInputAdapter(){<br />
  public void mouseMoved( MouseEvent e ){<br />
  blackLabel.setBounds( e.getX(),e.getY(),120,120 );<br />
  }<br />
  } );</p>
<p> String layerListItem[] = { &quot;PUT THE BLACK LABEL AT LAYER 0&quot;,<br />
  &quot;PUT THE BLACK LABEL AT LAYER 1&quot;,&quot;PUT THE BLACK LABEL AT LAYER 2&quot;,<br />
  &quot;PUT THE BLACK LABEL AT LAYER 3&quot;,&quot;PUT THE BLACK LABEL AT LAYER 4&quot; };<br />
  layerList = new JComboBox( layerListItem );<br />
  layerList.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e ){<br />
  layeredPane.setLayer( blackLabel,layerList.getSelectedIndex() );<br />
  }<br />
  } );<br />
  mainFrame.getContentPane().add( layerList ,BorderLayout.PAGE_END);<br />
  mainFrame.getContentPane().add( layeredPane, BorderLayout.PAGE_START);<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.setSize( 400,400 );<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  JLabel createLabel(int i,Color color){<br />
  JLabel label = new JLabel ( &quot;&quot;+i);<br />
  label.setOpaque( true );<br />
  label.setBounds( i*60,i*60,140,140 );<br />
  label.setBackground( color );<br />
  return label;<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JLayeredPaneDemo();<br />
  }<br />
  }<br />
</p>
<p>17.JInternalFrame <br />
  JFrame不能添加JFrame到自已的内容面板.那么,如何实现多文档程序呢?用JInternalFrame可以实现. <br />
  一般的做法是,把JInternalFrame添加到JDesktopPane,然后把JDesktopPane作为JFrame的内容面板(ContentPane) <br />
  JInternalFrame(String title[, boolean resizable[, boolean closable[, boolean maximizable[, boolean iconifiable]]]]) <br />
  []里面的表示可以省略 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  <br />
  class  JInternalFrameDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JDesktopPane desktop; <br />
  public JInternalFrameDemo(){ <br />
  mainFrame = new JFrame (&quot;JInternalFrame&quot;); <br />
  desktop = new JDesktopPane(); <br />
  <br />
  for(int i=0; i&lt;4; i++){ <br />
  JInternalFrame internalFrame = new JInternalFrame(); <br />
  internalFrame.setVisible( true ); <br />
  internalFrame.setLocation(i*40,i*40); <br />
  internalFrame.getContentPane().add( new JButton (&quot;button&quot;) ); <br />
  internalFrame.pack(); <br />
  desktop.add(internalFrame); <br />
  } <br />
  //        desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE); <br />
  desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); <br />
  mainFrame.setContentPane(desktop); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.setSize(400,400); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  <br />
  public static void main(String[] args) <br />
  { <br />
  new JInternalFrameDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;</p>
<p>class  JInternalFrameDemo<br />
  {<br />
  JFrame mainFrame;<br />
  JDesktopPane desktop;<br />
  public JInternalFrameDemo(){<br />
  mainFrame = new JFrame (&quot;JInternalFrame&quot;);<br />
  desktop = new JDesktopPane();</p>
<p> for(int i=0; i&lt;4; i++){<br />
  JInternalFrame internalFrame = new JInternalFrame();<br />
  internalFrame.setVisible( true );<br />
  internalFrame.setLocation(i*40,i*40);<br />
  internalFrame.getContentPane().add( new JButton (&quot;button&quot;) );<br />
  internalFrame.pack();<br />
  desktop.add(internalFrame);<br />
  }<br />
  //        desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);<br />
  desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);<br />
  mainFrame.setContentPane(desktop);<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.setSize(400,400);<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }</p>
<p> public static void main(String[] args) <br />
  {<br />
  new JInternalFrameDemo();<br />
  }<br />
  }<br />
</p>
<p>18.GlassPane <br />
  GlassPane可以用来截获输入事件(键盘和鼠标).没有JGlassPane <br />
  可以调用JFrame的void setGlassPane(Component glassPane)来设置GlassPane <br />
  默认GlassPane是不可见的,要调用getGlassPane().setVisible(true)使其可见 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  <br />
  class GlassPaneDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JPanel mainPanel; <br />
  JButton button; <br />
  public GlassPaneDemo() { <br />
  mainFrame = new JFrame (  ); <br />
  mainPanel = new JPanel (); <br />
  button = new JButton (&quot;button&quot;); <br />
  //mainFrame.setGlassPane( mainPanel ); <br />
  mainPanel.add( button ); <br />
  mainFrame.getContentPane().add( mainPanel ); <br />
  mainFrame.setGlassPane( new MyGlassPane() ); <br />
  mainFrame.getGlassPane().setVisible( true ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.setSize( 300,400 ); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  private class MyGlassPane extends JComponent { <br />
  Point point = new Point(10,10); <br />
  public MyGlassPane(){ <br />
  addMouseListener( new MouseAdapter(){ <br />
  public void mouseClicked( MouseEvent e ){ <br />
  point = new Point( e.getX(),e.getY() ); <br />
  repaint(); <br />
  } <br />
  } ); <br />
  } <br />
  public void paintComponent( Graphics g ){ <br />
  g.setColor( Color.red ); <br />
  g.fillOval( point.x,point.y,20,20 ); <br />
  } <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  SwingUtilities.invokeLater( new Runnable(){ <br />
  public void run(){ <br />
  new GlassPaneDemo(); <br />
  } <br />
  }); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;</p>
<p>class GlassPaneDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JPanel mainPanel;<br />
  JButton button;<br />
  public GlassPaneDemo() {<br />
  mainFrame = new JFrame (  ); <br />
  mainPanel = new JPanel ();<br />
  button = new JButton (&quot;button&quot;);<br />
  //mainFrame.setGlassPane( mainPanel );<br />
  mainPanel.add( button );<br />
  mainFrame.getContentPane().add( mainPanel );<br />
  mainFrame.setGlassPane( new MyGlassPane() );<br />
  mainFrame.getGlassPane().setVisible( true );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.setSize( 300,400 );<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  private class MyGlassPane extends JComponent {<br />
  Point point = new Point(10,10);<br />
  public MyGlassPane(){<br />
  addMouseListener( new MouseAdapter(){<br />
  public void mouseClicked( MouseEvent e ){<br />
  point = new Point( e.getX(),e.getY() );<br />
  repaint();<br />
  }<br />
  } );<br />
  }<br />
  public void paintComponent( Graphics g ){<br />
  g.setColor( Color.red );<br />
  g.fillOval( point.x,point.y,20,20 );<br />
  }<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  SwingUtilities.invokeLater( new Runnable(){<br />
  public void run(){<br />
  new GlassPaneDemo();<br />
  }<br />
  });<br />
  }<br />
  }<br />
</p>
<p>19.JProgressBar <br />
  进度条.当一个任务要较长时间来完成时,我们可以用一个进度条来表示任务的完成进度. <br />
  在讲进度条的用法之前,我们先来看javax.swing.SwingWorker类的用法.我们将用这个类来模拟我们的&quot;较长的任务&quot;. <br />
  在java中,组件是在一个用户界面线各里绘制的.如果我们把一个用时较长的任务放到这个线程来实现(例如我们把一个用时较长的任务放到一个按钮的 <br />
  actionPerformed(...)),那么用户界面将会僵死(例如包含那个按钮的窗口的菜单将暂不可用,而要等actionPerform完成返回后才可用). <br />
  通过SwingWorker,我们可以把这个较长的任务放到另外一个线程来实现,这样用户界面就不会僵死了. <br />
  这个SwingWorker是jdk1.6才引进的,.之前也有一个SwingWorker.但是它们有所不同:旧的SwingWorker是可重用的,而新的不能;另外它们的方法的名字也不一样. <br />
  SwingWorker主要有六个方法doInBackground,get,done,publish,process,execute <br />
  SwingWorker是一个泛型类,有两个类型参数.第一类型参数就是doInBackground和get的返回值的类型,而第二个类型参数是publish的形参类型....... <br />
  我们的较长任务是在doInBackground里完成的,doInBackground的返回值可以用get取得.get有无参和无参两个版本,参数代表的是等待doInBackground完成的时间,无参表示直到doInBackground完成,get才返回. <br />
  get要等到doInBackground完成才知道任务完成情况.怎么了解任务的执行过程呢?publish可以做到这一点.publish的参数个数是任意的,但是,每一个参数的类型都必须是SwingWorker的第二个类型参数指定的类型. <br />
  我们用publish向外界发布任务执行的情况,而用process来收集这些情况.process是在事件分发线程中执行的.在它被执行之前,SwingWorker的publish可能已经执行多次,所以process的参数是一个List,这样就可以包含所有publish了的情况. <br />
  done是在doInBackground执行完成之后执行的. <br />
  execute是使doInBackground开始执行. <br />
  以上的方法只有doInBackground是必须自己实现的,其他都是可选的. <br />
  下面是一个例子.在这个例子中有两个按钮.第一个按钮使SwingWorker开始工作,第二个按钮调用get方法取得doInBackground的返回值. <br />
  在SwingWorker开始工作以后但是还没有结束前按下第二个按钮,可以看到界面僵死了,这是因为我们在按钮的actionPerformed(在事件分发线程里调用)里调用了get,而无参的get在doInBackground返回前是不会返回的. <br />
  在doInBackground完成之后,我们再按下第一个按钮,程序并没有变化.这是因为SwingWorker是不可重用的.所以我们用匿名内部类来实现我们的SwingWorker. <br />
  在程序中我们还用到了publish和process.在process中,我们输出publish的结果.按下第二个按钮之前,process 每次只输出一个值,而在doInBackground返回之前按下第二个按钮,因为process是在事件分发线程里执行的,而get阻塞了事件分发线程,所以process不再输出了,而是等到最后连续输出数个值. </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import java.util.*; <br />
  import java.util.concurrent.ExecutionException; <br />
  <br />
  class SwingWorkerTest <br />
  { <br />
  JFrame mainFrame; <br />
  JPanel mainPanel; <br />
  JButton button; <br />
  JButton getButton; <br />
  public SwingWorkerTest() { <br />
  mainFrame = new JFrame (  ); <br />
  mainPanel = new JPanel (); <br />
  final javax.swing.SwingWorker&lt;Integer,Integer&gt; worker = <br />
  new javax.swing.SwingWorker&lt;Integer,Integer&gt;(){ <br />
  public Integer doInBackground(){ <br />
  int coutn = 0; <br />
  while( (coutn++)&lt;10 ){ <br />
  try{ <br />
  System.out.println( &quot;doInBackground() is doing a long job&quot; ); <br />
  Thread.sleep(1000); <br />
  publish( new Integer( (int)(Math.random()*1000) ) ); <br />
  }catch( InterruptedException e ){ <br />
  e.printStackTrace(); <br />
  } <br />
  } <br />
  return new Integer(3); <br />
  } <br />
  @Override <br />
  public void process(List&lt;Integer&gt; integers){ <br />
  int i = 0; <br />
  Iterator iterator = integers.iterator(); <br />
  while( iterator.hasNext() ){ <br />
  i++; <br />
  Integer integer = (Integer)iterator.next(); <br />
  System.out.println( &quot;在process输出publish的值&quot;+i+&quot;   &quot;+integer ); <br />
  } <br />
  } <br />
  }; <br />
  button = new JButton (&quot;start&quot;); <br />
  button.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  worker.execute(); <br />
  } <br />
  }); <br />
  getButton = new JButton (&quot;Get&quot;); <br />
  getButton.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  try{ <br />
  System.out.println( &quot;doInBackground的返回值: &quot;+worker.get() ); <br />
  }catch( InterruptedException ie ){ <br />
  ie.printStackTrace(); <br />
  }catch( ExecutionException ee ){ <br />
  ee.printStackTrace(); <br />
  } <br />
  } <br />
  }); <br />
  mainPanel.add(button); <br />
  mainPanel.add(getButton); <br />
  mainFrame.getContentPane().add( mainPanel ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new SwingWorkerTest(); <br />
  } <br />
  } <br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import java.util.*;<br />
  import java.util.concurrent.ExecutionException;</p>
<p>class SwingWorkerTest <br />
  {<br />
  JFrame mainFrame;<br />
  JPanel mainPanel;<br />
  JButton button;<br />
  JButton getButton;<br />
  public SwingWorkerTest() {<br />
  mainFrame = new JFrame (  );<br />
  mainPanel = new JPanel ();<br />
  final javax.swing.SwingWorker&lt;Integer,Integer&gt; worker = <br />
  new javax.swing.SwingWorker&lt;Integer,Integer&gt;(){<br />
  public Integer doInBackground(){<br />
  int coutn = 0;<br />
  while( (coutn++)&lt;10 ){<br />
  try{<br />
  System.out.println( &quot;doInBackground() is doing a long job&quot; );<br />
  Thread.sleep(1000);<br />
  publish( new Integer( (int)(Math.random()*1000) ) );<br />
  }catch( InterruptedException e ){<br />
  e.printStackTrace();<br />
  }<br />
  }<br />
  return new Integer(3);<br />
  }<br />
  @Override<br />
  public void process(List&lt;Integer&gt; integers){<br />
  int i = 0;<br />
  Iterator iterator = integers.iterator();<br />
  while( iterator.hasNext() ){<br />
  i++;<br />
  Integer integer = (Integer)iterator.next();<br />
  System.out.println( &quot;在process输出publish的值&quot;+i+&quot;   &quot;+integer );<br />
  }<br />
  }<br />
  };<br />
  button = new JButton (&quot;start&quot;);<br />
  button.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  worker.execute();<br />
  }<br />
  });<br />
  getButton = new JButton (&quot;Get&quot;);<br />
  getButton.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  try{<br />
  System.out.println( &quot;doInBackground的返回值: &quot;+worker.get() );<br />
  }catch( InterruptedException ie ){<br />
  ie.printStackTrace();<br />
  }catch( ExecutionException ee ){<br />
  ee.printStackTrace();<br />
  }<br />
  }<br />
  });<br />
  mainPanel.add(button);<br />
  mainPanel.add(getButton);<br />
  mainFrame.getContentPane().add( mainPanel );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new SwingWorkerTest();<br />
  }<br />
  }<br />
</p>
<p>除了用JProgressBar来显示进度,我们还可以用ProgressMonitor来实现. <br />
  ProgressMonitor提供了创建进度条的简便方法,它显示的进度条出现在一个对话框里 <br />
  它只有一个构造方法:ProgressMonitor(Component parentComponent, Object message, String note, int min, int max) <br />
  message和note参数都是和进度条一起显示在对话框里,不同的是,note是可变的,而message不可以.min和max是进度的最小值和最大值 <br />
  这个对话框并不是在任务一开始就显示出来的,而是等500个百万分之一秒再出来,这个&quot;500&quot;可以用void setMillisToPopup(int millisToPopup)来设定,参数的单位是百万分之一秒;而且,如果它计算得知这个任务用时不超过2000个百万分之一秒,那么这个对话框就永远不会出来.这个&quot;2000&quot;,可以用void setMillisToDecideToPopup(int)来设定,参数的单位也是百万分之一秒 <br />
  它其他的方法有: <br />
  int getMillisToPopup() <br />
  void setMinimum(int m),void setMaximum(int m),void setNote(String note),void setProgress(int nv) <br />
  int getMinimum() , int getMaximum() ,String getNote() ,没有int getProgress() <br />
  boolean isCanceled() <br />
  这里再介绍SwingWorker的几个方法: <br />
  setProgress:设置任务的进度 <br />
  getProgress:得到任务的进度 <br />
  可以用addPropertyChangeListener(PropertyChangeLitener)对上面两个方法的调用作出响应 <br />
  cancel(boolean):取消任务 <br />
  isCancelled():判断任务是否已被取消 <br />
  下面是一个例子. </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.awt.*; <br />
  import javax.swing.*; <br />
  import java.awt.event.*; <br />
  import java.util.Random; <br />
  import java.beans.*; <br />
  <br />
  class ProgressMonitorDemo <br />
  { <br />
  JFrame mainFrame; <br />
  ProgressMonitor simpleProgressMonitor; <br />
  JButton startButton; <br />
  Worker worker; <br />
  public ProgressMonitorDemo() { <br />
  mainFrame = new JFrame ( &quot;ProgressMonitorDemo&quot; ); <br />
  startButton = new JButton (&quot;Start&quot;); <br />
  startButton.addActionListener( new ActionListener(){ <br />
  public void actionPerformed( ActionEvent e){ <br />
  simpleProgressMonitor = new ProgressMonitor(mainFrame,&quot;正在执行任务&quot;,&quot;&quot;,0,100); <br />
  simpleProgressMonitor.setMillisToDecideToPopup(0); <br />
  simpleProgressMonitor.setMillisToPopup(0); <br />
  worker = new Worker(); <br />
  worker.addPropertyChangeListener( new PropertyChangeListener(){ <br />
  public void propertyChange( PropertyChangeEvent e ){ <br />
  if( &quot;progress&quot;.equals( e.getPropertyName() )){ <br />
  int progress = (Integer)e.getNewValue(); <br />
  simpleProgressMonitor.setProgress( progress ); <br />
  String message = String.format(&quot;%d%% completed&quot;,progress); <br />
  simpleProgressMonitor.setNote(message); <br />
  } <br />
  } <br />
  }); <br />
  worker.execute(); <br />
  startButton.setEnabled(false); <br />
  } <br />
  } ); <br />
  mainFrame.getContentPane().add( startButton,BorderLayout.LINE_START ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  <br />
  public static void main(String[] args) <br />
  { <br />
  new ProgressMonitorDemo(); <br />
  } <br />
  class Worker extends javax.swing.SwingWorker&lt;Void,Void&gt;{ <br />
  public Void doInBackground(){ <br />
  int progress = 0; <br />
  Random r = new Random(); <br />
  while( progress&lt;=100 &amp;&amp; !isCancelled() ){ <br />
  progress += r.nextInt(10); <br />
  setProgress( Math.min(progress,100) ); <br />
  try{ <br />
  Thread.sleep( r.nextInt(1000) ); <br />
  }catch( InterruptedException e ){ <br />
  e.printStackTrace(); <br />
  } <br />
  } <br />
  return null; <br />
  } <br />
  public void done(){ <br />
  startButton.setEnabled(true); <br />
  } <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.awt.*;<br />
  import javax.swing.*;<br />
  import java.awt.event.*;<br />
  import java.util.Random;<br />
  import java.beans.*;</p>
<p>class ProgressMonitorDemo<br />
  {<br />
  JFrame mainFrame;<br />
  ProgressMonitor simpleProgressMonitor;<br />
  JButton startButton;<br />
  Worker worker;<br />
  public ProgressMonitorDemo() {<br />
  mainFrame = new JFrame ( &quot;ProgressMonitorDemo&quot; );<br />
  startButton = new JButton (&quot;Start&quot;);<br />
  startButton.addActionListener( new ActionListener(){<br />
  public void actionPerformed( ActionEvent e){<br />
  simpleProgressMonitor = new ProgressMonitor(mainFrame,&quot;正在执行任务&quot;,&quot;&quot;,0,100);<br />
  simpleProgressMonitor.setMillisToDecideToPopup(0);<br />
  simpleProgressMonitor.setMillisToPopup(0);<br />
  worker = new Worker();<br />
  worker.addPropertyChangeListener( new PropertyChangeListener(){<br />
  public void propertyChange( PropertyChangeEvent e ){<br />
  if( &quot;progress&quot;.equals( e.getPropertyName() )){<br />
  int progress = (Integer)e.getNewValue();<br />
  simpleProgressMonitor.setProgress( progress );<br />
  String message = String.format(&quot;%d%% completed&quot;,progress);<br />
  simpleProgressMonitor.setNote(message);<br />
  }<br />
  }<br />
  });<br />
  worker.execute();<br />
  startButton.setEnabled(false);<br />
  }<br />
  } );<br />
  mainFrame.getContentPane().add( startButton,BorderLayout.LINE_START );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }</p>
<p> public static void main(String[] args) <br />
  {<br />
  new ProgressMonitorDemo();<br />
  }<br />
  class Worker extends javax.swing.SwingWorker&lt;Void,Void&gt;{<br />
  public Void doInBackground(){<br />
  int progress = 0;<br />
  Random r = new Random();<br />
  while( progress&lt;=100 &amp;&amp; !isCancelled() ){<br />
  progress += r.nextInt(10);<br />
  setProgress( Math.min(progress,100) );<br />
  try{<br />
  Thread.sleep( r.nextInt(1000) );<br />
  }catch( InterruptedException e ){<br />
  e.printStackTrace();<br />
  }<br />
  }<br />
  return null;<br />
  }<br />
  public void done(){<br />
  startButton.setEnabled(true);<br />
  }<br />
  }<br />
  }<br />
</p>
<p>20.JTabbedPane <br />
  选项卡. <br />
  构造方法:JTabbedPane() ,JTabbedPane(int tabPlacement) ,JTabbedPane(int tabPlacement, int tabLayoutPolicy) <br />
  添加选项卡: <br />
  void addTab(String title, Component component) <br />
  void addTab(String title, Icon icon, Component component) <br />
  void addTab(String title, Icon icon, Component component, String tip) <br />
  void insertTab(String title, Icon icon, Component component, String tip, int index) <br />
  删除选项卡: <br />
  void remove(int index) <br />
  void removeAll() <br />
  void removeTabAt(int index) <br />
  修改选项卡上显示的组件: <br />
  void setComponentAt(int index, Component component) <br />
  Component getComponentAt(int index) <br />
  设置外观: <br />
  void setTabPlacement(int tabPlacement):JTabbedPane.TOP, JTabbedPane.BOTTOM ,JTabbedPane.LEFT,JTabbedPane.RIGHT <br />
  void setTabLayoutPolicy(int tabLayoutPolicy) :JTabbedPane.WRAP_TAB_LAYOUT ,JTabbedPane.SCROLL_TAB_LAYOUT <br />
  void setTitleAt(int index, String title) <br />
  void setToolTipTextAt(int index, String toolTipText) <br />
  void setIconAt(int index, Icon icon) <br />
  void setBackgroundAt(int index, Color background) <br />
  void setForegroundAt(int index, Color foreground) <br />
  查找选项卡: <br />
  int indexAtLocation(int x, int y) <br />
  int indexOfComponent(Component component) <br />
  int indexOfTab(Icon icon) <br />
  int indexOfTab(String title) <br />
  和选择有关的: <br />
  int getSelectedIndex() <br />
  void setSelectedIndex(int index) <br />
  Component getSelectedComponent() <br />
  void setSelectedComponent(Component c) <br />
  自定义标签上的组件: <br />
  void setTabComponentAt(int index, Component c); <br />
  Component getTabComponentAt(int index); </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import javax.swing.*; <br />
  import java.awt.Color; <br />
  class JTabbedPaneDemo <br />
  { <br />
  JFrame mainFrame; <br />
  JTabbedPane simpleTabbedPane; <br />
  public JTabbedPaneDemo() { <br />
  mainFrame = new JFrame ( &quot;JTabbedPaneDemo&quot; ); <br />
  simpleTabbedPane = new JTabbedPane(); <br />
  simpleTabbedPane.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); <br />
  simpleTabbedPane.addTab(&quot;Tab1&quot;,new JLabel (&quot;Component1&quot;)); <br />
  simpleTabbedPane.addTab(&quot;Tab2&quot;,new JLabel (&quot;Component2&quot;)); <br />
  simpleTabbedPane.addTab(&quot;Tab3&quot;,new JLabel (&quot;Component3&quot;)); <br />
  simpleTabbedPane.addTab(&quot;Tab4&quot;,new JLabel (&quot;Component4&quot;)); <br />
  for(int i=0; i&lt;4; i++){ <br />
  simpleTabbedPane.setTabComponentAt( i,new JButton (&quot;&quot;+i)); <br />
  simpleTabbedPane.setBackgroundAt(i,Color.white); <br />
  } <br />
  mainFrame.getContentPane().add( simpleTabbedPane ); <br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); <br />
  mainFrame.pack(); <br />
  mainFrame.setLocationRelativeTo(null); <br />
  mainFrame.setVisible( true ); <br />
  } <br />
  public static void main(String[] args) <br />
  { <br />
  new JTabbedPaneDemo(); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import javax.swing.*;<br />
  import java.awt.Color;<br />
  class JTabbedPaneDemo <br />
  {<br />
  JFrame mainFrame;<br />
  JTabbedPane simpleTabbedPane;<br />
  public JTabbedPaneDemo() {<br />
  mainFrame = new JFrame ( &quot;JTabbedPaneDemo&quot; );<br />
  simpleTabbedPane = new JTabbedPane();<br />
  simpleTabbedPane.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT );<br />
  simpleTabbedPane.addTab(&quot;Tab1&quot;,new JLabel (&quot;Component1&quot;));<br />
  simpleTabbedPane.addTab(&quot;Tab2&quot;,new JLabel (&quot;Component2&quot;));<br />
  simpleTabbedPane.addTab(&quot;Tab3&quot;,new JLabel (&quot;Component3&quot;));<br />
  simpleTabbedPane.addTab(&quot;Tab4&quot;,new JLabel (&quot;Component4&quot;));<br />
  for(int i=0; i&lt;4; i++){<br />
  simpleTabbedPane.setTabComponentAt( i,new JButton (&quot;&quot;+i));<br />
  simpleTabbedPane.setBackgroundAt(i,Color.white);<br />
  }<br />
  mainFrame.getContentPane().add( simpleTabbedPane );<br />
  mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
  mainFrame.pack();<br />
  mainFrame.setLocationRelativeTo(null);<br />
  mainFrame.setVisible( true );<br />
  }<br />
  public static void main(String[] args) <br />
  {<br />
  new JTabbedPaneDemo();<br />
  }<br />
  }<br />
</p>
<p>21.JFormattedTextField <br />
  在讲JFormattedTextField之前,先讲用于指定格式的类: <br />
  Locale,NumberFormat,DecimalFormat,DecimalFormatSymbols,DateFormat,SimpleDateFormat,DateFormatSymbols <br />
  根据地区/语言(Locale)的不同,各种数字,日期的格式会有所不同.例如902333这个数字在德国会写作902.333,而在美国写作902,333 <br />
  创建Locale可以使用它的构造方法,也可以使用它的一些常量.例如下面两个语句是等价的: <br />
  Locale locale1 = new Locale(&quot;zh&quot;,&quot;CN&quot;); <br />
  Locale locale2 = Locale.CHINA; <br />
  上面用到的&quot;zh&quot;(小写)和&quot;CN&quot;(大写)分别遵循着一定的规定,在下面的链接可以找到这些搭配: <br />
  http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt <br />
  http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html <br />
  你可以用任意的&quot;xx&quot;和&quot;XX&quot;搭配来创建Locale,但是,并不是所有都是有意义的,即Locale不一定可被上面的XXXFormat使用. <br />
  使用下面的程序可以得到DateFormat可以使用的组合: </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.util.Locale; <br />
  import java.text.DateFormat; <br />
  class AvailableLocale <br />
  { <br />
  public static void main(String[] args) <br />
  { <br />
  Locale[] locales = DateFormat.getAvailableLocales(); <br />
  for( Locale locale : locales ){ <br />
  System.out.println( locale.toString()); <br />
  //System.out.println( locale.getDisplayName() ); <br />
  } <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.util.Locale;<br />
  import java.text.DateFormat;<br />
  class AvailableLocale <br />
  {<br />
  public static void main(String[] args) <br />
  {<br />
  Locale[] locales = DateFormat.getAvailableLocales();<br />
  for( Locale locale : locales ){<br />
  System.out.println( locale.toString());<br />
  //System.out.println( locale.getDisplayName() );<br />
  }<br />
  }<br />
  }<br />
</p>
<p>如果你不设定Locale,XXXFormat将使用默认的Locale.这个默认的Locale是和你所用的系统有关的 <br />
  用Locale.getDefault()可以得到默认的Locale <br />
  NumberFormat可以用于数字,货币和百分数的格式化(根据不同的Locale).对于数字,货币和百分数,分别调用静态方法getNumberInstanc(Locale), <br />
  getCurrencyInstance(Locale),getPercentInstance(Locale)来取得实例,再用String format(double)来返回格式化后的字符串. <br />
  DecimalFormat是NumberFormat的子类,它对格式提供了更多的控制.在构造它的时候可以指定数字显示格式.它不可以直接指定Locale.要指定Locale的时候,可以把一个NumberFormat强制转换为DecimalFormat,再调用 applyPattern(String pattern)来指定数字格式. <br />
  同样它用String format(double)来返回格式化后的字符串. <br />
  可以用DecimalFormatSymbols来指定数字里面的各个符号,例如小数点.在DecimalFormat的构造方法里传入 DecimalFormatSymbols就可以了.DecimalFormatSymbols还可以指定Locale,所以用了 DecimalFormatSymbols就不用将一个NumberFormat转换为Decimalformat以指定Locale了 </p>
<p>&nbsp;</p>
<p>Java代码 <br />
  package blog.swing; <br />
  import java.util.Locale; <br />
  import java.text.NumberFormat; <br />
  import java.text.DecimalFormat; <br />
  import java.text.DecimalFormatSymbols; <br />
  class NumberFormatDemo{ <br />
  public static void main( String[] args ){ <br />
  double number = 96356.127; <br />
  double currency = 56832.523; <br />
  double percent = 0.72; <br />
  String out; <br />
  Locale locales[] = { Locale.CHINA,Locale.US,Locale.GERMANY }; <br />
  NumberFormat formats = NumberFormat.getNumberInstance(); <br />
  for( int i=0; i&lt;3; i++){ <br />
  formats = NumberFormat.getNumberInstance( locales[i] ); <br />
  out = formats.format( number ); <br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() ); <br />
  formats = NumberFormat.getCurrencyInstance( locales[i] ); <br />
  out = formats.format( currency ); <br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() ); <br />
  formats = NumberFormat.getPercentInstance( locales[i] ); <br />
  out = formats.format( percent ); <br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() ); <br />
  } <br />
  DecimalFormat df = new DecimalFormat(); <br />
  String pattern = &quot;@#,###.##&quot;; <br />
  df.applyPattern( pattern ); <br />
  out = df.format(number); <br />
  System.out.println( out ); <br />
  pattern = &quot;#@###.####&quot;; <br />
  df.applyPattern( pattern ); <br />
  out = df.format(number); <br />
  System.out.println( out ); <br />
  df = (DecimalFormat)formats; <br />
  df.applyPattern(&quot;#,###.##&quot;); <br />
  out = df.format(number); <br />
  System.out.println( out ); <br />
  DecimalFormatSymbols dfss = new DecimalFormatSymbols(Locale.GERMANY); <br />
  dfss.setDecimalSeparator('^'); <br />
  df.setDecimalFormatSymbols( dfss ); <br />
  df.applyPattern(&quot;00,000.000&quot;); <br />
  out = df.format(number); <br />
  System.out.println( out ); <br />
  } <br />
  } <br />
  package blog.swing;<br />
  import java.util.Locale;<br />
  import java.text.NumberFormat;<br />
  import java.text.DecimalFormat;<br />
  import java.text.DecimalFormatSymbols;<br />
  class NumberFormatDemo{<br />
  public static void main( String[] args ){<br />
  double number = 96356.127;<br />
  double currency = 56832.523;<br />
  double percent = 0.72;<br />
  String out;<br />
  Locale locales[] = { Locale.CHINA,Locale.US,Locale.GERMANY };<br />
  NumberFormat formats = NumberFormat.getNumberInstance();<br />
  for( int i=0; i&lt;3; i++){<br />
  formats = NumberFormat.getNumberInstance( locales[i] );<br />
  out = formats.format( number );<br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() );<br />
  formats = NumberFormat.getCurrencyInstance( locales[i] );<br />
  out = formats.format( currency );<br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() );<br />
  formats = NumberFormat.getPercentInstance( locales[i] );<br />
  out = formats.format( percent );<br />
  System.out.println( out+&quot;  &quot;+locales[i].getDisplayName() );<br />
  }<br />
  DecimalFormat df = new DecimalFormat();<br />
  String pattern = &quot;@#,###.##&quot;;<br />
  df.applyPattern( pattern );<br />
  out = df.format(number);<br />
  System.out.println( out );<br />
  pattern = &quot;#@###.####&quot;;<br />
  df.applyPattern( pattern );<br />
  out = df.format(number);<br />
  System.out.println( out );<br />
  df = (DecimalFormat)formats;<br />
  df.applyPattern(&quot;#,###.##&quot;);<br />
  out = df.format(number);<br />
  System.out.println( out );<br />
  DecimalFormatSymbols dfss = new DecimalFormatSymbols(Locale.GERMANY);<br />
  dfss.setDecimalSeparator('^');<br />
  df.setDecimalFormatSymbols( dfss );<br />
  df.applyPattern(&quot;00,000.000&quot;);<br />
  out = df.format(number);<br />
  System.out.println( out );<br />
  }<br />
  }<br />
</p>
<p>pattern的格式应满足: <br />
  pattern    := subpattern{;subpattern} <br />
  subpattern := {prefix}integer{.fraction}{suffix} <br />
  prefix     := '\\u0000'..'\\uFFFD' - specialCharacters <br />
  suffix     := '\\u0000'..'\\uFFFD' - specialCharacters <br />
  integer    := '#'* '0'* '0' <br />
  fraction   := '0'* '#'* <br />
  上面讲的都是和数字有关的,下面讲的是和日期和时间有关的 <br />
  和日期,时间有关的格式用DateFo
