﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客网-青蛙學堂-随笔分类-軟件布袋</title><link>http://www.cnitblog.com/yide/category/1524.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 06 Nov 2007 08:17:43 GMT</lastBuildDate><pubDate>Tue, 06 Nov 2007 08:17:43 GMT</pubDate><ttl>60</ttl><item><title>html--css</title><link>http://www.cnitblog.com/yide/archive/2007/11/06/35917.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 06 Nov 2007 01:28:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/11/06/35917.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/35917.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/11/06/35917.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/35917.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/35917.html</trackback:ping><description><![CDATA[<p><span>&nbsp;
<p>CSS全称Cascading Style Sheet。层叠式样式表。<br>一、CSS的四种实现方式：<br>1.内嵌式：</p>
<p>2.外链式：</p>
<p>3.导入式</p>
<p>4.属性式：</p>
<p>二.CSS的定义：<br>选择对象{属性1:值1;属性2:值2;属性3:值3;属性n:值n&#8230;&#8230;}<br>如：<br>td{font-size:12px;color:#FFFF00}<br>.myname{font-size:12px;color:#FFFF00}<br>a:hover{font-size:12px;color:#FFFF00;text-decoration: underline;}</p>
<p>三.四种选择对象<br>1.HTML selector (TagName)<br>2.class selector (.NAME)<br>3.ID selector (#IDname)<br>4.特殊对象 (a:hover　a:link　a:visited　a:active)</p>
<p>1.HTML selector<br>HTML selector就是HTML的置标符，如：DIV、TD、H1。HTML selector的作用范围是应用了该样式的所有页面中的所有该置标符。<br>例：<br>td<br>{<br>color: #FF0000;<br>} <br>--&gt;<br>注意：代码的作用是使表格单元格内文字自动变红色。</p>
<p>2.class selector<br>定义class selector需要往其名称其加一个点&#8220;.&#8221;。如&#8220;.classname&#8221;。class selector的作用范围是所有包含&#8220;class="classname"&#8221;的置标符。<br>例：<br>.fontRed<br>{<br>color: #FF0000; <br>}<br>--&gt;<br>注意：在第二个中没有&#8220;class="fontRed"&#8221;，所以文字没有变红色。</p>
<p>3.ID selector<br>定义ID selector需要往其名称其加一个点&#8220;#&#8221;。如&#8220;#IDname&#8221;。ID selector的作用范围是所有包含&#8220;ID="classname"&#8221;的置标符。<br>例：</p>
<p>#fontRed<br>{<br>color: #FF0000;<br>}<br>--&gt;&nbsp;&nbsp;<br>注意：在第二个中没有&#8220;ID="fontRed"&#8221;，所以文字没有变红色。</p>
<p>4.特殊对象<br>特殊对象包括四种，是针对链接对象设置的:<br>a:hover 鼠标移上时的超链接<br>a:link 常规，非访问超链接<br>a:visited 访问过的超链接<br>a:active 鼠标点击时的超链接<br>特殊对象的作用范围是所有置标符（这句话有待商榷，因为下面很快就有一种方法可以把&#8220;所有&#8221;两个字推翻）。<br>例：<br>a:hover<br>{<br>color: #0000FF;<br>text-decoration: underline;<br>}<br>--&gt;<br>注意下面，很有用！！！<br>a.classname:hover<br>a#IDname:hover<br>这两种写法，是分别配合.classname与#IDname使用的。它的作用范围变成了所有包含&#8220;class="classname"&#8221;或&#8220;ID="IDname"&#8221;的置标符。这种写法，可以帮助你在同一页面中实现多种a:hover效果，可以看一下艺网的主页上导航栏文字与普通文章标题在鼠标时的区别。</p>
<p>四.应用：<br>1.置标符　自动应用<br>2.特制类　class="NAME"<br>3.ID&nbsp;&nbsp; ID="IDname"<br>4.特殊对象　自动应用<br>五.CSS属性<br>CSS的属性有很多，像上文中用到最多的color，表示文字的颜色。background-color表示背景色。这个是最主要的，但是因为没有什么难度，参考一下相关手册就可以了。</p>
<p>CSS 标签属性/属性参考<br>这里列出了目前支持的样式表(CSS)标签属性。</p>
<p><strong>CSS 标签属性/属性</strong></p>
<p>行为属性 behavior</p>
<p>字体和文本属性 direction<br>direction <br>font <br>font-family <br>font-size <br>font-style <br>font-variant <br>font-weight <br>ime-mode<br>layout-grid<br>layout-grid-char<br>layout-grid-line<br>layout-grid-mode<br>layout-grid-type<br>letter-spacing <br>line-break<br>line-height <br>min-height<br>ruby-align<br>ruby-overhang<br>ruby-position<br>text-align <br>text-autospace<br>text-decoration <br>text-indent <br>text-justify<br>text-kashida-space<br>text-overflow <br>text-transform <br>text-underline-position<br>unicode-bidi <br>vertical-align <br>white-space<br>word-break<br>word-wrap<br>writing-mode<br></p>
</span>
<img src ="http://www.cnitblog.com/yide/aggbug/35917.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-11-06 09:28 <a href="http://www.cnitblog.com/yide/archive/2007/11/06/35917.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c#--menu</title><link>http://www.cnitblog.com/yide/archive/2007/11/05/35890.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 05 Nov 2007 07:08:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/11/05/35890.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/35890.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/11/05/35890.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/35890.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/35890.html</trackback:ping><description><![CDATA[<p>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"&gt;<br>&lt;html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"&gt;<br>&lt;head&gt;<br>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;<br>&lt;title&gt;二?dropdown?出菜?--A CROSS BROWSER DROP DOWN CASCADING VALIDATING MENU&lt;/title&gt;<br>&lt;style type="text/css"&gt;<br>/* common styling */<br>/* set up the overall width of the menu div, the font and the margins */</p>
<p>.menu {<br>font-family: arial, sans-serif; <br>width:750px; <br>margin:0; <br>margin:50px 0;<br>}<br>/* remove the bullets and set the margin and padding to zero for the unordered list */<br>.menu ul {<br>padding:0; <br>margin:0;<br>list-style-type: none;<br>}<br>/* float the list so that the items are in a line and their position relative so that the drop down list will appear in the right place underneath each list item */<br>.menu ul li {<br>float:left; <br>position:relative;<br>}<br>/* style the links to be 104px wide by 30px high with a top and right border 1px solid white. Set the background color and the font size. */<br>.menu ul li a, .menu ul li a:visited {<br>display:block; <br>text-align:center; <br>text-decoration:none; <br>width:104px; <br>height:30px; <br>color:#000; <br>border:1px solid #fff;<br>border-width:1px 1px 0 0;<br>background:#c9c9a7; <br>line-height:30px; <br>font-size:11px;<br>}<br>/* make the dropdown ul invisible */<br>.menu ul li ul {<br>display: none;<br>}</p>
<p>/* specific to non IE browsers */<br>/* set the background and foreground color of the main menu li on hover */<br>.menu ul li:hover a {<br>color:#fff; <br>background:#b3ab79;<br>}<br>/* make the sub menu ul visible and position it beneath the main menu list item */<br>.menu ul li:hover ul {<br>display:block; <br>position:absolute; <br>top:31px; <br>left:0; <br>width:105px;<br>}<br>/* style the background and foreground color of the submenu links */<br>.menu ul li:hover ul li a {<br>display:block; <br>background:#faeec7; <br>color:#000;<br>}<br>/* style the background and forground colors of the links on hover */<br>.menu ul li:hover ul li a:hover {<br>background:#dfc184; <br>color:#000;<br>}</p>
<p>&lt;/style&gt;<br>&lt;!--[if lte IE 6]&gt;</p>
<p>&lt;style type="text/css"&gt;<br>/* styling specific to Internet Explorer IE5.5 and IE6. Yet to see if IE7 handles li:hover */</p>
<p>/* Get rid of any default table style */<br>table {<br>border-collapse:collapse;<br>margin:0; <br>padding:0;<br>}<br>/* ignore the link used by 'other browsers' */<br>.menu ul li a.hide, .menu ul li a:visited.hide {<br>display:none;<br>}<br>/* set the background and foreground color of the main menu link on hover */<br>.menu ul li a:hover {<br>color:#fff; <br>background:#b3ab79;<br>}<br>/* make the sub menu ul visible and position it beneath the main menu list item */<br>.menu ul li a:hover ul {<br>display:block; <br>position:absolute; <br>top:32px; <br>left:0; <br>width:105px;<br>}<br>/* style the background and foreground color of the submenu links */<br>.menu ul li a:hover ul li a {<br>background:#faeec7; <br>color:#000;<br>}<br>/* style the background and forground colors of the links on hover */<br>.menu ul li a:hover ul li a:hover {<br>background:#dfc184; <br>color:#000;<br>}</p>
<p>&lt;/style&gt;</p>
<p>&lt;![endif]--&gt;<br>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;div class="menu"&gt;</p>
<p>&lt;ul&gt;<br>&lt;li&gt;&lt;a class="hide" href="../menu/index.html"&gt;DEMOS&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../menu/index.html"&gt;DEMOS<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/zero_dollars.html" title="The zero dollar ads page"&gt;zero dollars&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/embed.html" title="Wrapping text around images"&gt;wrapping text&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/form.html" title="Styling forms"&gt;styled form&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/nodots.html" title="Removing active/focus borders"&gt;active focus&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/shadow_boxing.html" title="Multi-position drop shadow"&gt;shadow boxing&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/old_master.html" title="Image Map for detailed information"&gt;image map&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/bodies.html" title="fun with background images"&gt;fun backgrounds&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/fade_scroll.html" title="fade-out scrolling"&gt;fade scrolling&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../menu/em_images.html" title="em size images compared"&gt;em sized images&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="index.html"&gt;MENUS&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="index.html"&gt;MENUS<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="spies.html" title="a coded list of spies"&gt;spies menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="vertical.html" title="a horizontal vertical menu"&gt;vertical menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="expand.html" title="an enlarging unordered list"&gt;enlarging list&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="enlarge.html" title="an unordered list with link images"&gt;link images&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="cross.html" title="non-rectangular links"&gt;non-rectangular&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="jigsaw.html" title="jigsaw links"&gt;jigsaw links&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="circles.html" title="circular links"&gt;circular links&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="../layouts/index.html"&gt;LAYOUTS&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../layouts/index.html"&gt;LAYOUTS<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../layouts/bodyfix.html" title="Cross browser fixed layout"&gt;Fixed 1&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../layouts/body2.html" title="Cross browser fixed layout"&gt;Fixed 2&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../layouts/body4.html" title="Cross browser fixed layout"&gt;Fixed 3&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../layouts/body5.html" title="Cross browser fixed layout"&gt;Fixed 4&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../layouts/minimum.html" title="A simple minimum width layout"&gt;minimum width&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="../boxes/index.html"&gt;BOXES&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../boxes/index.html"&gt;BOXES<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="spies.html" title="a coded list of spies"&gt;spies menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="vertical.html" title="a horizontal vertical menu"&gt;vertical menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="expand.html" title="an enlarging unordered list"&gt;enlarging list&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="enlarge.html" title="an unordered list with link images"&gt;link images&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="cross.html" title="non-rectangular links"&gt;non-rectangular&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="jigsaw.html" title="jigsaw links"&gt;jigsaw links&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="circles.html" title="circular links"&gt;circular links&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="../mozilla/index.html"&gt;MOZILLA&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../mozilla/index.html"&gt;MOZILLA<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/dropdown.html" title="A drop down menu"&gt;drop down menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/cascade.html" title="A cascading menu"&gt;cascading menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/content.html" title="Using content:"&gt;content:&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/moxbox.html" title=":hover applied to a div"&gt;mozzie box&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/rainbow.html" title="I can build a rainbow"&gt;rainbow box&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/snooker.html" title="Snooker cue"&gt;snooker cue&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/target.html" title="Target Practise"&gt;target practise&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/splittext.html" title="Two tone headings"&gt;two tone headings&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../mozilla/shadow_text.html" title="Shadow text"&gt;shadow text&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="../ie/index.html"&gt;EXPLORER&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../ie/index.html"&gt;EXPLORER<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../ie/exampleone.html" title="Example one"&gt;example one&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../ie/weft.html" title="Weft fonts"&gt;weft fonts&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../ie/exampletwo.html" title="Vertical align"&gt;vertical align&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;li&gt;&lt;a class="hide" href="../opacity/index.html"&gt;OPACITY&lt;/a&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;a href="../opacity/index.html"&gt;OPACITY<br>&lt;table&gt;&lt;tr&gt;&lt;td&gt;<br>&lt;![endif]--&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;ul&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../opacity/colours.html" title="colour wheel"&gt;opaque colours&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../opacity/picturemenu.html" title="a menu using opacity"&gt;opaque menu&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../opacity/png.html" title="partial opacity"&gt;partial opacity&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;li&gt;&lt;a href="../opacity/png2.html" title="partial opacity II"&gt;partial opacity II&lt;/a&gt;&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/ul&gt;</p>
<p>&lt;!--[if lte IE 6]&gt;<br>&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br>&lt;/a&gt;<br>&lt;![endif]--&gt;</p>
<p>&lt;/li&gt;<br>&lt;/ul&gt;</p>
<p>&lt;!-- clear the floats if required --&gt;<br>&lt;div class="clear"&gt;&amp;nbsp;&lt;/div&gt;</p>
<p>&lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></p>
<img src ="http://www.cnitblog.com/yide/aggbug/35890.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-11-05 15:08 <a href="http://www.cnitblog.com/yide/archive/2007/11/05/35890.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#_Conn_db</title><link>http://www.cnitblog.com/yide/archive/2007/10/30/35588.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 30 Oct 2007 06:06:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/10/30/35588.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/35588.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/10/30/35588.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/35588.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/35588.html</trackback:ping><description><![CDATA[<div align=center>
<h1 class=aTitle>深入分析ADO.NET中的DataSet对象</h1>
</div>
<table width="97%" align=center>
    <tbody>
        <tr>
            <td width=120>[日期：<span id=TimeLabel>2006-1-6</span>]</td>
            <td align=middle>来源：<span id=SourceLabel></span>&nbsp; 作者：<span id=AuthorLabel></span></td>
            <td align=right width=100>[字体：<a href="javascript:ContentSize(16)"><u><font color=#0000ff>大</font></u></a> <a href="javascript:ContentSize(14)"><u><font color=#0000ff>中</font></u></a> <a href="javascript:ContentSize(12)"><u><font color=#0000ff>小</font></u></a>] </td>
        </tr>
    </tbody>
</table>
<div class=content id=BodyLabel style="PADDING-RIGHT: 10px; DISPLAY: block; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">　　ADO.NET是.Net FrameWork SDK中用以操作数据库的类库的总称。而DataSet类则是ADO.NET中最核心的成员之一，也是各种开发基于.Net平台程序语言开发数据库应用程序最常接触的类。之所以DataSet类在ADO.NET中具有特殊的地位，是因为DataSet在ADO.NET实现从数据库抽取数据中起到关键作用，在从数据库完成数据抽取后，DataSet就是数据的存放地，它是各种数据源中的数据在计算机内存中映射成的缓存，所以有时说DataSet可以看成是一个数据容器。同时它在客户端实现读取、更新数据库等过程中起到了中间部件的作用（DataReader只能检索数据库中的数据）。<br><br>　　各种.Net平台开发语言开发数据库应用程序，一般并不直接对数据库操作（直接在程序中调用存储过程等除外），而是先完成数据连接和通过数据适配器填充DataSet对象，然后客户端再通过读取DataSet来获得需要的数据，同样更新数据库中数据，也是首先更新DataSet，然后再通过DataSet来更新数据库中对应的数据的。可见了解、掌握ADO.NET，首先必须了解、掌握DataSet。DataSet主要有三个特性：<br><br>　　1. 独立性。DataSet独立于各种数据源。微软公司在推出DataSet时就考虑到各种数据源的多样性、复杂性。在.Net中，无论什么类型数据源，它都会提供一致的关系编程模型，而这就是DataSet。<br><br>　　2. 离线（断开）和连接。DataSet既可以以离线方式，也可以以实时连接来操作数据库中的数据。这一点有点像ADO中的RecordSet。<br><br>　　3. DataSet对象是一个可以用XML形式表示的数据视图，是一种数据关系视图。<br><br>　　<strong>一.DataSet对象的结构模型及和RecordSet的比较</strong><br><br>　　虽说ADO.NET是 ADO在.Net平台下得后继版本，但二者的区别是很大的。突出表现在ADO中的RecordSet对象和ADO.NET中的DataSet对象。RecordSet其实也是非常灵活的一个对象，微软公司推出它也是煞费苦心，如：RecordSet可以离线操作数据库，性能优良，效率较高等等这些都让当时的程序员为之一振。RecordSet虽然已经很复杂，但DataSet却比RecordSet复杂的多，我们知道每一DataSet往往是一个或多个DataTable 对象的集合，这些对象由数据行和数据列以及主键、外键、约束和有关DataTable对象中数据的关系信息组成。而RecordSet只能存放单张数据表，虽然这张数据表可以由几张数据表JOIN生成。所以有些时候说，RecordSet更类似于DataSet中的DataTable。DataSet对象的结构模型如图01所示：<br><br>
<table width="90%" align=center border=0>
    <tbody>
        <tr>
            <td>
            <div align=center><img onmousewheel="return bbimg(this)" onclick=ImgClick(this) height=345 onerror="this.src='http://www.yesky.com/image20010518/266317.gif';" hspace=3 src="http://www.zhuxiaolei.com/upload/060106091232081.gif" width=353 align=center vspace=1 border=1 resized="0"><br><span class=content>图01：DataSet对象的结构模型图 </span></div>
            </td>
        </tr>
    </tbody>
</table>
<br>　　通过图01可见在DataSet对象结构还是非常复杂的，在DataSet对象的下一层中是DataTableCollection对象、DataRelationCollection对象和ExtendedProperties对象。上文已经说过，每一个DataSet对象是由若干个DataTable对象组成。DataTableCollection就是管理DataSet中的所有DataTable对象。表示DataSet中两个DataTable对象之间的父/子关系是DataRelation对象。它使一个DataTable 中的行与另一个DataTable中的行相关联。这种关联类似于关系数据库中数据表之间的主键列和外键列之间的关联。DataRelationCollection对象就是管理DataSet中所有DataTable之间的DataRelation关系的。在DataSet中DataSet、DataTable和DataColumn都具有ExtendedProperties属性。ExtendedProperties其实是一个属性集（PropertyCollection），用以存放各种自定义数据，如生成数据集的SELECT语句等。<br><br>　　<strong>二．使用DataSet：</strong><br><br>　　DataSet其实就是数据集，上文已经说过DataSet是把数据库中的数据映射到内存缓存中的所构成的数据容器，对于任何数据源，它都提供一致的关系编程模型。在DataSet中既定义了数据表的约束关系以及数据表之间的关系，还可以对数据表中的数据进行排序等。DataSet使用方法一般有三种：<br><br>　　1. 把数据库中的数据通过DataAdapter对象填充DataSet。<br><br>　　2. 通过DataAdapter对象操作DataSet实现更新数据库。<br><br>　　3. 把XML数据流或文本加载到DataSet。<br><br>　　下面就来详细探讨以上DataSet使用方法的具体实现，使用语言是C＃。<br><br>　　1. 把数据库中的数据通过DataAdapter对象填充DataSet：<br><br>　　掌握DataSet使用方法必须掌握ADO.NET另外一个核心常用成员--数据提供者（Data Provider）。数据提供者（也称为托管提供者Managed Provider）是一个类集合，在.Net FrameWork SDK 1.0中数据提供者分为二种：The SQL Server .NET Data Provider和The OLE DB .NET Data Provider。而到了.Net FrameWork SDK 1.1时，ADO.NET中又增加了The ODBC .NET Data Provider和 The Oracle .NET Data Provider二个数据提供者。The SQL Server .NET Data Provider的操作数据库对象只限于Sql Server 7.0及以上版本，Oracle .NET Data Provider的操作数据库对象只限于Oracle 8.1.7及以上版本。而The OLE DB .NET Data Provider和The ODBC .NET Data Provider可操作的数据库类型就相对多了许多，只要它们在本地分别提供Ole Db提供程序和ODBC提供程序。<br><br>　　在这些数据提供者中都有一个DataAdapter类，如：OLE DB .NET Framework 数据提供者中是 OleDbDataAdapter类，The SQL Server .NET Framework 数据提供者中是SqlDataAdapter类，The ODBC .NET Framework 数据提供者中是OdbcDataAdapter类。通过这些DataAdapter就能够实现从数据库中检索数据并填充 DataSet 中的表。<br><br>　　DataAdapter填充DataSet的过程分为二步：首先通过DataAdapter的SelectCommand属性从数据库中检索出需要的数据。SelectCommand其实是一个Command对象。然后再通过DataAdapter的Fill方法把检索来的数据填充 DataSet。代码清单01就是以Microsoft SQL Server 中的Northwind数据库为对象，C＃使用The SQL Server .NET Data Provider中的SqlDataAdapter填充DataSet的具体实现方法：<br><br>　　代码清单01：<br><br>
<table class=content borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=0>
    <tbody>
        <tr>
            <td height=233>SqlConnection sqlConnection1 = new SqlConnection ( "Data Source=localhost ;Integrated Security=SSPI ;Initial Catalog=Northwind" ) ;<br>//创建数据连接<br>SqlCommand selectCMD = new SqlCommand ( "SELECT CustomerID , CompanyName FROM Customers" , sqlConnection1 ) ;<br>//创建并初始化SqlCommand对象<br>SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter ( ) ;<br>custDA.SelectCommand = selectCMD ;<br>sqlConnection.Open ( ) ;<br>//创建SqlDataAdapter对象，并根据SelectCommand属性检索数据<br>DataSet dsDataSet1 = new DataSet ( ) ;<br>sqlDataAdapter1.Fill ( dsDataSet1 , "Customers" ) ;<br>//使用SqlDataAdapter的Fill方法填充DataSet<br>sqlConnection.Close ( ) ;<br>//关闭数据连接</td>
        </tr>
    </tbody>
</table>
<br>　　对于其他数据提供者的DataAdapter，具体的实现检索数据库中的数据并填充DataSet的实现方法类似于以上方法。<br><br>　　2. 通过DataAdapter对象操作DataSet实现更新数据库：<br><br>　　DataAdapter是通过其Update方法实现以DataSet中数据来更新数据库的。当DataSet实例中包含数据发生更改后，此时调用Update方法，DataAdapter 将分析已作出的更改并执行相应的命令（INSERT、UPDATE 或 DELETE），并以此命令来更新数据库中的数据。如果DataSet中的DataTable是映射到单个数据库表或从单个数据库表生成，则可以利用 CommandBuilder 对象自动生成 DataAdapter 的 DeleteCommand、InsertCommand 和 UpdateCommand。使用DataAdapter对象操作DataSet实现更新数据库具体的实现方法，只需把下面的代码清单02添加到代码清单01之后，二者合并即可实现删除Customers数据表中第一行数据：<br><br>　　代码清单02：　<br><br>
<table borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=0>
    <tbody>
        <tr>
            <td class=content>SqlCommandBuilder sqlCommandBuilder1 = new SqlCommandBuilder ( sqlDataAdapter1 ) ;<br>//以sqlDataAdapter1为参数来初始化SqlCommandBuilder实例<br>dsDataSet1.Tables["Customers"].Rows[0].Delete ( ) ;<br>//删除DataSet中删除数据表Customers中第一行数据<br>sqlDataAdapter1.Update ( dsDataSet1 ,"Customers" ) ;<br>//调用Update方法，以DataSet中的数据更新从数据库<br>dsDataSet1.Tables["Customers"].AcceptChanges ( ) ;</td>
        </tr>
    </tbody>
</table>
<br>　　由于不了解DataSet结构和与数据库关系，很多初学者往往只是更新了DataSet中的数据，就认为数据库中的数据也随之更新，所以当打开数据库浏览时发现并没有更新数据，都会比较疑惑，通过上面的介绍，疑惑应当能够消除了。<br><br>　　3. XML和DataSet：<br><br>　　DataSet中的数据可以从XML数据流或文档创建。并且.Net Framework可以控制加载XML数据流或文档中那些数据以及如何创建DataSet的关系结构。加载XML数据流和文档到DataSet中是可使用DataSet对象的ReadXml方法（注意：ReadXml来加载非常大的文件，则性能会有所下降）。ReadXml 方法将从文件、流或 XmlReader 中进行读取，并将 XML 的源以及可选的 XmlReadMode 参数用作参数。该ReadXml方法读取 XML 流或文档的内容并将数据加载到 DataSet 中。根据所指定的XmlReadMode和关系架构是否已存在，它还将创建DataSet的关系架构。<br>
<p>　<strong>三．DataSet和数据绑定（DataBinding）</strong><br><br>　　数据绑定是数据绑定是绑定技术中使用最频繁，也是最为重要的技术，也可以说是各种.Net开发语言开发数据库应用程序最需要掌握的基本的知识之一。数据绑定之所以很重要，是因为在.Net FrameWork SDK中并没有提供数据库开发的相关组件，即如：DbTextBox、DbLabel等用于数据库开发的常用组件在.Net FrameWork SDK中都没有。而数据绑定技术则能够把TextBox组件"改造"成DbTextBox组件，把Label组件"改造"成DbLabel组件等等。所有这些都与DataSet有直接关系。<br><br>　　数据绑定分成二类：简单型数据绑定和复杂型数据绑定。适用于简单型数据绑定组件一般有Lable、TextBox等，适用于复杂性数据绑定的组件一般有DataGrid、ListBox、ComboBox等。其实简单型数据绑定和复杂性数据绑定并没有明确的区分，只是在组件进行数据绑定时，一些结构复杂一点的组件在数据绑定时操作步骤相近，而另外一些结构简单一点的组件在数据绑定时也比较类似。于是也就产生了二个类别。以下就结合TextBox组件和DataGrid组件分别探讨DataSet在实现简单型数据绑定和复杂性数据绑定作用和具体实现方法。<br><br>　　1. 简单型数据绑定：<br><br>　　简单型数据绑定一般使用这些组件中的DataBindings属性的Add方法把DataSet中某一个DataTable中的某一行和组件的某个属性绑定起来，从而达到显示数据的效果。TextBox组件的数据绑定具体实现方法是在代码清单01后，再添加代码清单03中的代码，代码清单03中的代码是把DataSet中的Customers 数据表中的"CustomerID"的数据和TextBox的Text属性绑定起来，这样DbTextBox就产生了。其他适用于简单型数据绑定组件数据绑定的方法类似与此操作：<br><br>　　代码清单03：
<table class=content width="90%" align=center bgColor=#dadacf>
    <tbody>
        <tr>
            <td>textBox1.DataBindings.Add ( "Text" , dsDataSet1, " Customers. CustomerID " ) ;</td>
        </tr>
    </tbody>
</table>
<br>　　2. 复杂性数据绑定：<br><br>　　复杂性数据绑定一般是设定组件的DataSource属性和DisplayMember属性来完成数据绑定的。DataSource属性值一般设定为要绑定的DataSet，DisplayMember属性值一般设定为要绑定的数据表或数据表中的某一列。DataGrid组件的数据绑定的一般实现方法是在代码清单01后，再添加代码清单04中的代码，代码清单04的功能是把DataSet中的Customers 数据表和DataGrid绑定起来。其他适用于复杂性数据绑定的组件实现数据绑定的方法类似此操作：<br><br>　　代码清单04：<br><br>
<table class=content borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=0>
    <tbody>
        <tr>
            <td height=36>dataGrid1.DataSource = dsDataSet1 ;<br>dataGrid1.DataMember = " Customers " ;</td>
        </tr>
    </tbody>
</table>
<br>　　<strong>四．总结</strong><br><br>　　DataSet类是ADO.NET中一个非常重要的核心成员，它是数据库中的数据在本地计算机中映射成的缓存。对DataSet的任何操作，都是在计算机缓存中完成的。理解这一点是掌握DataSet的第一步。DataSet虽然结构复杂。但只要区分DataSet对象中各个组成部件及其相互关系，掌握也不算太困难。本文覆盖了DataSet的特性、结构、以及具体的使用方法等等，相信这些对您掌握这个ADO.NET中核心成员是有所帮助。</p>
<script event=onload for=window type=text/javascript>ImgLoad(document.getElementById("BodyLabel"));</script></div>
<br>
<img src ="http://www.cnitblog.com/yide/aggbug/35588.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-10-30 14:06 <a href="http://www.cnitblog.com/yide/archive/2007/10/30/35588.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>網頁</title><link>http://www.cnitblog.com/yide/archive/2007/10/14/34842.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Sun, 14 Oct 2007 07:28:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/10/14/34842.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/34842.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/10/14/34842.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/34842.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/34842.html</trackback:ping><description><![CDATA[<p align=center><font size=3>网页代码常用小技巧！<br></font></p>
<p><font size=3>1. oncontextmenu=window.event.returnvalue=false 将彻底屏蔽鼠标右键<br>〈table border oncontextmenu=return(false)〉〈td〉no〈/table〉 可用于Table <br>2. 〈body onselectstart=return false〉 取消选取、防止复制<br>3. onpaste=return false 不准粘贴<br><br>4. oncopy=return false; oncut=return false; 防止复制<br><br>5. 〈link rel=Shortcut Icon href=favicon.ico〉 IE地址栏前换成自己的图标<br><br>6. 〈link rel=Bookmark href=favicon.ico〉 可以在收藏夹中显示出你的图标<br><br>7. 〈input style=ime-mode:-Disabled〉 关闭输入法<br><br>8. 永远都会带着框架 <br>〈script language=javascript〉〈!--<br>if (window == top)top.location.href = frames.htm; //frames.htm为框架网页<br>// --〉〈/script〉<br><br>9. 防止被人frame<br>〈SCRIPT LANGUAGE=javascript〉〈!-- <br>if (top.location != self.location)top.location=self.location;<br>// --〉〈/SCRIPT〉<br><br>10. 网页将不能被另存为<br>〈noscript〉〈iframe src=*.html〉〈/iframe〉〈/noscript〉 <br><br>11. 〈input type=button value=查看网页源代码 <br>onclick=window.location = `view-source:`+ http://www.51js.com/`;〉<br><br>12.删除时确认<br>〈a href=`javascript:if(confirm(确实要删除吗?))location=boos.asp?&amp;areyou=删除&amp;page=1`〉删<br><br>除〈/a〉 <br><br>13. 取得控件的绝对位置<br>//javascript<br>〈script language=javascript〉<br>function getIE(E){<br>var t=e.offsetTop;<br>var l=e.offsetLeft;<br>while(e=e.offsetParent){<br>t+=e.offsetTop;<br>l+=e.offsetLeft;<br>}<br>alert(top=+t+/nleft=+l);<br>}<br>〈/script〉<br><br>//VBScript<br>〈script language=VBScript〉〈!--<br>function getIE()<br>dim t,l,a,b<br>set a=document.all.img1<br>t=document.all.img1.offsetTop<br>l=document.all.img1.offsetLeft<br>while a.tagName〈〉BODY<br>set a = a.offsetParent<br>t=t+a.offsetTop<br>l=l+a.offsetLeft<br>wend<br>msgbox top=&amp;t&amp;chr(13)&amp;left=&amp;l,64,得到控件的位置<br>end function<br>--〉〈/script〉<br><br>14. 光标是停在文本框文字的最后<br>〈script language=javascript〉<br>function cc()<br>{<br>var e = event.srcElement;<br>var r =e.createTextRange();<br>r.moveStart(`character`,e.value.length);<br>r.collapse(true);<br>r.select();<br>}<br>〈/script〉<br>〈input type=text name=text1 value=123 onfocus=cc()〉<br><br>15. 判断上一页的来源<br>javascript:<br>document.referrer<br><br>16. 最小化、最大化、关闭窗口 <br>〈object id=hh1 classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11〉 <br>〈param name=Command value=Minimize〉〈/object〉<br>〈object id=hh2 classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11〉 <br>〈param name=Command value=Maximize〉〈/object〉<br>〈OBJECT id=hh3 classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11〉<br>〈PARAM NAME=Command value=Close〉〈/OBJECT〉<br><br>〈input type=button value=最小化 onclick=hh1.Click()〉<br>〈input type=button value=最大化 onclick=hh2.Click()〉<br>〈input type=button value=关闭 onclick=hh3.Click()〉<br>本例适用于IE<br><br>17.屏蔽功能键Shift,Alt,Ctrl<br>〈script〉<br>function look(){ <br>if(event.shiftKey) <br>alert(禁止按Shift键!); //可以换成ALT　CTRL<br>} <br>document.onkeydown=look; <br>〈/script〉<br><br>18. 网页不会被缓存<br>〈META HTTP-EQUIV=pragma CONTENT=no-cache〉<br>〈META HTTP-EQUIV=Cache-Control CONTENT=no-cache, must-revalidate〉<br>〈META HTTP-EQUIV=expires CONTENT=Wed, 26 Feb 1997 08:21:57 GMT〉<br>或者〈META HTTP-EQUIV=expires CONTENT=0〉<br><br>19.怎样让表单没有凹凸感？<br>〈input type=text style=border:1 solid #000000〉 <br>或<br>〈input type=text style=border-left:none; border-right:none; border-top:none; border-bottom: <br><br>1 solid #000000〉〈/textarea〉<br><br>20.〈div〉〈span〉&amp;〈layer〉的区别？ <br>〈div〉(division)用来定义大段的页面元素，会产生转行 <br>〈span〉用来定义同一行内的元素，跟〈div〉的唯一区别是不产生转行 <br>〈layer〉是ns的标记，ie不支持，相当于〈div〉<br><br><br>21.让弹出窗口总是在最上面:<br>〈body onblur=this.focus();〉<br><br>22.不要滚动条? <br>让竖条没有: <br>〈body style=`overflow:-Scroll;overflow-y:hidden`〉 <br>〈/body〉 <br>让横条没有: <br>〈body style=`overflow:-Scroll;overflow-x:hidden`〉 <br>〈/body〉 <br>两个都去掉？更简单了 <br>〈body scroll=no〉 <br>〈/body〉 <br><br>23.怎样去掉图片链接点击后，图片周围的虚线？<br>〈a href=# onFocus=this.blur()〉〈img src=logo.jpg border=0〉〈/a〉<br><br>24.电子邮件处理提交表单<br>〈form name=form1 method=post action=mailto:****@***.com enctype=text/plain〉 <br>〈input type=submit〉<br>〈/form〉<br><br>25.在打开的子窗口刷新父窗口的代码里如何写？<br>window.opener.location.reload()<br><br>26.如何设定打开页面的大小<br>〈body onload=top.resizeTo(300,200);〉<br>打开页面的位置〈body onload=top.moveBy(300,200);〉<br><br>27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动 <br>〈style〉 <br>body <br>{background-image:url(logo.gif); background-repeat:no-repeat; <br><br>background-position:center;background-attachment: fixed} <br>〈/style〉 <br><br>28. 检查一段字符串是否全由数字组成<br>〈script language=javascript〉〈!--<br>function checkNum(str){return str.match(//D/)==null}<br>alert(checkNum(1232142141))<br>alert(checkNum(123214214a1))<br>// --〉〈/script〉<br><br>29. 获得一个窗口的大小 <br>document.body.clientWidth; document.body.clientHeight<br><br>30. 怎么判断是否是字符<br>if (/[^/x00-/xff]/g.test(s)) alert(含有汉字);<br>else alert(全是字符);<br><br>31.TEXTAREA自适应文字行数的多少<br>〈textarea rows=1 name=s1 cols=27 onpropertychange=this.style.posHeight=this.scrollHeight〉<br>〈/textarea〉<br><br>32. 日期减去天数等于第二个日期<br>〈script language=javascript〉<br>function cc(dd,dadd)<br>{<br>//可以加上错误处理<br>var a = new Date(dd)<br>a = a.valueOf()<br>a = a - dadd * 24 * 60 * 60 * 1000<br>a = new Date(A)<br>alert(a.getFullYear() + 年 + (a.getMonth() + 1) + 月 + a.getDate() + 日)<br>}<br>cc(12/23/2002,2)<br>〈/script〉<br><br>33. 选择了哪一个Radio<br>〈HTML〉〈script language=vbscript〉<br>function checkme()<br>for each ob in radio1<br>if ob.checked then window.alert ob.value<br>next<br>end function<br>〈/script〉〈BODY〉<br>〈INPUT name=radio1 type=radio value=style checked〉style<br>〈INPUT name=radio1 type=radio value=barcode〉Barcode<br>〈INPUT type=button value=check onclick=checkme()〉<br>〈/BODY〉〈/HTML〉<br><br>34.脚本永不出错<br>〈SCRIPT LANGUAGE=javascript〉 <br>〈!-- Hide <br>function killErrors() { <br>return true; <br>} <br>window.onerror = killErrors; <br>// --〉 <br>〈/SCRIPT〉<br><br>35.ENTER键可以让光标移到下一个输入框<br>〈input onkeydown=if(event.keyCode==13)event.keyCode=9〉<br><br>36. 检测某个网站的链接速度：<br>把如下代码加入〈body〉区域中:<br>〈script language=javascript〉<br>tim=1<br>setInterval(tim++,100)<br>b=1<br><br>var autourl=new Array()<br>autourl[1]=http://www.njcatv.net/;<br>autourl[2]=javacool.3322.net<br>autourl[3]=http://www.sina.com.cn/;<br>autourl[4]=http://www.nuaa.edu.cn/;<br>autourl[5]=http://www.cctv.com/;<br><br>function butt(){<br>document.write(〈form name=autof〉)<br>for(var i=1;i〈autourl.length;i++)<br>document.write(〈input type=text name=txt+i+ size=10 value=测试中&#8230;&#8230;〉 =》〈input type=text <br><br>name=url+i+ size=40〉 =》〈input type=button value=GO <br><br>onclick=window.open(this.form.url+i+.value)〉〈br〉)<br>document.write(〈input type=submit value=刷新〉〈/form〉)<br>}<br>butt()<br>function auto(url){<br>document.forms[0][url+b].value=url<br>if(tim〉200)<br>{document.forms[0][txt+b].value=链接超时}<br>else<br>{document.forms[0][txt+b].value=时间+tim/10+秒}<br>b++<br>}<br>function run(){for(var i=1;i〈autourl.length;i++)document.write(〈img <br><br>src=http://+autourl+/+Math.random()+ width=1 height=1 <br><br>onerror=auto(http://;+autourl+`)〉)}<br>run()〈/script〉<br><br>37. 各种样式的光标<br>auto ：标准光标<br>default ：标准箭头<br>hand ：手形光标<br>wait ：等待光标<br>text ：I形光标<br>vertical-text ：水平I形光标<br>no-drop ：不可拖动光标<br>not-allowed ：无效光标<br>help ：?帮助光标<br>all-scroll ：三角方向标<br>move ：移动标<br>crosshair ：十字标<br>e-resize<br>n-resize<br>nw-resize<br>w-resize<br>s-resize<br>se-resize<br>sw-resize<br><br>38.页面进入和退出的特效<br>进入页面〈meta http-equiv=Page-Enter content=revealTrans(duration=x, transition=y)〉<br>推出页面〈meta http-equiv=Page-Exit content=revealTrans(duration=x, transition=y)〉 <br>这个是页面被载入和调出时的一些特效。Duration表示特效的持续时间，以秒为单位。Transition表示使<br><br>用哪种特效，取值为1-23:<br>　　0 矩形缩小 <br>　　1 矩形扩大 <br>　　2 圆形缩小<br>　　3 圆形扩大 <br>　　4 下到上刷新 <br>　　5 上到下刷新<br>　　6 左到右刷新 <br>　　7 右到左刷新 <br>　　8 竖百叶窗<br>　　9 横百叶窗 <br>　　10 错位横百叶窗 <br>　　11 错位竖百叶窗<br>　　12 点扩散 <br>　　13 左右到中间刷新 <br>　　14 中间到左右刷新<br>　　15 中间到上下<br>　　16 上下到中间 <br>　　17 右下到左上<br>　　18 右上到左下 <br>　　19 左上到右下 <br>　　20 左下到右上<br>　　21 横条 <br>　　22 竖条 <br>　　23 以上22种随机选择一种<br><br>39.在规定时间内跳转<br>〈META http-equiv=V=REFRESH content=5;URL=http://www.51js.com〉 <br><br>40.网页是否被检索<br>〈meta name=ROBOTS content=属性值〉<br>　　其中属性值有以下一些:<br>　　属性值为all: 文件将被检索，且页上链接可被查询；<br>　　属性值为none: 文件不被检索，而且不查询页上的链接；<br>　　属性值为index: 文件将被检索；<br>　　属性值为follow: 查询页上的链接；<br>　　属性值为noindex: 文件不检索，但可被查询链接；<br>　　属性值为nofollow: 文件不被检索，但可查询页上的链接。 <br><br>41.变换网页的鼠标光标<br>〈BODY style=CURSOR: url(http://203.73.125.205/~liangmi2/farmfrog01.cur`)〉<br><br>42.怎样实现在任务栏显示小图标的效果？ (要使用绝对地址)<br>有些站点，访问时会在地址栏地址前显出小图标，添加到收藏夹后也在收藏栏中显示图标，<br>这样很好的与其它站点有了区别。 <br>要达到这个效果，先需做出这个图标文件，图像为16*16像素，不要超过16色。文件格式为ico，然后上传至你的网站。<br>然后，在需要的页面中，加上以下html语句到文件的〈head〉和〈/head〉之间（假设以上ico文件的地址http://happyisland.126.com/icon.ico）。<br>〈link REL=SHORTCUT ICONhref=http:〖砺剑〗打了个大揖 笑呵呵地说道：大家好，恭喜发财 ! .island.126.com/icon.ico;〉 <br>如果访问者的浏览器是IE5.0，就不需加任何代码，只要将图标文件上传到网站的根目录下即可。<br>1,META标签里的代码是什么意思？ <br>〈META〉是放于〈HEAD〉与〈/HEAD〉之间的标记.以下是我总结它在网页中最常见的几种。 <br>〈meta name=Keywords content=图片, 新闻, 音乐, 软件〉 <br>该网页的关键字，作用于搜索引擎的登录，事实上它在现在的网站中并没什么用。 <br>〈meta http-equiv=Content-Type content=text/html; charset=gb2312〉 <br>〈meta http-equiv=Content-Type content=text/html; charset=iso-8859-1〉 <br>设定这是 HTML 文件及其编码语系，简体中文网页使用charset=gb2312，繁体中文使用charset=big5，或者不设编码也可，纯英文网页建议使用 iso-8859-1。 <br>〈meta name=GENERATOR content=Microsoft FrontPage 5.0〉 <br>这只表示该网页由什么编辑器写的。 <br>〈meta http-equiv=refresh content=10; url=http://www.hkiwc.com〉 <br>这行较为实用，能于预定秒数内自动转到指定网址。原代码中 10 表示 10秒。 <br><br>2，怎么改变滚动条的颜色，只有ie5.5版本以上才能支持。 <br>这是使用CSS语言，在次说明一下，它和我的浏览器版本有一定的关系。 <br>scrollbar-arrow-color：上下按钮上三角箭头的颜色。 <br>scrollbar-base-color：滚动条的基本颜色。 <br>scrollbar-dark-shadow-color：立体滚动条强阴影的颜色 <br>scrollbar-face-color：立体滚动条凸出部分的颜色 <br>scrollbar-highlight-color：滚动条空白部分的颜色 <br>scrollbar-shadow-color立体滚动条阴影的颜色。<br>scrollbar-track-color:#99CC33;<br>scrollbar-3dlight-color:#A8CBF1; <br>代码如下： <br>〈style〉 <br>〈!-- <br>BODY {<br>scrollbar-face-color:#99CC33;//(立体滚动条凸出部分的颜色) <br>scrollbar-highlight-color:#A8CBF1;//(滚动条空白部分的颜色) <br>scrollbar-shadow-color:#A8CBF1;//(立体滚动条阴影的颜色) <br>scrollbar-arrow-color:#FF9966;//(上下按钮上三角箭头的颜色) <br>scrollbar-base-color:#A8CBF1; //(滚动条的基本颜色) <br>scrollbar-darkshadow-color:#A8CBF1; //(立体滚动条强阴影的颜色)<br>scrollbar-track-color:#99CC33;<br>scrollbar-3dlight-color:#A8CBF1; <br>} <br>--〉 <br>〈/style〉 <br>在这我补充几点： <br>1.让浏览器窗口永远都不出现滚动条。 <br>〈body style=overflow-x:hidden;overflow-y:hidden〉或〈body style=overflow:hidden〉 或〈body scroll=no〉 <br>2，没有水平滚动条 <br>〈body style=overflow-x:hidden〉 <br>3，没有垂直滚动条 <br>〈body style=overflow-y:hidden〉 <br><br><br>3,如何给图片抖动怎做的. <br>〈SCRIPT language=javascript1.2〉 <br>〈!-- <br>var rector=2 <br>var stopit=0 <br>var a=1 <br>var count=0 <br>function init(which){ <br>stopit=0 <br>shake=which <br>shake.style.left=0 <br>shake.style.top=0 <br>} <br>function rattleimage(){ <br>if ((!document.all&amp;&amp;!document.getElementById)||stopit==1||count==100) <br>return <br>count++ <br>if (a==1){ <br>shake.style.top=parseInt(shake.style.top)+rector <br>} <br>else if (a==2){ <br>shake.style.left=parseInt(shake.style.left)+rector <br>} <br>else if (a==3){ <br>shake.style.top=parseInt(shake.style.top)-rector <br>} <br>else{ <br>shake.style.left=parseInt(shake.style.left)-rector <br>} <br>if (a〈4) <br>a++ <br>else <br>a=1 <br>setTimeout(rattleimage(),50) <br>} <br>function stoprattle(which){ <br>stopit=1 <br>count=0 <br>which.style.left=0 <br>which.style.top=0 <br>} <br>//--〉 <br>〈/SCRIPT〉 <br>〈style〉.shakeimage {POSITION: relative} <br>〈/style〉 <br>〈img src=图片的路径 onmouseout=stoprattle(this) onmouseover=init(this);rattleimage() class=shakeimage〉 <br><br>4，在DW如何给水平线加颜色。 <br>在DW中没有此项设置，你只能在HTML中加入代码：〈hr color=red noshade〉按F12的预览在能看到。由于在NC中不支持〈hr〉的COLOR属性，所以在DW中没有此项设置。 <br>　　　 <br>5，如何在网页中实现flash的全屏播放？ <br>只要在调用swf文件的HTML中将WIDTH和HEIGHT的参数设为100％即可，当然也可以在Flash导出HTML文件的设置中进行设置，方法是：打开File菜单；选Publish Settings弹出导出设置对话框；在HTML标签下的Dimensions选项,下拉后选中Percent（百分比）,并在WIDTH 和HEIGHT框中填100.就行了。 <br><br>6,为什么我在DW中插入的Flash动画缺看不找！ <br>如果你没有正确地安装Dreamweaver和Flash，那么在你预览的时候，Dreamweaver会提示你缺少播放的插件，请你按装InstallAXFlash.exe 并从新启动计算机。现在IE6已经捆绑这个程序。 <br><br>7，在Flash中，如果屏蔽鼠标右键?FS命令都是什么意思? <br>fscommand (fullscreen, true/false);（全屏设置，TRUE开，FALSE关） <br>fscommand (showmenu, true/false);（右键菜单设置，TRUE显示，FALSE不显示） <br>fscommand (allowscale, true/false);（缩放设置，TRUE自由缩放，FALSE调整画面不影响影片本身的尺寸） <br>fscommand (trapallkeys, true/false);（快捷键设置，TRUE快捷键开，FALSE快捷键关） <br>fscommand (exec);（EXE程序调用） <br>fscommand (quit);（退出关闭窗口） <br><br>8，Flash中什么是隐形按钮。 <br>利用button中的hit帧来制作只有感应区域而完全透明的按钮。 <br><br>9，如何给Flash动画做链接。 <br>Dreamweaver是不能给Flash制作链接的，只能在Flash中用geturl()加链接，然后再插入Dreamweaver中。 <br><br>10，DW中的层的技巧。 <br>层是可以嵌套的，我个人给大家一个技巧，在层面板中按住CTRL再拖放层到你想去成为其子层的地方就行了，我认为这是最简单直观的方法了。 <br><br>11，如何改变鼠标的形状？ <br>在Dreamweaver4中CSS样式面板： <br>按CTR+SHIFT+E--出现样式表对话框,点击NEW，出现编辑对话框,在左边最后一项extensions-cursor 选择你要改的指针形式就可以了，然后把你要想改变的地方运用样式表，如果整页都有在〈body bgcolor=#003063 text=#ffffff id=all〉中加入就行了。 <br>〈span style=cursor:X`〉样例〈/span〉 <br>这里选择（文本）作为对象，还可以自己改为其他的，如link等。 <br>x可以等于=hand（手形）、crosshair（十字）、text（文本光标）、wait（顾名思义啦）、default（默认效果）、help（问号）、e-size（向右箭头）、ne-resize（向右上的箭头）、nw-resize（向左上的箭头）、w-resize（向左的箭头）、sw-resize（左下箭头）、s-resize（向下箭头）、se-resize（向右下箭头）、auto（系统自动给出效果）。 <br><br>12，用CSS做邮票，看看吧！ <br>〈input type=button value=我象不象邮票？ style=height:80px;border:2px dashed #cccccc〉 <br><br><br>13，经常上网的朋友可能会到过这样一些网站，一进入首页立刻会弹出一个窗口，怎么做呢！ <br>这javascript代码即可实现，摘录蓝色论坛。 <br>【1、最基本的弹出窗口代码】 <br>其实代码非常简单： <br>〈SCRIPT LANGUAGE=javascript〉 <br>〈!-- <br>window.open (`page.html`) <br>--〉 <br>〈/SCRIPT〉 <br>因为着是一段javascripts代码，所以它们应该放?lt;SCRIPT LANGUAGE=javascript〉标签和〈/script〉之间。〈!-- 和 --〉是对一些版本低的浏览器起作用，在这些老浏览器中不会将标签中的代码作为文本显示出来。要养成这个好习惯啊。 <br>window.open (`page.html`) 用于控制弹出新的窗口page.html，如果page.html不与主窗口在同一路径下，前面应写明路径，绝对路径(http://)和相对路径(../)均可。用单引号和双引号都可以，只是不要混用。 <br>这一段代码可以加入HTML的任意位置，〈head〉和〈/head〉之间可以，〈body bgcolor=#003063 text=#ffffff id=all〉间〈/body〉也可以，越前越早执行，尤其是页面代码长，又想使页面早点弹出就尽量往前放。 <br>【2、经过设置后的弹出窗口】 <br>下面再说一说弹出窗口的设置。只要再往上面的代码中加一点东西就可以了。 <br>我们来定制这个弹出的窗口的外观，尺寸大小，弹出的位置以适应该页面的具体情况。 <br>〈SCRIPT LANGUAGE=javascript〉 <br>〈!-- <br>window.open (`page.html`, `newwindow`, `height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no`) <br>//写成一行 <br>--〉 <br>〈/SCRIPT〉 <br>参数解释： <br>〈SCRIPT LANGUAGE=javascript〉 js脚本开始； <br>window.open 弹出新窗口的命令； <br>`page.html` 弹出窗口的文件名； <br>`newwindow` 弹出窗口的名字（不是文件名），非必须，可用空``代替； <br>height=100 窗口高度； <br>width=400 窗口宽度； <br>top=0 窗口距离屏幕上方的象素值； <br>left=0 窗口距离屏幕左侧的象素值； <br>toolbar=no 是否显示工具栏，yes为显示； <br>menubar，scrollbars 表示菜单栏和滚动栏。 <br>resizable=no 是否允许改变窗口大小，yes为允许； <br>location=no 是否显示地址栏，yes为允许； <br>status=no 是否显示状态栏内的信息（通常是文件已经打开），yes为允许； <br>〈/SCRIPT〉 js脚本结束 <br>【3、用函数控制弹出窗口】 <br>下面是一个完整的代码。 <br>〈html〉 <br>〈head〉 <br>〈script LANGUAGE=javascript〉 <br>〈!-- <br>function openwin() { window.open (page.html, newwindow, height=100, width=400, toolbar= <br>no, menubar=no, scrollbars=no, resizable=no, location=no, status=no) <br>//写成一行 <br>} <br>//--〉 <br>〈/script〉 <br>〈/head〉 <br>〈body onload=openwin()〉 <br>&#8230;任意的页面内容&#8230; <br>〈/body〉 <br>〈/html〉 <br>这里定义了一个函数openwin(),函数内容就是打开一个窗口。在调用它之前没有任何用途。 <br>怎么调用呢？ <br>方法一：〈body onload=openwin()〉 浏览器读页面时弹出窗口； <br>方法二：〈body onunload=openwin()〉 浏览器离开页面时弹出窗口； <br>方法三：用一个连接调用： <br>〈a href=# onclick=openwin()〉打开一个窗口〈/a〉 <br>注意：使用的&#8220;#&#8221;是虚连接。 <br>方法四：用一个按钮调用： <br>〈input type=button onclick=openwin() value=打开窗口〉 <br><br><br>14，没有用表格写的，让大家随便看看，没什么。 <br>〈html〉 <br>〈head〉 <br>〈title〉江南荷花扇面〈/title〉 <br>〈meta http-equiv=Content-Type content=text/html; charset=gb2312〉 <br>〈style type=text/css〉 <br>〈!-- <br>.font1 { font-size: 12px; color: #999999; text-decoration: none} <br>a { font-size: 12px; color: #999999; text-decoration: none} <br>a:hover { font-size: 12px; color: #000000; text-decoration: none} <br>--〉 <br>〈/style〉 <br>〈/head〉 <br>〈body bgcolor=#FFFFFF text=#000000〉 <br>〈div class=font1 style=writing-mode=tb-rl;height:200px width=300〉 <br>〈p〉盛夏　　　　　　尚　涛　 <br>〈p〉〈a href=index.htm〉一夜露痕黄粉香　袁运甫 〈/a〉 <br>〈p〉瑶池昨夜新凉　　王金岭 <br>〈p〉一朵白莲随意开　吴冠南 <br>〈p〉新雨迎秋欲满塘　齐辛民 <br>〈p〉十里荷香　　　　齐辛民 <br>〈p〉濯清莲而不妖　　卢世曙 <br>〈/div〉 <br>〈/body〉 <br>〈/html〉 <br><br><br>15,IE6已支持自定义cursor! <br>语法格式 cursor:url(图标) //cur或是ani文件. <br>cur就是WINDOWS中的光标(cursor)文件，光标文件与图标（ICON)文件除了文件头有一个位置的值不同外，实际是一样的。 <br>ani是WINDOWS中的动画光标（图标）文件。 <br>〈style type=text/css〉 <br>〈!-- <br>.unnamed1 { cursor:url(arrow2c.cur)} <br>--〉 <br>〈/style〉 <br><br>16,用marquee做的滚动字幕.这也我刚看到论坛的朋友在问。 <br>语法： <br>align=# | top | middle| bottom //对齐方式) <br>BEHAVIOR=ALTERNATE | SCROLL | SLIDE //移动的方式 <br>BGCOLOR=color//底色区域颜色 <br>DIRECTION=DOWN | LEFT | RIGHT | UP //移动的方向 <br>Loop=n //循环次数（默认是循环不止） <br>Scrolldelay=milliseconds//延时 <br>height=# width=# //区域面积 <br>hspace=# vspace=# //空白区域 <br>scrollamount=# //移动的速度 <br>〈marquee align=top behavior=ALTERNATE BGCOLOR=#000000 height=60 width=433 scrollamount=5〉〈/marquee〉<br><br>17，在FLASH5中也存在一些字体，打散后变成一团的事是为什么？有解决的办法吗。 <br>这是大家很常见的问题！可能是对字库支持的不好！我个是做成透明的gif图片格式，然后倒入。 <br><br>18，flash的网页里&#8220;加入收藏夹&#8221;功能怎么实现？ <br>在as中加getUrl(java script:window.external.addFavorite(http://skydesigner.51.net`,`我的工作室`)) <br><br>19，在Flash中，文本的动态属性和输入属性的区别。 <br>input text在运行时可被用户或程序改变其值。 <br>ynamic text仅允许被程序修改。 <br><br><br>20,怎样在IE中调用Dreamweaver进行编辑. <br>相信很多在使用WinME或Window2000的朋友，会遇见是个问题。很简单，把我们笔记本程序打开，保存为一个 *.reg 文件。双击它将信息添加到注册表即可。 <br>REGEDIT4 <br>[HKEY_CLASSES_ROOT\.htm\OpenWithList\Dreamweaver] <br>[HKEY_CLASSES_ROOT\.htm\OpenWithList\Dreamweaver\shell] <br>[HKEY_CLASSES_ROOT\.htm\OpenWithList\Dreamweaver\shell\edit] <br>[HKEY_CLASSES_ROOT\.htm\OpenWithList\Dreamweaver\shell\edit\command] <br>@=\c:\\Program Files\\Macromedia\\Dreamweaver 4\\dreamweaver.exe\ \%1\ <br><br>21，设置表格虚线。 <br>方法一：作一个1X2的图。半黑半白，再利用表格作成线。 <br>方法二：在css里面设，要IE5。5才支持这种效果。 <br>style=BORDER-LEFT: #000000 1PX DASHED; BORDER-RIGHT: #000000 1PX DASHED; BORDER-TOP: #000000 1PX DASHED; BORDER-BOTTOM: #000000 1PX DASHED <br><br>22,看看在网页中调用HHCtrl控件效果。 <br>代码如下： <br>〈object id=HHC type=application/x-oleobject classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11〉〈/object〉〈script〉HHC.TextPopup(哈哈,大家好,我是闪梦!,,50,5,128255,346751);〈/script〉 <br><br><br>22，如何让一张图片有浅到深的渐变。 <br>〈SCRIPT language=javascript1.2〉 <br>〈!-- <br>function high(which2){ <br>theobject=which2 <br>highlighting=setInterval(highlightit(theobject),50) <br>} <br>function low(which2){ <br>clearInterval(highlighting) <br>which2.filters.alpha.opacity=40 <br>} <br>function highlightit(cur2){ <br>if (cur2.filters.alpha.opacity〈100) <br>cur2.filters.alpha.opacity+=10 <br>else if (window.highlighting) <br>clearInterval(highlighting) <br>} <br>〈/script〉 <br>〈img onmouseout=low(this) onmouseover=high(this) style=FILTER: alpha(opacity=40)src=logo.gif 〉 <br><br>23,双击鼠标左键来滚动背景，单击停止。 <br>〈SCRIPT language=javascript〉 <br>var currentpos,timer; <br>function initialize() <br>{ <br>timer=setInterval(scrollwindow(),16); <br>} <br>function sc(){ <br>clearInterval(timer); <br>} <br>function scrollwindow() <br>{ <br>currentpos=document.body.scrollTop; <br>window.scroll(0,++currentpos); <br>if (currentpos != document.body.scrollTop) <br>sc(); <br>} <br>document.onmousedown=sc <br>document.ondblclick=initialize <br>〈/SCRIPT〉 <br><br>24,如何在同一页面设置不同文字链接效果的样式. <br>代码如下： <br>〈HTML〉〈HEAD〉〈TITLE〉如何在同一页面设置不同文字链接效果的样式〈/TITLE〉 <br>〈meta http-equiv=Content-Type content=text/html; charset=gb2312〉 <br>〈style type=text/css〉 <br>〈!-- <br>a:hover { font-size: 9pt; color: #FF0000; text-decoration: underline} <br>a:link { font-size: 9pt; color: #006699; text-decoration: underline} <br>a:visited { font-size: 9pt; color: #006699; text-decoration: underline} <br>a:active { font-size: 9pt; color: #FF0000; text-decoration: none} <br>a.r1:hover { font-size: 9pt; color: #FF0000; text-decoration: underline overline} <br>a.r1:link { font-size: 9pt; color: #000000; text-decoration: underline overline} <br>a.r1:visited { font-size: 9pt; color: #99CC00; text-decoration: underline overline} <br>a.r1:active { font-size: 9pt; color: #000000; text-decoration: underline overline} <br>--〉 <br>〈/style〉 <br>〈/head〉 <br>〈body bgcolor=#FFFFFF text=#000000〉 <br>〈a href=#〉下划线链接 〈/a〉 <br>〈p〉〈/p〉 <br>〈a href=# class=r1〉双下划线链接〈/a〉 <br>〈/BODY〉 <br>〈/HTML〉 <br>补充说明： <br>a:hover 表示鼠标划过时的样式. <br>a:link 表示链接的样式. <br>a:active 表示当前活动连接的样式. <br>a:visited 表示已经访问过的连接的样式. <br><br>25, 用CSS给文字加入阴影效果和文字描边效果。 <br>.glow{FONT-SIZE: 9pt; FILTER: Glow(Color=#000000, Strength=1)} <br>//文字描边效果 <br>.shadow {FONT-SIZE: 9pt; FILTER: DropShadow(OffX=1, OffY=1, DropShadow(OffX=1, OffY=1, color:#111111); COLOR: #ffffff; FONT-FAMILY: 宋体} <br>//加入阴影效果 <br>补充说明： <br>　　这两种滤镜要想实现效果，必须加在如：〈td class=glow或shadow 〉〈div〉xxxxxxxxx〈/div〉〈/td〉上 <br>，并且要留有足够的空间能够显示阴影或描边，否则会出现半截的阴影或描边现象。 <br><br>26,如何给做带颜色的下拉菜单。 <br>〈select style=FONT-SIZE: 10px; COLOR: #ffffff; FONT-FAMILY: Verdana;BACKGROUND-COLOR: #ff6600; size=1 〉 <br>〈option selected〉:: Dreamweaver4 ::〈/option〉 <br>〈option〉::Flash5::〈/option〉 <br>〈option〉::Firewoks4::〈/option〉 <br>〈/select〉 <br><br>27,关于DW4的表格中的亮边框和暗边框问题。 <br>在DW4的表格面板中并没有亮边框和暗边框的属性设置，因为NC不支持,只有你在代码中添加了。 <br>bordercolorlight=#999999 bordercolordark=#000000 <br>　　你也可以用Css定义一个class。例如： <br>〈style〉 <br>.bordercolor { bordercolorlight: #999999; bordercolordark: #000000 } <br>〈/style〉 <br>　　然后在要加效果的表格里加?lt;table class=bordercolor〉 <br><br>28,自动显示主页最后更新日期. <br>〈script〉 <br>document.write(最后更新日期：+document.lastModified+) <br>〈/script〉 <br><br>29,如何让滚动条出现在左边？ <br>我想居然在论坛中有人发表了这段代码，很有意思，它的确照顾一些左撇子，呵呵！ <br>〈html dir=rtl〉 <br>〈body bgcolor=#000000 text=#FFFFFF〉 <br>〈table height=18 width=212 align=center bgcolor=#FFFFFF dir=ltr cellspacing=1 　cellpadding=0〉 <br>〈tr〉 <br>〈td bgcolor=#FF0000 〉是不是你的滚动条在左边啊〈/td〉 <br>〈/tr〉 <br>〈/table〉 <br>〈/body〉 <br>〈/html〉 <br><br>30,如何加入网址前面的小图标？ <br>　　首先,您必须了解所谓的图标（Icon）是一种特殊的图形文件格式，它是以 .ico 作为扩展名。你可用在网上找一个制作图标软件，它具有特有的规格：图标的大小为 16 * 16（以像素为单位）；颜色不得超过 16 色。 在该网页文件的 HEAD 部分加入下面的内容：〈LINK REL=SHORTCUT ICON HREF= http://skydesigner.51.net/图标文件名〉,并放在该网页的根目录下。 <br><br>31,在800*600显示器中，如何不让网页水平出现滚动条！ <br>设至〈body leftmargin=0 topmargin=0〉，网页中的表格宽度为778。 <br><br>32,关于〈!DOTYPE〉的说明解释。 <br>在网页中，经常会看到〈!DOCTYPE HTML PUBLIC`-//W3C//DTD HTML 4.01//EN`〉，是声明HTML文件的版本信息。 <br><br>33, 用图片来关闭窗体. <br>〈A href=java script:window.close()〉〈IMG height=20 width=20 alt=关闭窗口 src=close.gif border=0〉〈/A〉 <br>补充说明：如何使用了ACTIVEX！,不再警告窗口？ <br>〈html〉 <br>〈head〉 <br>〈object id=closes type=application/x-oleobject <br>classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11〉 <br>〈param name=Command value=Close〉〈/object〉 <br>〈/head〉 <br>〈body bgcolor=#003063 text=#ffffff id=all〉 〈a href=# onclick=closes.Click();〉关闭窗口无提示〈/a〉 <br>〈/body〉 <br>〈/html〉 <br><br>34,禁止鼠标右键查看网页源代码。 <br>〈SCRIPT language=javascript〉 <br>function click() <br>{if (event.button==2) {alert(`你好,欢迎光临！`) }} <br>document.onmousedown=click <br>〈/SCRIPT〉 <br>补充说明： <br>鼠标完全被封锁,可以屏蔽鼠标右键和网页文字。 <br>〈 body oncontextmenu=return false ondragstart=return false onselectstart=return false〉 <br><br>35,通过按钮来查看网页源代码。 <br>〈input type=BUTTON value=查看源代码 onClick= `window.location = view-source: + window.location.href` name=BUTTON〉 <br><br>36,怎么用文字联结实现按钮的SUBMIT功能？ <br>〈a href=# onclick=formname.submit()〉OK〈/a〉 <br>这段文字要放在form里。formname是这里要写在form中的name,〈form name=form111〉那么就应该是form111.submit() <br><br>37,如何做一个空链接？ <br>加# <br><br>38,利用〈IFRAME〉来给网页中插入网页。 <br>　　经常我看到很多网页中又有一个网页，还以为是用了框架，其实不然，是用了〈IFRAME〉,它只适用于IE，NS可是不支持〈IFRAME〉的，但围着的字句只有在浏览器不支援 iframe 标记时才会显示，如〈noframes〉一样，可以放些提醒字句之类的话。 <br>你注意啊！下面请和我学习它的用法。 <br>分析代码：〈iframe src=iframe.html name=test align=MIDDLE width=300 height=100 marginwidth=1 marginheight=1 frameborder=1 scrolling=Yes〉 〈/iframe〉<br>　　src=iframe.html <br>　　用来显示〈IFRAME〉中的网页来源，必要加上相对或绝对路径。 <br>　　name=test <br>　　这是连结标记的 target 参数所需要的。 <br>　　align=MIDDLE <br>　　可选值为 left, right, top, middle, bottom，作用不大 。 <br>　　width=300 height=100 <br>　　框窗的宽及长，以 pixels 为单位。 <br>　　marginwidth=1 marginheight=1 <br>　　该插入的文件与框边所保留的空间。 <br>　　frameborder=1 <br>　　使用 1 表示显示边框， 0 则不显示。（可以是 yes 或 no） <br>　　scrolling=Yes <br>　　使用 Yes 表示容许卷动（内定）， No 则不容许卷动。 <br><br>39,请问＜tbody＞的用法？ <br>tbody用法据说是加强对表格的控制能力的.例如： <br>　〈table〉〈tbody〉&#8230;&#8230;..〈/tbody〉〈/table〉 <br>　　tbody代码如果不是你用手写的话,只有在你用IE5打开一个网页的时候， 把它另存为 <br>一下，你的另存为的文件在表格中就会生成tbody代码。(即便你的表格根本就没有 <br>tbody代码，IE5另存为的时候也会给你生成)。 <br><br>40,Alt和Title都是提示性语言标签，请注意它们之间的区别。 <br>　　在我们浏览网页时，当鼠标停留在图片对象或文字链接上时，在鼠标的右下角有时会出现一个提示信息框。对目标进行一定的注释说明。在一些场合，它的作用是很重要的。 <br>alt 用来给图片来提示的。Title用来给链接文字或普通文字提示的。 <br>用法如下： <br>　　　〈p Title=给链接文字提示〉文字〈/p〉 <br>　　　〈a href=# Title=给链接文字提示〉文字〈/a〉 <br>　　　〈img src=图片.gif alt=给图片提示〉 <br>补充知识：〈TITLE〉〈ALT〉里面如何多行换行？在源代码里Enter回车。 <br>〈a href=# Title=个人简历 <br>姓名：张培 <br>网名：我是闪梦 <br>性别：男的，不是女的。 <br>爱好：网页制作，软件开发〉个人简历〈/a〉 <br>例如：个人简历 <br><br>41, 用javascript代码来实现闪烁按钮。 <br>〈body〉 <br>〈form method=POST action=--WEBBOT-SELF--〉 <br>〈input type=button name=SUB value=闪烁 id=flashit style=BORDER: 1px solid ;BACKGROUND-COLOR: #FFFFFF〉 <br>〈/form〉 <br>〈script〉 <br>if (document.all&amp;&amp;document.all.flashit) <br>{ <br>var flashelement=document.all.flashit <br>if (flashelement.length==null) <br>flashelement[0]=document.all.flashit <br>function changecolor(which) <br>{ <br>if (flashelement[which].style.color==`#800000`) <br>flashelement[which].style.color=#0063A4 <br>else <br>flashelement[which].style.color=#800000 <br>} <br>if (flashelement.length==null) <br>setInterval(changecolor(0),1000) <br>else <br>for (i=0;i〈flashelement.length;i++) <br>{ <br>var tempvariable=`setInterval(changecolor(`+i+`),`+`1000)` <br>eval(tempvariable) <br>} <br>} <br>〈/script〉 <br>〈/body〉 <br><br>42,CSS给图片定义颜色边框。 <br>img { border: 1px solid red} <br><br>43,在DW中如何使插入的FLASH透明。 <br>方法一：选中swf,打开原代码窗口，在〈/object〉前输入:〈param name=wmode value=transparent〉 <br>方法二：在Flash中的Flie&#8594;Publist Settings&#8594;HTML&#8594;Window Mode选择transparent <br><br>44,在DW编辑文本中，如何输入一个空格呢？ <br>输入空格的问题，在DW似乎已成了一个老生常谈的问题。通过将输入法调整到全角模式就可以避免了。本以人工智能ABC为例.按Shift+Space切换到全角状态。 <br><br>45,为何我的DW中图形显示不正常。 <br>第一种：可能是因为你定义并正在使用一个site，而你的HTML文件或者图片不在这个site包含的区域之内，因此dreamweaver使用file协议来 <br>描述图象的绝对路径，可惜IE不支持src中使用file协议，所以图象就显示不出来了。 <br>第二种：可能是放图片的文件夹或图片名为中文，也显示不到网页中去。 <br><br>46,如何在本地机器上测试flash影片的loading？ <br>我想这可能是很多人在问的题了，其实很简单，在Test时，选选View-〉Show Streaming就可以看到了。 <br><br>47,在网页中做出一根竖的线有几种办法. <br>第一种方法：用一个像素图的办法！ <br>如果你用Dreamwever的Edit&#8594;Preferences&#8230;&#8594;Layout View中的Spacer Image给你创建了一个缺省名为：spacer.gif的一个像素图文件 。 <br>代码中： <br>〈table border=0 cellspacing=0 cellpadding=0〉 <br>〈tr〉 <br>〈td bgcolor=#FF0000 height=200 〉〈img src=spacer.gif width=1 height=1〉〈/td〉 <br>〈/tr〉 <br>〈/table〉 <br>第二种方法：用表格填颜色的办法！把〈td〉 〈/td〉中的 删掉 . <br>〈table border=0 cellspacing=0 cellpadding=0〉 <br>〈tr〉 <br>〈td bgcolor=#FF0000 height=200 width=1〉〈/td〉 <br>〈/tr〉 <br>〈/table〉 <br>第三种方法：用水平条。 <br>〈hr color=red width=1 size=100%〉 <br><br>48, 关于鼠标拖动,改变层大小。──看看微软的做法. <br>〈script〉 <br>document.execCommand(2D-position,false,true); <br>〈/script〉 <br>〈DIV contentEditable=true〉 <br>〈DIV style=WIDTH: 300px; POSITION: absolute; HEIGHT: 100px; BACKGROUND-COLOR: red〉移动层〈/DIV〉 <br>〈/DIV〉 <br><br>49 ,点击连接文字加入收藏夹。 <br>〈a href=java script:window.external.AddFavorite(http://www.263.net`, `269家园`)〉点击加入收藏夹〈/a〉 </font></p>
<font size=3>&nbsp;</font> 
<img src ="http://www.cnitblog.com/yide/aggbug/34842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-10-14 15:28 <a href="http://www.cnitblog.com/yide/archive/2007/10/14/34842.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Excel----枢纽分析表</title><link>http://www.cnitblog.com/yide/archive/2007/10/11/34704.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 11 Oct 2007 08:07:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/10/11/34704.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/34704.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/10/11/34704.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/34704.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/34704.html</trackback:ping><description><![CDATA[<p><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp;&nbsp; i:Integer;<br>&nbsp;&nbsp; v , sheet ,WPT,workbooks ,workbook,PivotCaches ,PivotCache ,PivotTables : variant ;<br>begin<br>&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp; v:=createOleObject('Excel.application');<br>&nbsp;&nbsp; v.workbooks.add;<br>&nbsp;&nbsp; sheet:=v.workbooks[1].worksheets[1];<br>&nbsp;&nbsp; sheet.Range[sheet.cells[1,1],sheet.cells[1,15]].Select;<br>&nbsp;&nbsp; //SetupFont(FtBiaoKai,xlLeft,xlCenter,12,false);<br>&nbsp;&nbsp; v.Selection.RowHeight:=48;<br>&nbsp;&nbsp; v.Selection.HorizontalAlignment:=&nbsp; 1&nbsp; ;<br>&nbsp;&nbsp; v.Selection.Font.Size := 20;<br>&nbsp;&nbsp; sheet.Cells[1,7]:='表';<br>&nbsp;&nbsp; v.Selection.Merge;<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; for i := 4 to 5 do<br>&nbsp;&nbsp; begin<br>&nbsp;&nbsp; sheet.Columns[i].ColumnWidth:=16;<br>&nbsp;&nbsp; end ;</p>
<p>&nbsp;&nbsp; sheet.Range[sheet.cells[2,1],sheet.cells[2,6]].Select;<br>&nbsp;&nbsp;&nbsp; v.Selection.HorizontalAlignment:=&nbsp; 1&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.Selection.Font.Bold:=true ;</p>
<p>&nbsp;&nbsp; sheet.Cells[2,1]:='lei';<br>&nbsp;&nbsp; sheet.Cells[2,2]:='cang';<br>&nbsp;&nbsp; sheet.Cells[2,3]:='WEEK';<br>&nbsp;&nbsp; sheet.Cells[2,4]:='Usable';<br>&nbsp;&nbsp; sheet.Cells[2,5]:='Actual';</p>
<p><br>&nbsp;&nbsp;&nbsp; //sheet.Range('A2:E5').Select&nbsp; ;<br>&nbsp;&nbsp;&nbsp; sheet.Range[sheet.cells[2,1],sheet.cells[5,5]].Select;<br>&nbsp;&nbsp;&nbsp; workbook := v.ActiveWorkbook;</p>
<p>&nbsp;&nbsp;&nbsp; PivotCaches := workbook.PivotCaches;<br>&nbsp;&nbsp;&nbsp; PivotCache := PivotCaches.add(1, 'Sheet1!R2C1:R5C5');&nbsp; //(SourceType:=2);//<br>&nbsp;&nbsp;&nbsp; PivotTables := PivotCache.CreatePivotTable('' ,'name',1);<br>&nbsp;&nbsp; // PivotTables.name('AgingReport');</p>
<p>&nbsp;&nbsp;&nbsp; workbook.ActiveSheet.PivotTableWizard ;<br>&nbsp;&nbsp;&nbsp; //workbook.TableDestination := workbook.ActiveSheet.Cells(3, 1) ;<br>&nbsp;&nbsp; // workbook.ActiveSheet.Cells(3, 1).Select&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.Charts.Add&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp; // v.Chart.LocationWhere := '$00000001' ;//&nbsp; xlLocationAsNewSheet&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; workbook.ShowPivotTableFieldList := True&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('cat).Orientation := 3;//'xlPageField'&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('cat).Position := 1 ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('f1').Orientation := 1;//'xlPageField'&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('f1').Position := 1 ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('WEEK').Orientation := 1;//'xlPageField'&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('WEEK').Position := 1 ;<br>&nbsp;&nbsp; // v.ActiveChart.PivotLayout.PivotTable.PivotFields(' Time').Orientation := 1;//'xlPageField'&nbsp;&nbsp; ;<br>&nbsp;&nbsp; // v.ActiveChart.PivotLayout.PivotTable.PivotFields(' Time').Position := 1 ;</p>
<p><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.AddDataField(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('Usable Time'), '計數 ', -4112 )&nbsp; ;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Workbook.ShowPivotTableFieldList := False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //v.CommandBars('PivotTable').Visible := False&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v.ActiveChart.PivotLayout.PivotTable.PivotFields('計數 ').Function := -4157&nbsp;&nbsp;&nbsp;&nbsp; ;</p>
<p>&nbsp;&nbsp; v.Visible:=True;<br>&nbsp;&nbsp; <br>&nbsp; except<br>&nbsp;&nbsp;&nbsp;&nbsp; on e:exception<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do messagedlg('Create Excel Can''t work!'+#13+#10+e.message,mtWarning,[mbOk],0);<br>&nbsp; end;</p>
<p>end;<br></p>
<img src ="http://www.cnitblog.com/yide/aggbug/34704.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-10-11 16:07 <a href="http://www.cnitblog.com/yide/archive/2007/10/11/34704.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DELPHI超级Internet控件集--INDY</title><link>http://www.cnitblog.com/yide/archive/2007/04/13/25672.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Fri, 13 Apr 2007 03:06:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/04/13/25672.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/25672.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/04/13/25672.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/25672.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/25672.html</trackback:ping><description><![CDATA[你有没有用DELPHI开发Internet程序？是不是常常会烦恼FastNet组件为什么没有源代码？有很多问题，不看源代码，真不知道是什么问题。是不是也觉得FastNet组件支持的网络协议还不够多？现在不用烦恼了，有一套功能很丰富、使用很方便、开放源代码的免费INTERNET控件集可以解决你的烦恼。这套控件集就是INDY了。<br><br>　　什么是INDY？它有什么功能
<table cellSpacing=0 cellPadding=0 align=left>
    <tbody>
        <tr>
            <td><span id=ad_tech_mid_big></span></td>
        </tr>
    </tbody>
</table>
？怎么用？就让我慢慢道来。<br>　　INDY的全名是Internet Direct（也叫Winshoes），它是一套开放源代码的Internet控件集，它支持大部分流行的Internet协议，包括TCP、UDP、DNS、ICMP、FINGER、FTP、GOPHER、HTTP、POP3、SMTP、TELNET、WHOIS等，支持BASE64、MD2、MD4、MD5等编解码，提供INTERNET流行协议的客户端和服务器控件。INDY控件集的客户端和服务器控件都有完整、详细的源代码例程和帮助文件，用户可以根据这些例子，简单方便快速的建造各种服务器程序，例如WEB服务器、TELNET服务器、IRC服务器、TCP、UDP服务器等，而这些服务器都是支持多线程的。用户也可以很简单的编写出各种客户端程序，例如EMAIL、FINGER、FTP、PING、TELNET等。著名的OICQ使用的协议是UDP，有了INDY你可以使用UDP服务器和UDP客户端写出一个和OICQ较劲的东东来。<br><br>　　INDY是完全基于SOCKET阻塞工作模式（后面讨论）的开发库，现在已经支持BORLAND DELPHI、C++ BUIDER和最新的Kylix（LINUX里的DELPHI）等开发平台。目前，INDY的最新正式发行版本是8.0版，最新BETA版本是8.1版。INDY8.0支持DELPHI 4、DELPHI 5、C++BUIDER 4、C++BUIDER 5、Kylix等版本。Kylix已经把INDY作为标准组件打包到发行包里了。而且据说DELPHI 6.0将会把INDY作为它的INTERNET基本组件，由此可见INDY的强悍实力。<br><br>　　看了怎么多吸引人的特性，是不是迫不及待的想得到它了？不用急，你可以随时到INDY的主页上下载一份免费的源代码来安装，INDY的网址是（http://www.nevrona.com/Indy/），主页上会公布最新的INDY消息，发表更新的源代码和相关文档。如果在开发过程中遇到什么问题，可以通过访问BORLAND公司的新闻组（news://newsgroups.borland.com）里面的borland.public.delphi.internet.winsock和borland.public.cppbuilder.internet两个主题来获得免费的技术支持。INDY小组会及时回答在新闻组里提出的关于INDY的问题。你也可以把使用INDY的心得技巧、发现的BUG，发表到新闻组里，为INDY的发展作出一份贡献。<br><br>　　INDY的安装很简单，现在INDY的网站正式提供WINDOWS版本的安装程序供下载，支持Kylix的版本则包含在BORLAND公司的Kylix发行包里，不过由于BORLAND修改了一些文件的原因，导致INDY的例程都不能编译成功，所以INDY网站提供了针对Kylix修改的例程文件下载。下载了安装程序后，执行安装程序（请先把你的开发平台程序关掉），设置好安装路径（图一），选择好你的开发平台的种类（DELPHI或C++BUIDER）和版本（图二），就可以了。等安装完成，打开你的开发平台程序，就可以在控件栏里发现新加的三个栏目：INDY SERVERS、INDY CLIENTS、INDY MISC（图三）。分别是INDY的服务器类、客户端类、杂项控件。而安装了INDY的目录里，包含有INDY的控件文件和控件源代码以及例程。你还可以在网站上下载它的帮助文件，帮助文件里包括各个控件的详细说明，是应用好INDY的必备手册。<br><br>　　安装好INDY后，可以开始尝试INDY的新鲜好味道了。INDY提供的丰富例程就是绝好的教材。先编译几个例程，看看INDY的强大功能吧。要想熟练的使用好INDY，就得多多学习这些例程和参考帮助文件。<br><br>　　熟悉WINSOCK编程的读者一定会觉得奇怪吧，为什么INDY是是完全基于SOCKET阻塞工作模式的呢？异步模式（非阻塞模式）是WINSOCK的一大特点，为什么不用呢？<br><br>　　其实，之所以大多数WINDOWS下的INTERNET程序都使用异步模式，这和WINSOCK的历史有关。当WINSOCK被移植到WINDOWS的时候，当时的WINDOWS操作系统还是WINDOWS 3.1，而WINDOWS 3.1是不支持多线程的，不象UNIX下可以使用FORK来运行多进程。在WINDOWS 3.1下，如果使用阻塞模式，在通讯时会锁定用户界面使程序没有响应，为了避免这种情况，WINSOCK就引入异步模式这个新特性。而使用异步模式来编制INTERNET程序也就成了WINDOWS程序员的经典教条。但是，随着新的WINDOWS操作系统的出现，如WINDOWS 95、NT、98、ME、2000等，这些操作系统开始支持多线程。异步模式这个教条仍然深入人心，使很多程序员会下意识的拒绝使用阻塞模式。<br><br>　　事实上，UNIX下的SOCKET只支持阻塞模式（现在UNXI的SOCKET有了一些新的非阻塞特性，不过绝大多数应用仍然使用阻塞模式）。阻塞模式具有以下几个比异步模式优越的特点：<br><br>　　编程更简单，可以把所有处理SOCKET的代码放在一起，顺序执行，而不用分散在不同的事件处理代码段里。 <br><br>　　更容易移植到UNIX，使用INDY的DELPHI程序，可以不做太多（甚至不做）修改，就可以把WINDOWS的DELPHI源代码拿到LINUX下，用Kylix来编译成LINUX下的网络程序。 <br><br>　　更容易在多线程程序里使用，由于阻塞模式的代码可以放在一起，可以很方便的把这些代码包裹在线程里面来使用，而不象异步模式，需要针对不同的事件，设置不同的处理代码。 <br><br>　　为了兼顾简单可靠和高效，INDY是基于阻塞模式工作的。阻塞模式需要等待任务完成才返回，这样，当主线程里调用阻塞任务运行时，程序不能处理用户界面的消息。INDY提供了一个控件TidAntiFreeze来解决这个问题。只要在你的程序里，简单的填加一个TidAntiFreeze控件到任何地方（随便往FORM上放），不需要写任何代码（最多把超时时间改一下），就可以很好的解决用户界面不响应的问题。<br><br>　　下面有两段示范代码，可以看出INDY控件的程序代码和其他使用异步模式的Internet控件的程序代码相比，是多么的简洁：<br><br>代码一：INDY控件的程序代码（IndyClient代表INDY控件的一般形式）<br><br>with IndyClient do begin<br><br>Connect; <br><br>Try<br><br>// 在这里写入你的处理代码<br><br>finally<br><br>Disconnect; <br><br>end;<br><br>end;<br><br>代码二：其他控件的程序代码（SocketComponent代表一般的Internet控件） <br><br>procedure TFormMain.TestOnClick(Sender: TComponent);<br><br>begin<br><br>with SocketComponent do begin<br><br>Connect; try<br><br>while not Connected do begin<br><br>if IsError then begin<br><br>Abort;<br><br>end;<br><br>Application.ProcessMessages;<br><br>OutData := 'Data To send';<br><br>while length(OutData) &gt; 0 do begin<br><br>Application.ProcessMessages;<br><br>end;<br><br>finally Disconnect; end;<br><br>end;<br><br>end;<br><br>procedure TFormMain.OnConnectError;<br><br>begin<br><br>IsError := True;<br><br>end;<br><br>procedure TFormMain.OnRead;<br><br>var<br><br>i: Integer;<br><br>begin<br><br>i := SocketComponent.Send(OutData);<br><br>OutData := Copy(OutData, i + 1, MaxInt);<br><br>end;<br><br>关于INDY的简单介绍就到这里了，感兴趣的朋友就去下载一个用吧，你一定会喜欢上它的。 
<img src ="http://www.cnitblog.com/yide/aggbug/25672.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-04-13 11:06 <a href="http://www.cnitblog.com/yide/archive/2007/04/13/25672.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用delphi写excel文件</title><link>http://www.cnitblog.com/yide/archive/2007/03/20/24328.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 20 Mar 2007 02:29:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2007/03/20/24328.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/24328.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2007/03/20/24328.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/24328.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/24328.html</trackback:ping><description><![CDATA[
		<div class="tit">用delphi写excel文件</div>
		<div class="date">2007-03-18 21:12</div>
		<table style="TABLE-LAYOUT: fixed">
				<tbody>
						<tr>
								<td>
										<div class="cnt">
												<p>1.引用:      Excel2000, OleServer,Comobj, StdCtrls</p>
												<p>2.声明变量:     ExcelApplication,Sheet1:Variant;(全局的或局部的).</p>
												<p>3.创建及写入:  </p>
												<p>try<br />     ExcelApplication:=CreateOleObject('Excel.Application');<br />except<br />     Showmessage('Sorry,你可能?FONT COLOR="#000000"&gt;]有安裝Excel');<br />     abort;<br />end;<br />ExcelApplication.Visible:=true;<br />ExcelApplication.Workbooks.Add(xlWBatWorkSheet);<br />Sheet1:=ExcelApplication.Workbooks[1].Worksheets['sheet1'];<br />Sheet1.Name:='Delphi控制Excel Chart';<br />Sheet1.Cells.item[1,1]:='姓名';     //第1行,第1列</p>
												<p>4.使用图表</p>
												<p>var Cell1,Cell2,Cell3,Cell4,Range1,Range2:Variant;</p>
												<p>//向工作表中添加內嵌圖表﹐Add方法中的四個參數分別表示與儲存格A1的左邊距﹑頂部邊距﹑以及圖表的寬度and高度﹔<br />Sheet1.ChartObjects.add(10, 60, 500, 280);<br />sheet1.ChartObjects[1].Activate; //激活當前圖表<br />sheet1.ChartObjects[1].Chart.charttype:=xl3DColumnClustered; //指定圖表類型﹕立體叢集直條圖<br />sheet1.ChartObjects[1].Chart.seriescollection.ADD[Range2];     //建立新數例<br />sheet1.ChartObjects[1].Chart.seriescollection[1].values:=Range2; //指定新數例值<br />sheet1.ChartObjects[1].Chart.seriesCollection[1].hasdatalabels:=True; //顯示圖表中數列的資料標簽﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MinimumScale:=100;//設定數值座標軸的最小刻度值﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MaximumScale:=200;//設定數值座標軸的最大刻度值﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MajorUnit:=10; //設定數值座標的主要單位﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MinorUnit:=10; //設定數值座標的次要單位﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].HasTitle:=True;<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].AxisTitle.Text:='星期';     //類別座標軸標簽。<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].CategoryNames:=Range1;<br />sheet1.ChartObjects[1].Chart.HasLegend:=false;//不顯示圖例<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.Visible:=true; //圖表區域填滿<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.ForeColor.SchemeColor:= 28;     //前景色彩﹔<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.BackColor.SchemeColor:= 42;     //背景色彩﹔<br />sheet1.ChartObjects[1].Chart.Rotation :=44; // 以度為單位傳回或設定立體圖表檢視的旋轉值﹔<br />sheet1.ChartObjects[1].Chart.walls.Interior.ColorIndex:=28;<br />//如果指定圖表的座標軸為直角﹐并與圖表的轉角或仰角無關﹐則為True,僅適用于立體折線圖﹐直條圖與橫條圖﹔<br />sheet1.ChartObjects[1].Chart.RightAngleAxes := True;<br />sheet1.ChartObjects[1].Chart.ChartGroups(1).VaryByCategories:=true;//對每個資料標號指定不同的色彩或圖樣.</p>
												<p>
												</p>
												<p>////////////////////////////////////////////////////////////////////////////////////////////////////</p>
												<p>以下是完整文档</p>
												<p>unit Unit1;</p>
												<p>interface</p>
												<p>uses<br />    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br />Dialogs</p>
												<p>, Excel2000, OleServer,Comobj, StdCtrls;</p>
												<p>type<br />    TForm1 = class(TForm)<br />      Button1: TButton;<br />      procedure Button1Click(Sender: TObject);<br />    private<br />    { Private declarations }<br />    //==================================<br />    ExcelApplication,Sheet1:Variant;<br />    public<br />      { Public declarations }<br />    end;</p>
												<p>var<br />    Form1: TForm1;</p>
												<p>implementation</p>
												<p>{$R *.dfm}</p>
												<p>procedure TForm1.Button1Click(Sender: TObject);<br />var Cell1,Cell2,Cell3,Cell4,Range1,Range2:Variant;<br />begin<br />try<br />    ExcelApplication:=CreateOleObject('Excel.Application');<br />except<br />    Showmessage('Sorry,你可能?FONT COLOR="#000000"&gt;]有安裝Excel');<br />    abort;<br />end;<br />ExcelApplication.Visible:=true;<br />ExcelApplication.Workbooks.Add(xlWBatWorkSheet);<br />Sheet1:=ExcelApplication.Workbooks[1].Worksheets['sheet1'];<br />Sheet1.Name:='Delphi控制Excel Chart';<br />Sheet1.Cells.item[1,1]:='Excel Chart -范例';<br />Sheet1.Cells.item[2,1]:='星期';         //第二行,第1列<br />Sheet1.Cells.item[2,2]:='星期一';<br />Sheet1.Cells.item[2,3]:='星期二';<br />Sheet1.Cells.item[2,4]:='星期三';       //我要知道sheet的所有属性<br />Sheet1.Cells.item[2,5]:='星期四';<br />Sheet1.Cells.item[2,6]:='星期五-';<br />Sheet1.Cells.item[2,7]:='星期六';<br />Sheet1.Cells.item[2,8]:='星期日';<br />Sheet1.Cells.item[3,1]:='銷售量';<br />Sheet1.Cells.item[3,2]:=115;<br />Sheet1.Cells.item[3,3]:=112;<br />Sheet1.Cells.item[3,4]:=156;<br />Sheet1.Cells.item[3,5]:=148;<br />Sheet1.Cells.item[3,6]:=132;<br />Sheet1.Cells.item[3,7]:=196;<br />Sheet1.Cells.item[3,8]:=162;<br />Cell1:=Sheet1.Cells.item[2,2];<br />Cell2:=Sheet1.Cells.item[2,8];<br />Cell3:=Sheet1.Cells.item[3,2];<br />Cell4:=Sheet1.Cells.item[3,8];<br />Range1:=sheet1.Range[cell1,cell2]; //設定Chart類別座標軸的取值范圍<br />Range2:=sheet1.Range[cell3,cell4]; //設定Chart數值座標軸的取值范圍<br />Range1.Borders.Color:=27;<br />Range2.Borders.Color:=6;<br />//向工作表中添加內嵌圖表﹐Add方法中的四個參數分別表示與儲存格A1的左邊距﹑頂部邊距﹑以及圖表的寬度and高度﹔<br />Sheet1.ChartObjects.add(10, 60, 500, 280);<br />sheet1.ChartObjects[1].Activate; //激活當前圖表<br />sheet1.ChartObjects[1].Chart.charttype:=xl3DColumnClustered; //指定圖表類型﹕立體叢集直條圖<br />sheet1.ChartObjects[1].Chart.seriescollection.ADD[Range2];    //建立新數例<br />sheet1.ChartObjects[1].Chart.seriescollection[1].values:=Range2; //指定新數例值<br />sheet1.ChartObjects[1].Chart.seriesCollection[1].hasdatalabels:=True; //顯示圖表中數列的資料標簽﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MinimumScale:=100;//設定數值座標軸的最小刻度值﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MaximumScale:=200;//設定數值座標軸的最大刻度值﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MajorUnit:=10; //設定數值座標的主要單位﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlValue].MinorUnit:=10; //設定數值座標的次要單位﹔<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].HasTitle:=True;<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].AxisTitle.Text:='星期';    //類別座標軸標簽。<br />sheet1.ChartObjects[1].Chart.Axes[xlCategory].CategoryNames:=Range1;<br />sheet1.ChartObjects[1].Chart.HasLegend:=false;//不顯示圖例<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.Visible:=true; //圖表區域填滿<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.ForeColor.SchemeColor:= 28;    //前景色彩﹔<br />sheet1.ChartObjects[1].Chart.ChartArea.Fill.BackColor.SchemeColor:= 42;    //背景色彩﹔<br />sheet1.ChartObjects[1].Chart.Rotation :=44; // 以度為單位傳回或設定立體圖表檢視的旋轉值﹔<br />sheet1.ChartObjects[1].Chart.walls.Interior.ColorIndex:=28;<br />//如果指定圖表的座標軸為直角﹐并與圖表的轉角或仰角無關﹐則為True,僅適用于立體折線圖﹐直條圖與橫條圖﹔<br />sheet1.ChartObjects[1].Chart.RightAngleAxes := True;<br />sheet1.ChartObjects[1].Chart.ChartGroups(1).VaryByCategories:=true;//對每個資料標號指定不同的色彩或圖樣.<br />end;</p>
												<p>
												</p>
												<p>
														<br />
												</p>
										</div>
								</td>
						</tr>
				</tbody>
		</table>
<img src ="http://www.cnitblog.com/yide/aggbug/24328.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2007-03-20 10:29 <a href="http://www.cnitblog.com/yide/archive/2007/03/20/24328.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE 函數</title><link>http://www.cnitblog.com/yide/archive/2006/12/07/20167.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 07 Dec 2006 02:11:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/12/07/20167.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/20167.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/12/07/20167.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/20167.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/20167.html</trackback:ping><description><![CDATA[
		<p class="content" style="MARGIN: 4px 2px 0px">PL/SQL单行函数和组函数详解<br />　函数是一种有零个或多个参数并且有一个返回值的程序。在SQL中Oracle内建了一系列函数，这些函数都可被称为SQL或PL/SQL语句，函数主要分为两大类：<br /><br />　　 单行函数<br /><br />　　 组函数 <br /><br />　　本文将讨论如何利用单行函数以及使用规则。<br /><br />　　SQL中的单行函数<br /><br />　　SQL和PL/SQL中自带很多类型的函数，有字符、数字、日期、转换、和混合型等多种函数用于处理单行数据，因此这些都可被统称为单行函数。这些函数均可用于SELECT,WHERE、ORDER BY等子句中，例如下面的例子中就包含了TO_CHAR,UPPER,SOUNDEX等单行函数。<br />SELECT ename,TO_CHAR(hiredate,'day,DD-Mon-YYYY')FROM empWhere UPPER(ename) Like 'AL%'ORDER BY SOUNDEX(ename)<br /><br />　　单行函数也可以在其他语句中使用，如update的SET子句，INSERT的VALUES子句，DELET的WHERE子句,认证考试特别注意在SELECT语句中使用这些函数，所以我们的注意力也集中在SELECT语句中。<br /><br />　　NULL和单行函数<br /><br />　　在如何理解NULL上开始是很困难的，就算是一个很有经验的人依然对此感到困惑。NULL值表示一个未知数据或者一个空值，算术操作符的任何一个操作数为NULL值，结果均为提个NULL值,这个规则也适合很多函数，只有CONCAT,DECODE,DUMP,NVL,REPLACE在调用了NULL参数时能够返回非NULL值。在这些中NVL函数时最重要的，因为他能直接处理NULL值，NVL有两个参数：NVL(x1,x2),x1和x2都式表达式，当x1为null时返回X2,否则返回x1。<br /><br />　　下面我们看看emp数据表它包含了薪水、奖金两项，需要计算总的补偿<br />column name emp_id salary bonuskey type pk nulls/unique nn,u nnfk table datatype number number numberlength 11.2 11.2<br /><br />　　不是简单的将薪水和奖金加起来就可以了，如果某一行是null值那么结果就将是null，比如下面的例子：<br />update empset salary=(salary+bonus)*1.1<br /><br />　　这个语句中，雇员的工资和奖金都将更新为一个新的值，但是如果没有奖金，即 salary + null,那么就会得出错误的结论，这个时候就要使用nvl函数来排除null值的影响。<br />所以正确的语句是：<br />update empset salary=(salary+nvl(bonus,0)*1.1<br />单行字符串函数<br /><br />　　单行字符串函数用于操作字符串数据，他们大多数有一个或多个参数，其中绝大多数返回字符串<br /><br />　　ASCII()<br />　　c1是一字符串，返回c1第一个字母的ASCII码，他的逆函数是CHR()<br />SELECT ASCII('A') BIG_A,ASCII('z') BIG_z FROM empBIG_A BIG_z65 122<br /><br />　　CHR(＜i＞)[NCHAR_CS]<br />　　i是一个数字，函数返回十进制表示的字符<br />select CHR(65),CHR(122),CHR(223) FROM empCHR65 CHR122 CHR223A z B<br /><br />　　CONCAT(,)<br />　　c1,c2均为字符串，函数将c2连接到c1的后面，如果c1为null,将返回c2.如果c2为null,则返回c1，如果c1、c2都为null，则返回null。他和操作符||返回的结果相同<br />select concat('slobo ','Svoboda') username from dualusernameslobo Syoboda<br /><br />　　INITCAP()<br />　　c1为一字符串。函数将每个单词的第一个字母大写其它字母小写返回。单词由空格，控制字符，标点符号限制。<br />select INITCAP('veni,vedi,vici') Ceasar from dualCeasarVeni,Vedi,Vici<br /><br />　　INSTR(,[,＜i＞[,]])<br />　　c1,c2均为字符串，i,j为整数。函数返回c2在c1中第j次出现的位置，搜索从c1的第i个字符开始。当没有发现需要的字符时返回0,如果i为负数，那么搜索将从右到左进行，但是位置的计算还是从左到右，i和j的缺省值为1.<br />select INSTR('Mississippi','i',3,3) from dualINSTR('MISSISSIPPI','I',3,3)11select INSTR('Mississippi','i',-2,3) from dualINSTR('MISSISSIPPI','I',3,3)2<br /><br />　　INSTRB(,[,i[,j])<br />　　与INSTR（）函数一样，只是他返回的是字节，对于单字节INSTRB()等于INSTR()<br /><br />　　LENGTH()<br />　　c1为字符串，返回c1的长度，如果c1为null，那么将返回null值。<br />select LENGTH('Ipso Facto') ergo from dualergo10<br /><br />　　LENGTHb()<br />　　与LENGTH()一样，返回字节。<br /><br />　　lower()<br />　　返回c的小写字符，经常出现在where子串中<br />select LOWER(colorname) from itemdetail WHERE LOWER(colorname) LIKE '%white%'COLORNAMEWinterwhite<br /><br />　　LPAD(,＜i＞[,])<br />　　c1,c2均为字符串，i为整数。在c1的左侧用c2字符串补足致长度i,可多次重复，如果i小于c1的长度，那么只返回i那么长的c1字符，其他的将被截去。c2的缺省值为单空格，参见RPAD。<br />select LPAD(answer,7,'') padded,answer unpadded from question;PADDED UNPADDED Yes YesNO NOMaybe maybe<br /><br />　　LTRIM(,)<br />　　把c1中最左边的字符去掉，使其第一个字符不在c2中，如果没有c2，那么c1就不会改变。<br />select LTRIM('Mississippi','Mis') from dualLTRppi<br /><br />　　RPAD(,＜i＞[,]) <br />　　在c1的右侧用c2字符串补足致长度i,可多次重复，如果i小于c1的长度，那么只返回i那么长的c1字符，其他的将被截去。c2的缺省值为单空格,其他与LPAD相似<br /><br />　　RTRIM(,)<br />　　把c1中最右边的字符去掉，使其第后一个字符不在c2中，如果没有c2，那么c1就不会改变。<br /><br />　　REPLACE(,[,])<br />　　c1,c2,c3都是字符串，函数用c3代替出现在c1中的c2后返回。<br />select REPLACE('uptown','up','down') from dualREPLACEdowntown<br /><br />　　STBSTR(,＜i＞[,])<br />　　c1为一字符串，i,j为整数，从c1的第i位开始返回长度为j的子字符串，如果j为空，则直到串的尾部。<br />select SUBSTR('Message',1,4) from dualSUBSMess<br /><br />　　SUBSTRB(,＜i＞[,])<br />　　与SUBSTR大致相同，只是I,J是以字节计算。<br /><br />　　SOUNDEX()<br />　　返回与c1发音相似的词<br />select SOUNDEX('dawes') Dawes SOUNDEX('daws') Daws, SOUNDEX('dawson') from dualDawes Daws DawsonD200 D200 D250<br /><br />　　TRANSLATE(,,)<br />　　将c1中与c2相同的字符以c3代替<br />select TRANSLATE('fumble','uf','ar') test from dualTEXTramble <br /><br />　　TRIM([[]] from c3)<br />　　将c3串中的第一个，最后一个，或者都删除。<br />select TRIM(' space padded ') trim from dual TRIMspace padded<br /><br />　　UPPER()<br />　　返回c1的大写，常出现where子串中<br />select name from dual where UPPER(name) LIKE 'KI%'NAMEKING<br />单行数字函数<br /><br />　　单行数字函数操作数字数据，执行数学和算术运算。所有函数都有数字参数并返回数字值。所有三角函数的操作数和值都是弧度而不是角度，oracle没有提供内建的弧度和角度的转换函数。<br /><br />　　ABS()<br />　　返回n的绝对值<br /><br />　　ACOS()<br />　　反余玄函数，返回-1到1之间的数。n表示弧度<br />select ACOS(-1) pi,ACOS(1) ZERO FROM dualPI ZERO3.14159265 0 <br /><br />　　ASIN()<br />　　反正玄函数，返回-1到1，n表示弧度<br /><br />　　ATAN()<br />　　反正切函数，返回n的反正切值，n表示弧度。<br /><br />　　CEIL()<br />　　返回大于或等于n的最小整数。<br /><br />　　COS()<br />　　返回n的余玄值，n为弧度<br /><br />　　COSH()<br />　　返回n的双曲余玄值，n 为数字。<br />select COSH(&lt;1.4&gt;) FROM dualCOSH(1.4)2.15089847<br /><br />　　EXP()<br />　　返回e的n次幂，e=2.71828183.<br /><br />　　FLOOR()<br />　　返回小于等于N的最大整数。<br /><br />　　LN()<br />　　返回N的自然对数，N必须大于0<br /><br />　　LOG(,)<br />　　返回以n1为底n2的对数<br /><br />　　MOD()<br />　　返回n1除以n2的余数，<br /><br />　　POWER(,)<br />　　返回n1的n2次方<br /><br />　　ROUND(,)<br />　　返回舍入小数点右边n2位的n1的值，n2的缺省值为0，这回将小数点最接近的整数，如果n2为负数就舍入到小数点左边相应的位上，n2必须是整数。<br />select ROUND(12345,-2),ROUND(12345.54321,2) FROM dualROUND(12345,-2) ROUND(12345.54321,2)12300 12345.54<br /><br />　　SIGN()<br />　　如果n为负数，返回-1,如果n为正数，返回1，如果n=0返回0.<br /><br />　　SIN（)<br />　　返回n的正玄值,n为弧度。<br /><br />　　SINH()<br />　　返回n的双曲正玄值,n为弧度。<br /><br />　　SQRT()<br />　　返回n的平方根,n为弧度<br /><br />　　TAN（)<br />　　返回n的正切值,n为弧度<br /><br />　　TANH()<br />　　返回n的双曲正切值,n为弧度<br /><br />　　TRUNC(,)<br />　　返回截尾到n2位小数的n1的值，n2缺省设置为0，当n2为缺省设置时会将n1截尾为整数，如果n2为负值，就截尾在小数点左边相应的位上。<br /><br />　　单行日期函数<br /><br />　　单行日期函数操作DATA数据类型，绝大多数都有DATA数据类型的参数，绝大多数返回的也是DATA数据类型的值。<br /><br />　　ADD_MONTHS(,＜i＞)<br />　　返回日期d加上i个月后的结果。i可以使任意整数。如果i是一个小数，那么数据库将隐式的他转换成整数，将会截去小数点后面的部分。<br /><br />　　LAST_DAY()<br />　　函数返回包含日期d的月份的最后一天 <br /><br />　　MONTHS_BETWEEN(,)<br />　　返回d1和d2之间月的数目,如果d1和d2的日的日期都相同，或者都使该月的最后一天，那么将返回一个整数，否则会返回的结果将包含一个分数。<br /><br />　　NEW_TIME(,,)<br />　　d1是一个日期数据类型，当时区tz1中的日期和时间是d时，返回时区tz2中的日期和时间。tz1和tz2时字符串。<br /><br />　　NEXT_DAY(,)<br />　　返回日期d后由dow给出的条件的第一天，dow使用当前会话中给出的语言指定了一周中的某一天，返回的时间分量与d的时间分量相同。<br />select NEXT_DAY('01-Jan-2000','Monday') "1st Monday",NEXT_DAY('01-Nov-2004','Tuesday')+7 "2nd Tuesday") from dual;1st Monday 2nd Tuesday03-Jan-2000 09-Nov-2004 <br /><br />　　ROUND([,])<br />　　将日期d按照fmt指定的格式舍入，fmt为字符串。<br /><br />　　SYADATE<br />　　函数没有参数，返回当前日期和时间。<br /><br />　　TRUNC([,]) <br />　　返回由fmt指定的单位的日期d.<br />单行转换函数<br /><br />　　单行转换函数用于操作多数据类型，在数据类型之间进行转换。<br /><br />　　CHARTORWID()<br />　　c 使一个字符串，函数将c转换为RWID数据类型。<br />SELECT test_id from test_case where rowid=CHARTORWID('AAAA0SAACAAAALiAAA') <br /><br />　　CONVERT(,[,])<br />　　c尾字符串，dset、sset是两个字符集，函数将字符串c由sset字符集转换为dset字符集，sset的缺省设置为数据库的字符集。<br /><br />　　HEXTORAW()<br />　　x为16进制的字符串，函数将16进制的x转换为RAW数据类型。<br /><br />　　RAWTOHEX()<br />　　x是RAW数据类型字符串，函数将RAW数据类转换为16进制的数据类型。<br /><br />　　ROWIDTOCHAR()<br />　　函数将ROWID数据类型转换为CHAR数据类型。<br /><br />　　TO_CHAR([[,)<br />　　x是一个data或number数据类型，函数将x转换成fmt指定格式的char数据类型，如果x为日期nlsparm=NLS_DATE_LANGUAGE 控制返回的月份和日份所使用的语言。如果x为数字nlsparm=NLS_NUMERIC_CHARACTERS 用来指定小数位和千分位的分隔符，以及货币符号。<br />NLS_NUMERIC_CHARACTERS ="dg", NLS_CURRENCY="string"<br /><br />　　TO_DATE([,[,）<br />　　c表示字符串，fmt表示一种特殊格式的字符串。返回按照fmt格式显示的c,nlsparm表示使用的语言。函数将字符串c转换成date数据类型。<br /><br />　　TO_MULTI_BYTE()<br />　　c表示一个字符串，函数将c的担子截字符转换成多字节字符。<br /><br />　　TO_NUMBER([,[,)<br />　　c表示字符串，fmt表示一个特殊格式的字符串，函数返回值按照fmt指定的格式显示。nlsparm表示语言，函数将返回c代表的数字。<br /><br />　　TO_SINGLE_BYTE()<br />　　将字符串c中得多字节字符转化成等价的单字节字符。该函数仅当数据库字符集同时包含单字节和多字节字符时才使用<br /><br />　　其它单行函数<br /><br />　　BFILENAME( <br />,)<br />　　dir是一个directory类型的对象，file为一文件名。函数返回一个空的BFILE位置值指示符，函数用于初始化BFILE变量或者是BFILE列。<br /><br />　　DECODE(,,[,,,[])<br />　　x是一个表达式，m1是一个匹配表达式，x与m1比较，如果m1等于x，那么返回r1,否则,x与m2比较，依次类推m3,m4,m5....直到有返回结果。<br /><br />　　DUMP(,[,[,[,]]])<br />　　x是一个表达式或字符，fmt表示8进制、10进制、16进制、或则单字符。函数返回包含了有关x的内部表示信息的VARCHAR2类型的值。如果指定了n1,n2那么从n1开始的长度为n2的字节将被返回。<br /><br />　　EMPTY_BLOB()<br />　　该函数没有参数，函数返回 一个空的BLOB位置指示符。函数用于初始化一个BLOB变量或BLOB列。<br /><br />　　EMPTY_CLOB()<br />　　该函数没有参数，函数返回 一个空的CLOB位置指示符。函数用于初始化一个CLOB变量或CLOB列。<br /><br />　　GREATEST()<br />　　exp_list是一列表达式，返回其中最大的表达式，每个表达式都被隐含的转换第一个表达式的数据类型，如果第一个表达式是字符串数据类型中的任何一个，那么返回的结果是varchar2数据类型，同时使用的比较是非填充空格类型的比较。<br /><br />　　LEAST()<br />　　exp_list是一列表达式，返回其中最小的表达式，每个表达式都被隐含的转换第一个表达式的数据类型，如果第一个表达式是字符串数据类型中的任何一个，将返回的结果是varchar2数据类型，同时使用的比较是非填充空格类型的比较。<br /><br />　　UID<br />　　该函数没有参数，返回唯一标示当前数据库用户的整数。<br /><br />　　USER<br />　　返回当前用户的用户名<br /><br />　　USERENV()<br />　　基于opt返回包含当前会话信息。opt的可选值为：<br /><br />　　ISDBA　 　　会话中SYSDBA脚色响应，返回TRUE <br />　　SESSIONID 　返回审计会话标示符<br />　　ENTRYID 　　返回可用的审计项标示符 <br />　　INSTANCE　　在会话连接后，返回实例标示符。该值只用于运行Parallel 服务器并且有 多个实例的情况下使用。<br />　　LANGUAGE　　返回语言、地域、数据库设置的字符集。<br />　　LANG　　　　返回语言名称的ISO缩写。<br />　　TERMINAL　　为当前会话使用的终端或计算机返回操作系统的标示符。<br /><br />　　VSIZE()<br />　　x是一个表达式。返回x内部表示的字节数。<br />SQL中的组函数<br /><br />　　组函数也叫集合函数，返回基于多个行的单一结果，行的准确数量无法确定，除非查询被执行并且所有的结果都被包含在内。与单行函数不同的是，在解析时所有的行都是已知的。由于这种差别使组函数与单行函数有在要求和行为上有微小的差异.<br /><br />　　组（多行）函数<br /><br />　　与单行函数相比，oracle提供了丰富的基于组的，多行的函数。这些函数可以在select或select的having子句中使用，当用于select子串时常常都和GROUP BY一起使用。<br /><br />　　AVG([{DISYINCT|ALL}])<br />　　返回数值的平均值。缺省设置为ALL.<br />SELECT AVG(sal),AVG(ALL sal),AVG(DISTINCT sal) FROM scott.empAVG(SAL) AVG(ALL SAL) AVG(DISTINCT SAL)1877.94118 1877.94118 1916.071413<br /><br />　　COUNT({*|DISTINCT|ALL} )<br />　　返回查询中行的数目，缺省设置是ALL,*表示返回所有的行。<br /><br />　　MAX([{DISTINCT|ALL}])<br />　　返回选择列表项目的最大值，如果x是字符串数据类型，他返回一个VARCHAR2数据类型，如果X是一个DATA数据类型，返回一个日期，如果X是numeric数据类型，返回一个数字。注意distinct和all不起作用，应为最大值与这两种设置是相同的。<br /><br />　　MIN([{DISTINCT|ALL}])<br />　　返回选择列表项目的最小值。<br /><br />　　STDDEV([{DISTINCT|ALL}])<br />　　返回选者的列表项目的标准差，所谓标准差是方差的平方根。<br /><br />　　SUM([{DISTINCT|ALL}])<br />　　返回选择列表项目的数值的总和。<br /><br />　　VARIANCE([{DISTINCT|ALL}])<br />　　返回选择列表项目的统计方差。<br /><br />　　用GROUP BY给数据分组<br /><br />　　正如题目暗示的那样组函数就是操作那些已经分好组的数据，我们告诉数据库用GROUP BY怎样给数据分组或者分类，当我们在SELECT语句的SELECT子句中使用组函数时，我们必须把为分组或非常数列放置在GROUP BY子句中，如果没有用group by进行专门处理，那么缺省的分类是将整个结果设为一类。<br />select stat,counter(*) zip_count from zip_codes GROUP BY state;ST ZIP_COUNT-- ---------AK 360AL 1212AR 1309AZ 768CA 3982<br /><br />　　在这个例子中，我们用state字段分类；如果我们要将结果按照zip_codes排序,可以用ORDER BY语句，ORDER BY子句可以使用列或组函数。<br />select stat,counter(*) zip_count from zip_codes GROUP BY state ORDER BY COUNT(*) DESC;ST COUNT(*)-- --------NY 4312PA 4297TX 4123CA 3982<br /><br />　　用HAVING子句限制分组数据<br /><br />　　现在你已经知道了在查询的SELECT语句和ORDER BY子句中使用主函数，组函数只能用于两个子串中，组函数不能用于WHERE子串中，例如下面的查询是错误的：<br />错误SELECT sales_clerk,SUN(sale_amount) FROM gross_sales WHERE sales_dept='OUTSIDE' AND SUM(sale_amount)&gt;10000 GROUP BY sales_clerk<br /><br />　　这个语句中数据库不知道SUM()是什么，当我们需要指示数据库对行分组，然后限制分组后的行的输出时，正确的方法是使用HAVING语句：<br />SELECT sales_clerk,SUN(sale_amount) FROM gross_sales WHERE sales_dept='OUTSIDE' GROUP BY sales_clerkHAVING SUM(sale_amount)&gt;10000;<br /><br />　　嵌套函数<br /><br />　　函数可以嵌套。一个函数的输出可以是另一个函数的输入。操作数有一个可继承的执行过程。但函数的优先权只是基于位置，函数遵循由内到外，由左到右的原则。嵌套技术一般用于象DECODE这样的能被用于逻辑判断语句IF....THEN...ELSE的函数。<br /><br />　　嵌套函数可以包括在组函数中嵌套单行函数，或者组函数嵌套入单行函数或组函数中。比如下面的例子：<br />SELECT deptno, GREATEST(COUNT(DISTINCT job),COUNT(DISTINCT mgr) cnt,COUNT(DISTINCT job) jobs,COUNT(DISTINCT mgr) mgrsFROM empGROUP BY deptno;DEPTNO CNT JOBS MGRS------ --- ---- ----10 4 4 220 4 3 430 3 3 2 </p>
		<br />
<img src ="http://www.cnitblog.com/yide/aggbug/20167.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-12-07 10:11 <a href="http://www.cnitblog.com/yide/archive/2006/12/07/20167.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SQLServer函数</title><link>http://www.cnitblog.com/yide/archive/2006/12/05/20076.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 05 Dec 2006 01:31:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/12/05/20076.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/20076.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/12/05/20076.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/20076.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/20076.html</trackback:ping><description><![CDATA[
		<div id="Content">
				<p>1.字符串函数 <br />长度与分析用 </p>
				<p>datalength(Char_expr) 返回字符串包含字符数,但不包含后面的空格 </p>
				<p>substring(expression,start,length) 不多说了,取子串 </p>
				<p>right(char_expr,int_expr) 返回字符串右边int_expr个字符 </p>
				<p>字符操作类 </p>
				<p>upper(char_expr) 转为大写 </p>
				<p>lower(char_expr) 转为小写 </p>
				<p>space(int_expr) 生成int_expr个空格 </p>
				<p>replicate(char_expr,int_expr)复制字符串int_expr次 </p>
				<p>reverse(char_expr) 反转字符串 </p>
				<p>stuff(char_expr1,start,length,char_expr2) 将字符串char_expr1中的从 </p>
				<p>start开始的length个字符用char_expr2代替 </p>
				<p>ltrim(char_expr) rtrim(char_expr) 取掉空格 </p>
				<p>
						<br />ascii(char) char(ascii) 两函数对应,取ascii码,根据ascii吗取字符 </p>
				<p>
						<br />字符串查找 </p>
				<p>charindex(char_expr,expression) 返回char_expr的起始位置 </p>
				<p>patindex("%pattern%",expression) 返回指定模式的起始位置,否则为0 </p>
				<p>
						<br />2.数学函数 </p>
				<p>abs(numeric_expr) 求绝对值 </p>
				<p>ceiling(numeric_expr) 取大于等于指定值的最小整数 </p>
				<p>exp(float_expr) 取指数 </p>
				<p>floor(numeric_expr) 小于等于指定值得最大整数 </p>
				<p>pi() 3.1415926......... </p>
				<p>power(numeric_expr,power) 返回power次方 </p>
				<p>rand([int_expr]) 随机数产生器 </p>
				<p>round(numeric_expr,int_expr) 安int_expr规定的精度四舍五入 </p>
				<p>sign(int_expr) 根据正数,0,负数,,返回+1,0,-1 </p>
				<p>sqrt(float_expr) 平方根 </p>
				<p>
						<br />3.日期函数 </p>
				<p>getdate() 返回日期 </p>
				<p>datename(datepart,date_expr) 返回名称如 June </p>
				<p>datepart(datepart,date_expr) 取日期一部份 </p>
				<p>datediff(datepart,date_expr1.dateexpr2) 日期差 </p>
				<p>dateadd(datepart,number,date_expr) 返回日期加上 number </p>
				<p>上述函数中datepart的 </p>
				<p>写法 取值和意义 </p>
				<p>yy 1753-9999 年份 </p>
				<p>qq 1-4 刻 </p>
				<p>mm 1-12 月 </p>
				<p>dy 1-366 日 </p>
				<p>dd 1-31 日 </p>
				<p>wk 1-54 周 </p>
				<p>dw 1-7 周几 </p>
				<p>hh 0-23 小时 </p>
				<p>mi 0-59 分钟 </p>
				<p>ss 0-59 秒 </p>
				<p>ms 0-999 毫秒 </p>
				<p>
						<br />日期转换 </p>
				<p>convert() </p>
				<p> </p>
				<p>4.系统函数 </p>
				<p>suser_name() 用户登录名 </p>
				<p>user_name() 用户在数据库中的名字 </p>
				<p>user 用户在数据库中的名字 </p>
				<p>show_role() 对当前用户起作用的规则 </p>
				<p>
						<br />db_name() 数据库名 </p>
				<p>object_name(obj_id) 数据库对象名 </p>
				<p>col_name(obj_id,col_id) 列名 </p>
				<p>col_length(objname,colname) 列长度 </p>
				<p>valid_name(char_expr) 是否是有效标识符 </p>
				<br />
				<div style="FONT-SIZE: 14px; LINE-HEIGHT: 25px">
				</div>
		</div>
<img src ="http://www.cnitblog.com/yide/aggbug/20076.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-12-05 09:31 <a href="http://www.cnitblog.com/yide/archive/2006/12/05/20076.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sqlserver   datetime</title><link>http://www.cnitblog.com/yide/archive/2006/12/05/20074.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 05 Dec 2006 00:55:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/12/05/20074.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/20074.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/12/05/20074.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/20074.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/20074.html</trackback:ping><description><![CDATA[
		<div class="postTitle">
				<a class="postTitle2" id="viewpost1_TitleUrl" href="http://www.cnblogs.com/fubeidong/archive/2006/10/11/526247.html">sqlServer DateTime数据类型的格式转换</a>
		</div>数据库中有个字段叫orderTime，是DateTime类型的数据，如果我们用以下SQL语句把它取出来：<br />select<br />orderTime<br />from orders<br />则会把时间都显示出来，而如果改成下面的SQL语句：<br />select<br />orderTime = convert(varchar(10),orderTime,120)<br />from orders<br />则会显示YYYY-MM-DD的格式，如：2006-06-13<br />实际上还有其它的样式，如SQL这样写：<br />select<br />orderTime = convert(varchar(12),orderTime,111)<br />from orders<br />则以YYYY/MM/DD格式显示。如2006/06/13<br />还有一大堆的格式(下面的getdate()方法是SQL里面的函数，取得服务器当前时间，也是DateTime格式的) <br />select CONVERT(varchar(12) , getdate(), 112 )<br />20040912<br />select CONVERT(varchar(12) , getdate(), 102 )<br />2004.09.12<br />select CONVERT(varchar(12) , getdate(), 101 )<br />09/12/2004<br />select CONVERT(varchar(12) , getdate(), 103 )<br />12/09/2004<br />select CONVERT(varchar(12) , getdate(), 104 )<br />12.09.2004<br />select CONVERT(varchar(12) , getdate(), 105 )<br />12-09-2004<br />select CONVERT(varchar(12) , getdate(), 106 )<br />12 09 2004<br />select CONVERT(varchar(12) , getdate(), 107 )<br />09 12, 2004<br />select CONVERT(varchar(12) , getdate(), 108 )<br />11:06:08<br />select CONVERT(varchar(12) , getdate(), 109 )<br />09 12 2004 1<br />select CONVERT(varchar(12) , getdate(), 110 )<br />09-12-2004<br />select CONVERT(varchar(12) , getdate(), 113 )<br />12 09 2004 1<br />select CONVERT(varchar(12) , getdate(), 114 )<br />11:06:08.177<br /><img src ="http://www.cnitblog.com/yide/aggbug/20074.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-12-05 08:55 <a href="http://www.cnitblog.com/yide/archive/2006/12/05/20074.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bde</title><link>http://www.cnitblog.com/yide/archive/2006/11/09/19001.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 09 Nov 2006 06:10:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/11/09/19001.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/19001.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/11/09/19001.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/19001.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/19001.html</trackback:ping><description><![CDATA[
		<p class="content" style="MARGIN: 4px 2px 0px">您可以在INSTALL SHIELD 的安装程序组里将您要添加的数据库文件<br />添加进去,或新建一个组,里面放置数据文件<br />主要操作是:<br />1. BDE的安装,<br />如果您想安装的是PARADOX数据库程序,那么<br />BDE安装组件的最小配置是下列文件<br />IDPDX32.DLL<br />IDAPI32.DLL<br />BLW32.DLL<br />IDSQL32.DLL<br />IDAPIINST.DLL<br />IDBAT32.DLL<br />IDR20009.DLL<br />IDAPI32.CFG<br />BANTAM.DLL<br />USA.BTL<br />FAREAST.DLL<br />CHARSET.CVB<br />IDAPI.CNF<br />如果你需要做的是SQL SERVER之类的安装盘的话<br />根据我的实验,似乎BDE在这方面有些问题<br />如果不选全部安装BDE,应用程序即使安装了也不能运行<br />所以要选全部安装BDE才可以<br />在BDE安装时,你可以添加进去ALIAS,在BDE安装选项里有一个SETTING<br />找到ADD ALIAS后,用NEW添加一个<br />然后可以在 ALIAS的参数列表里输入一些需要提前设置的参数设置<br />下面是我做的一个安装MS SQL SERVER的参数设置的例子<br />DATABASE NAME=haitian<br />SQLPASSTHRU MODE=SHARED NOAUTOCOMMIT<br />SERVER NAME=bm<br />USER NAME=sa<br />一般的PARADOX数据库安装,我不会用在安装程序里直接设置ALIAS的路径<br />因为程序安装路径受用户控制,所以指定安装路径后,程序在搜寻BDE 别名<br />的数据库路径时可能会出错误<br />应该是在程序运行后,由程序自己得到自己当前的路径,然后使用<br />dbiAddAlias 函数创建数据库别名<br />2. 在主选单里选择 specify components and files里<br />然后选择GROUPS,您可以用添加组 (Add Group) 添加一个安装组<br />添加组操作时可以设定这个组的安装路径,默认是<br />假设你要添加的组为DATA,你可以把改变安装路径为 install dir/data<br />比如添加的组为DATA,然后用 lanuch Explorer 启动资源管理器后<br />在资源管理器里选择你要添加的文件,拖到你要放置这些文件的组里<br />即可。<br />3.主选单里的specifys folders and icons 可以设定你安装的文件安装的<br />默认路径是那里(Advanced--&gt; Working),<br />安装后的图标是什么(Advanced --&gt;Icon)<br />还可以指定安装后程序的运行参数(General--&gt;Run Command),<br />和安装文件出现在WINDOWS 主菜单上的说明词(General--&gt;Description)<br />及安装后的运行文件的快捷键是那个(Advance--&gt;Short Cut Key)<br />个人意见：BDE除了打包文件，还要修改注册表，修改的和DELPHI安装差不多。 </p>
<img src ="http://www.cnitblog.com/yide/aggbug/19001.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-11-09 14:10 <a href="http://www.cnitblog.com/yide/archive/2006/11/09/19001.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Reporting Services 部署指南</title><link>http://www.cnitblog.com/yide/archive/2006/09/29/17485.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Fri, 29 Sep 2006 07:02:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/29/17485.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/17485.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/29/17485.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/17485.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/17485.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 作者：John H. Miller, Microsoft Corporation												摘要：SQL Server Reporting Services 通过提供基于服务器的综合性报表平台，扩展了 Microsoft Business Intelligence (BI) 的应用前景。Reporting Services 将集中式管理报表的速度、伸缩性和易管理性与桌面和 ...&nbsp;&nbsp;<a href='http://www.cnitblog.com/yide/archive/2006/09/29/17485.html'>阅读全文</a><img src ="http://www.cnitblog.com/yide/aggbug/17485.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-29 15:02 <a href="http://www.cnitblog.com/yide/archive/2006/09/29/17485.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>delphi的文件操作</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16654.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:16:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16654.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16654.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16654.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16654.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16654.html</trackback:ping><description><![CDATA[1、Delphi中拷贝文件的几种方法<br />广告<br />{方法一：用File stream }<br />Procedure FileCopy( Const sourcefilename, targetfilename: String );<br />Var<br />S, T: TFileStream;<br />Begin<br />S := TFileStream.Create( sourcefilename, fmOpenRead );<br />try<br />T := TFileStream.Create( targetfilename,fmOpenWrite or fmCreate );<br />try<br />T.CopyFrom(S, S.Size ) ;<br />finally<br />T.Free;<br />end;<br />finally<br />S.Free;<br />end;<br />End;<br />{ 方法二：使用内存块进行读写 }<br />procedure FileCopy(const FromFile, ToFile: string);<br />var<br />FromF, ToF: file;<br />NumRead, NumWritten: Word;<br />Buf: array[1..2048] of Char;<br />begin<br />AssignFile(FromF, FromFile);<br />Reset(FromF, 1);<br />AssignFile(ToF, ToFile);<br />Rewrite(ToF, 1);<br />repeat<br />BlockRead(FromF, Buf, SizeOf(Buf), NumRead);<br />BlockWrite(ToF, Buf, NumRead, NumWritten);<br />until (NumRead = 0) or (NumWritten &lt;&gt; NumRead);<br />CloseFile(FromF);<br />CloseFile(ToF);<br />end;<br />2、控制INI文件<br />要利用.INI文件做程序有关数据的存储工作，就需要能读和写.INI文件，所以列了如下<br />方法给大家参考：<br />{方法一：用 Windows API 函数}<br />① 从.INI文件中获取字符串<br />var<br />strResult:array[0..30] of Char;<br />begin<br />GetPrivateProfileString(' desktop ', 'wallpaper',<br />'c:\windows\newwall.bmp' , strResult, 100, 'c:\windows\win.ini' );<br />edit1.text:=strResult; //显示取得字符串 end;<br />② 从.INI文件中获取整数<br />var<br />nResult: integer; begin<br />nResult := GetPrivateProfileString(' desktop ', ' tilewallpaper',<br />0 , 'c:\windows\win.ini' );<br />edit1.text:=intostr(nResult); //显示取得整数 end;<br />③ 向.INI文件写入字符串<br />WritePrivateProfileString('desktop', 'wallpaper',<br />strWrite ,'c:\windows\win.ini');<br />{ 方法二：使用TiniFile进行读写 }<br />① 从.INI文件中读字符串<br />var MyIni: TIniFile;<br />begin<br />MyIni := TIniFile.Create('c:\windows\win.ini');<br />edit1.text:=MyIni.ReadString('Desktop', 'Wallpaper', '');<br />end;<br />② 向.INI文件中写入字符串<br />var MyIni: TIniFile;<br />begin<br />MyIni := TIniFile.Create('c:\windows\win.ini');<br />MyIni.WriteString('desktop', 'wallpaper', 'c:\a.bmp');<br />end;<br />3、用Delphi实现将纯文本资料转入数据库<br />在我们日常工作中，常会碰到这样一个难题：一大堆收集好的纯文本格式，比较规整的<br />资料怎样才能将它们分离，转到自己已经建好的数据库中进行管理呢？例如，有一段人<br />事档案资料document.txt，内容如下：<br />张强,25,助理工程师,<br />王宏,30,工程师,<br />李远,45,高级工程师,<br />要将它转入数据库中，document.db结构如下：<br />姓名，年龄，职称<br />怎么办呢？现在通过使用delphi编程，很好地解决了这个难题。Delphi提供了许多功能<br />强大，丰富的字符处理函数和过程，常用的有：<br />① function Length(S:String):Integer　　//返回串的长度<br />② function Copy(S:String; Index,Count: Integer):String<br />//给出一个字符串中串的拷贝<br />③ function Pos(Substr:String; S:String); Integer　　<br />//查找子串在字符串中的位置<br />④ Procedure Delete(Var S:String; Index,Count: Integer);<br />//从一个字符串中去除子串<br />利用Delphi提供的已有函数和过程基础上编制自己的三个函数，实现了纯文本格式资料<br />转入数据库功能。只要Delphi支持的数据库都可以支持。<br />Document.txt中每行数据为一个字符串，字符串中每个被分割的数据为一个字段，分割<br />每个字段的字符为分割符，这里是逗号，也可以是、;＃等符号。具体思想是：先将字符<br />串进行调整，然后把串中每个字符同分割符比较，将不是分割符的字符追加到MyStr串中<br />，最后得到一个字段的内容。通过一个循环，就可以将一个字符串分成几个字段。<br />Function GetSubStr(var aString:string; SepChar:String): String;<br />//得到字符串中一个子串<br />因要改变参数aString的值，所以将它用var定义。<br />Function GetSubStrNum(aString, SepChar: String): Integer;<br />//计算一个字符串要被分割成几个字段。<br />参数：aString是所需分割的一个字符串，<br />SepChar是分割符。<br />Function GetSubStrNum(aString:String;SepChar:String):integer;<br />var<br />i:Integer;<br />StrLen:Integer;<br />Num:Integer;<br />begin<br />StrLen:=Length(aString);<br />Num:=0;<br />For i:=1 to StrLen do<br />If Copy(aString,i,1) = SepChar then<br />Num:=Num+1;<br />result:=Num;<br />end;<br />Function GetSubStr(var aString:String;SepChar:String):String;<br />var<br />Mystr:String;<br />StrLen:Integer;<br />SepCharPos:Integer;<br />begin<br />StrLen:=Length(aString);<br />SepCharPos:=Pos(SepChar,aString); //计算分割符在子串中的位置<br />MyStr:=Copy(aString,1,SepCharPos-1); //将分割符前所有字符放到mystr串中<br />Delete(aString,1,SepCharPos); //除去分割符和分割符前的子串<br />GetSubStr:=MyStr; //返回一个字段<br />end;<br />有了上面三个函数，现在介绍一下具体的应用：<br />① 首先建立一个窗体Forml，加入一个RichEditl（或Menol），一个按钮Buttonl和一个<br />Tablel，设置Tablel的属性：<br />Tablell.DataBaseName:= 'c:\test';<br />Tablell.TableName:= 'document.db';<br />② 分别加入以下程序：<br />const<br />SepChar=',' ;<br />procedure TForm1.FormCreate(Sender: TObject);<br />begin<br />RichEdit1.Lines.LoadFromFile('c:\test\test.txt');<br />end;<br />procedure TForm1.Button1Click(Sender: TObject);<br />var<br />i,j,num:Integer;<br />MyLine:String;<br />item:array[1..3] of string;<br />begin<br />For i:=0 to RichEdit1.Lines.Count-1 do<br />begin<br />MyLine:=Richedit1.Lines[i];<br />num:=GetSubStrNum(myline,SepChar);<br />for j:=1 to num do<br />item[j]:=GetSubStr(myline,SepChar);<br />table1.open;<br />with table1 do<br />begin<br />table1.insert;<br />table1name.Asstring:=item[1];<br />table1age.Asinteger:=strtoint(item[2]);<br />table1title.Asstring:=item[3];<br />table1.post;<br />end;<br />table1.close;<br />end;<br />end;<br /><img src ="http://www.cnitblog.com/yide/aggbug/16654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:16 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>delphi与word的融合</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16653.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:13:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16653.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16653.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16653.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16653.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16653.html</trackback:ping><description><![CDATA[Delphi与Word之间的融合技术<br />(yzhshi@263.net)<br />一、VBA代码含义<br />Microsoft Word是一个集成化环境，是美国微软公司的字处理系统，但是它决不仅仅是<br />一个字处<br />理系统，它集成了Microsoft Visual Basic，可以通过编程来实现对Word功能的扩展。<br /><br />Microsoft Visual Basic在word中的代码即Word的宏，通过编写Word宏，可实现一些文<br />档处理的<br />自动化，如实现文档的自动备份、存盘等，可扩展Word文档的功能，因此，能够充分利<br />用Word的<br />特性，甚至使Word成为自己软件的一部分。<br />Word的宏既有有利的一部分，因为它能够帮助我们实现文档的自动化，但是Word的宏也<br />不是纯粹<br />的有利，有时它可能危害我们的文档、计算机系统甚至网络，从最开始的Taiwan NO1宏<br />病毒到现<br />在的Melissa宏病毒，从最开始的简单的提示，耗尽系统资源到现在的乱发电子邮件，将<br />个人的<br />信息发送到网络上，甚至向硬盘的Autoexec.bat(自动批处理文件)中添加Deltree C: -<br />y，破坏<br />整个Windows系统。<br />二、Word中内嵌的Com技术<br />可以说Word是对Com技术支持最好的软件，这样说似乎是太极端了一点，但是Word提供的<br />强大的编<br />程接口技术却能够是我们通过程序控制Word的任何一部分。无论是文件的打开、存盘、<br />打印还是文<br />档中表格的自动绘制。<br />通过编程软件，可以灵活的操纵word，这里只以Borland Delphi为例，进行详细描述：<br /><br />１、    在Delphi中调用Word软件／文件的方法<br />在Word中调用Word软件，归纳起来有三种方法：<br />。通过Delphi的控件TOleContainer 将Word嵌入<br />a.使用Delphi提供的Servers控件调用Word，使用Word的属性<br />b.通过真正的Com技术，将Office软件目录中文件MSWORD9.OLB中的类库全部导入Delphi<br />中，<br />利用Com技术编程<br />c.使用CreateOleObject将启动Word，然后以Ole方式对Word进行控制。<br />２、    对几种方法的难易程度的判别<br />a.通过Delphi的控件TOleContainer 将Word嵌入<br />这是最简单的Ole嵌入，能够直接将Word文档调用，只需要使用ToleContainer.Run就可<br />以将Word文<br />档直接启动。且这样启动的Word文档与Delphi程序是一个整体（从界面上看），但是它<br />存在不可克<br />服的缺点，即不能通过Delphi控制Word文档，也就不能实现将灵活操纵Word的目的。<br />b.使用Delphi提供的Servers控件调用Word，使用Word的属性<br />使用Delphi的Servers控件来操纵Word，在编程时Delphi能够实现代码提示，总体上看能<br />够较好的实<br />现Delphi对Word的控制，但是还有一些Word的功能不能在Delphi中调用（比如自己编写<br />的VBA宏代码）。<br />且实现功能时本来在VBA代码中可选则参数在Delphi调用的时候必须添加，否则，连编译<br />都不能通过。<br />本方式启动的Word与Delphi程序分属两个窗体。<br />此办法仅能作为一个参考。<br />c.通过真正的Com技术，将Office软件目录中文件MSWORD9.OLB中的类库全部导入Delphi<br />中，<br />利用Com技术编程<br />利用真正的Com技术，将MsWord9.OLD文件类库导入，然后利用Com技术进行使用。<br />整体上类似使用Delphi的Servers控件，稍微比Servers控件麻烦，优缺点与Servers控件<br />相同。<br />d.使用CreateOleObject将启动Word，然后以Ole方式对Word进行控制。<br />本办法是使用以CreateOleObjects方式调用Word，实际上还是Ole，但是这种方式能够真<br />正做到完全<br />控制Word文件，能够使用Word的所有属性，包括自己编写的VBA宏代码。<br />与Servers控件和com技术相比，本方法能够真正地使用Word的各种属性，和在VBA中编写<br />自己的代码<br />基本一样，可以缺省的代码也不需要使用。<br />本方式启动的Word与Delphi程序分属两个窗体。<br />缺点是使用本方法没有Delphi代码提示，所有异常处理均需要自己编写，可能编写时探<br />索性知识比较多。<br />三、Word宏编辑器<br />Word能够真正地进行VBA代码的编辑，可以编写窗体、函数。<br />进入Word宏编辑器的方法：工具-&gt;宏-&gt;Visual Basic编辑器，可进入Visual Basic编辑<br />器界面。<br />Word的Visual Basic编辑器界面和真正的Visual Basic编辑器基本相同，在此不再向详<br />述。<br />在VBA代码中，可以添加用户窗体、模块、类模块。用户窗体、模块、类模块的概念和V<br />isual Basic<br />完全相同。注释也与Visual Basic完全相同。<br />可以将光标停留在窗体、模块的任何一个子程序上，直接按“F5”运行当前子程序。<br />四、Word的宏的概述<br />Word充分地将文档编辑和VB结合起来，真正地实现文档的自动化。使用Word编程，类似<br />于使用<br />Visual Basic，所不同的是，在Word中，能够直接运行某一个子程序，直接看见结果，<br />Word的宏，<br />只能解释运行，而Visual Basic，现在已经能够编写成真正的机器码，从代码的保护上<br />来说，应该尽<br />可能地减少Word的VBA代码数量，尤其是关键的代码。<br />VBA宏，可分成四种：<br />１、    和命令名相同的宏<br />如FileSave，FileOpen，如果在VBA代码中包含与Word同名的函数，则直接执行这些VBA<br />代码，忽略Word<br />本身的命令。<br />２、    Word内特定的宏<br />这些宏包含AutoExec（启动 Word 或加载全局模板）、AutoNew（每次新建文档时）、A<br />utoOpen（每次打<br />开已有文档时）、AutoClose（每次关闭文档时），AutoExit（退出 Word 或卸载全局模<br />板时）。<br />如果VBA代码中含有这些名称的函数，则满足相应的条件，相应代码就自动执行。<br />３、    相应事件的VBA宏<br />这些宏是由事件触发的宏，如Document_Close在文档关闭的时候触发事件，Document_N<br />ew在新建文档的时<br />候触发，Document_Open在打开文档的时候触发。<br />４、    独立的宏<br />自己编写的VBA代码，即不属于上面几种情况的VBA代码，可以被其他VBA代码调用，更重<br />要的是，可以被<br />其他程序调用。<br />这样，我们就可以屏弃Word自动执行的宏，通过Delphi直接调用相应宏来达到目的。<br />五、Word命令宏的详细描述<br />Word本身的命令函数包含很多，但是无论是word联机帮助还是MSDN帮助，都没有这方面<br />的介绍，因此只能<br />凭自己的实验取探索，初步探测的函数如下：<br />宏名    解释    注释<br />FileNew 新建    <br />FileNewDefault  新建空白文档    <br />FileSaveAs      另存为  <br />FileOpen        打开    <br />FileClose       关闭    <br />FilePrint       打印    <br />FilePrintPreview        打印预览        <br />ToolsCustomize  工具栏里面的自定义      <br />ToolsOptions    工具选项        <br />ToolsRevisions  突出显示修订    <br />ToolsReviewRevisions    接受或拒绝修订  <br />ToolsRevisionMarksAccept        接受修订        <br />ToolsRevisionMarksReject        拒绝修订        <br />ToolsRevisionMarksToggle        修订    <br />ToolsMacro      宏      <br />ToolsRecordMacroToggle  录制新宏        <br />ViewSecurity    安全性  <br />ViewVBCode      查看VB编辑器环境        <br />FileTemplates   模板和可加载项  <br />ToolsProtectUnprotectDocument   解除对文档的保护        <br />InsertHyperlink 插入超级链接    <br />EditHyperlink   编辑超级链接    <br />DeleteHyperlink 删除超级链接    <br />EditLinks       查看、删除链接  <br />EditPasteAsHyperlink    粘贴超级链接    <br />FormatStyle     样式    <br />EditBookMark    书签<br />--<br /><img src ="http://www.cnitblog.com/yide/aggbug/16653.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:13 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16653.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>發送可認證郵件</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16650.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:12:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16650.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16650.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16650.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16650.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16650.html</trackback:ping><description><![CDATA[delphi6下编写需要认证的发送邮件程序（比如263）<br />最近在delphi5下编写一个数据库的程序，其中有一个功能就是能够自己发送email，本<br />来我想偷懒让sql server自己发送，看了半天联机帮助不知所以然，于是发狠上网去找<br />控件乐，（delphi5自带的不支持认证）找到一套叫做indy的控件，可以发送需要SMTP认<br />证的邮件，我把控件导入delphi5，就去喝可乐乐，呵呵，回来迷茫的看着机器，突然发<br />现，这几个控件好面熟，噢，呵呵，原来是delphi6里面的东东哦，(台下观众开始毫不<br />留情的扔石头了)<br />现在我就贴出来，大家看看，嘻嘻<br />首先 在indy clients 页上 摘取一个TidSMTP控件（就是那个蓝颜色的柜子啦）<br />然后 在indy misc  页上 摘取一个TIdMessage控件（象一个信笺的东东）<br />呵呵，我们给他们取名为SMTP和IdMsgSend<br />然后开始自己的如下代码<br />procedure Tform1.SendAlarmEmail;<br />begin<br />if SMTPAuthority then  //SMTPAuthority 是 表示这个SMTP服务器是否需要认证的bo<br />olean<br />      SMTP.AuthenticationType := atLogin<br />        else  SMTP.AuthenticationType := atNone;<br />SMTP.UserID := myzerg@263.net;//帐户<br />SMTP.Password := **********;//密码<br />{General setup}<br />SMTP.Host := SMTP.263.net;<br />SMTP.Port := 25;<br />  try<br />   SMTP.Connect;<br />   except<br />    Showmessage('连接SMTP服务器失败!');<br />    Exit;<br />    end;<br /> try<br />   with IdMsgSend do<br />    begin<br />     body.Clear;<br />     Body.Add('hello world');//内容<br />     From.Text := 'myzerg@263.net';<br />     Recipients.EMailAddresses :='zyx_chz@263.net'//收件人<br />     Subject:='老友,哈喽'//主题<br />   end;<br />  SMTP.Send(IdMsgSend);<br />  finally<br />  SMTP.Disconnect;<br />  end;<br />end;<br />因为是从代码里面改来的,(因为源码里面还有别的功能),原理就是这样了<br />其他的功能( 附件,转交,信件的格式mime等等都可以设置的)<br /><img src ="http://www.cnitblog.com/yide/aggbug/16650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:12 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16650.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>代码创建形式规范</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16646.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:08:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16646.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16646.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16646.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16646.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16646.html</trackback:ping><description><![CDATA[Delphi代码创建形式规范 1.0<br />Bear, 2000-5-1<br />本规范的目的：给自己的代码一个统一而标准的外观，增强<br />              可读性，可理解性，可维护性<br />本规范的原则：名称反映含义,形式反映结构<br />1、单元风格<br />2、各区风格<br />3、语句风格<br />4、命名规则<br />参考：Borland官方Object Pascal风格指南<br />      Delphi5程序员指南编码标准<br />        1、单元风格<br />　<br />{*******************************************************}<br />{ }<br />{ 项目名称 }<br />{ }<br />{ 版权所有 (C) 2000,2001 公司名称 }<br />{ }<br />{*******************************************************}<br />unit UnitName;<br />{*******************************************************<br />项目:<br />模块:<br />描述:<br />版本:<br />日期:<br />作者:<br />更新:<br />TODO:<br />*******************************************************}<br />interface<br />uses<br />   ----,----,----,----,----,----,----,----,----,----,----,<br />   ----,----, ----,----,----,----;<br />const<br />   --------------------;<br />   --------------------;<br />   --------------------;<br />    type<br />   --------------------;<br />   --------------------;<br />   --------------------;<br />    --------------------;<br />   --------------------;<br />   --------------------;<br />var<br />   --------------------;<br />   --------------------;<br />   --------------------;<br />implementation<br />uses<br />   ----,----,----,----;<br />{$R *.RES}<br />{$R *.DFM}<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />--------------------------------;<br />end.<br />返回<br />      2、各区风格<br />0、注释与空白<br />   用{ } 不用 //<br />   主题注释，函数过程目的说明，语句注释<br />   空行 ：版权块，类之间，方法之间--（两行） 方法内部块（一行）<br />   空格 ：用以增强清晰度<br />   缩进 ：两个空格<br />1、常量区<br />基本：<br />Const<br />  ----- = ----;<br />  ----- = ----;<br />  ----- = ----;<br />  ----- = ----;<br />扩展<br />前缀： 少则C_---；多则可以每个主题有一个前缀<br />Const<br />  { 主题1 }<br />  C_--- = ----; { 含义 }<br />  C_--- = ----; { 含义 }<br />  C_--- = ----; { 含义 }<br />  C_--- = ----; { 含义 }<br />  { 主题2 }<br />  ----- = ----;<br />  ----- = ----;<br />  ----- = ----;<br />  ----- = ----;<br />资源字符串,放在变量区后面<br />resourcestring<br />const<br />  S_--- = '----';<br />  S_--- = '----';<br />  S_--- = '----';<br />例子：<br />   CM_BASE = $B000;<br />   CM_ACTIVATE = CM_BASE + 0;<br />   CM_DEACTIVATE = CM_BASE + 1;<br />   CM_GOTFOCUS = CM_BASE + 2;<br />   CM_LOSTFOCUS = CM_BASE + 3;<br />    NumPaletteEntries = 20;<br />    BoxPoints : array[0..5, 0..2] of GLfloat =<br />              ( (-1, 0, 0),<br />                  ( 0, 1, 0),<br />                  ( 1, 0, 0),<br />                  ( 0, -1, 0),<br />                  ( 0, 0, 1),<br />                  ( 0, 0, -1) );<br />   { Variant type codes (wtypes.h) }<br />    varEmpty = $0000; { vt_empty }<br />    varNull = $0001; { vt_null }<br />    varSmallint = $0002; { vt_i2 }<br />   GIFVersions : array[gv87a..gv89a] of TGIFVersionRec = ('87a', '89a');<br />      2、类型区<br />   数据类型--&gt;不提供服务的数据类型<br />   T---- = ---------<br />   对象类型--&gt;有状态并提供服务的实体<br />   T---- = class(----)<br />   private<br />     --------<br />     --------<br />   protected<br />     --------<br />     --------<br />   public<br />       --------<br />       --------<br />   published<br />       --------<br />      --------<br />   end;<br />         按字母排序<br />Private<br />   1、所有数据放在Private 区，以F打头<br />   2、所有事件属性对应的方法指针放在Private 区，以F打头<br />   3、属性的Get与Set方法放在Private 区--&gt;不准备被继承<br />   4、响应消息的方法放在Private 区<br />protected<br />   1、被子类调用的但不能被外界调用的方法与属性<br />   2、供子类重载的方法 virsual; virsual; abstract<br />public<br />   1、构建析构方法<br />   2、供外界调用的方法<br />   3、供外界调用的属性<br />published<br />   1、出现在Object Inspector里供设计时用的属性<br />   2、出现在Object Inspector里供设计时用的事件响应<br />例子：<br />  TGIFVersion = (gvUnknown, gv87a, gv89a);<br />  TGIFVersionRec = array[0..2] of char;<br />  PInterfaceTable = ^TInterfaceTable;<br />  TInterfaceTable = packed record<br />  EntryCount: Integer;<br />  Entries: array[0..9999] of TInterfaceEntry;<br />  { forword declairation }<br /> TGIFImage = class;<br />  TGIFSubImage = class;<br />  {---------------------------<br />           TGIFItem<br />   ---------------------------}<br />  TGIFItem = class(TPersistent)<br />  private<br />    FGIFImage: TGIFImage;<br />  .............<br />  end;<br />3、变量区<br /> 定义全局变量<br /> 注意不要有缺省的类对象变量，在调用者中声明！<br /> var<br /> -----------: -------;<br /> -----------: -------;<br /> 例子：<br /> GIFDelayExp: integer = 10; { Delay multiplier in mS.}<br /> GIFDelayExp: integer = 12;<br />4、实现区<br />{---------------------------------------------------------<br />                        主题<br />----------------------------------------------------------}<br />{ 方法的目的 }<br />procedure ----------------------------<br />begin<br />  --------;<br />  --------;<br />end;<br />{ 方法的目的 }<br />function -----------------------------<br />begin<br />  --------;<br />  --------;<br />end;<br />5、过程与函数<br />   命名<br />   格式<br />  返回<br />3、语句风格<br />1、简单语句<br />   -------;<br />2、复合语句<br />   begin<br />     -----;<br />     -----;<br />   end;<br />3、赋值语句<br />   -- ：= -------；<br />   -- ：= （-- + --）* （-- / --）；<br />4、局部变量<br />var<br />  ---: ---;<br />  ---: ---;<br />对于逻辑上并列的变量组：<br />var<br />  ---，<br />  ---，<br />  ---: ---;<br />5、数组声明<br />  --- = array [*..*] of ---;<br />6、if 语句<br />  if (--------) then<br />    -------------;<br />  if (--------) then<br />  begin<br />    -------------;<br />    -------------;<br />    -------------;<br />  end;<br />  if (--------) then<br />    -------------;<br />  else<br />    -------------;<br />  if (--------) then<br />  begin<br />    -------------;<br />    -------------;<br />    -------------;<br />  end else<br />    -------------;<br />   if (--------) then<br />  begin<br />    -------------;<br />    -------------;<br />    -------------;<br />  end else<br />  begin<br />    -------------;<br />    -------------;<br />    -------------;<br />  end;<br />  if (--------) then<br />    -------------<br />  else if (--------) then<br />    -------------;<br />7、for 循环<br />   for I := -------- to -------- do<br />     -------------;<br />   for I := -------- to -------- do<br />  begin<br />      -------------;<br />      -------------;<br />     -------------;<br />   end;<br />   for I := -------- to -------- do<br />      if (--------) then<br />      begin<br />         -------------;<br />         -------------;<br />         -------------;<br />       end;<br />   for I := -------- to -------- do<br />     with -------- then<br />     begin<br />        -------------;<br />       -------------;<br />       -------------;<br />     end;<br />8、while 循环<br />  while ------ do<br />  begin<br />    -------------;<br />    -------------;<br />    -------------;<br />  end;<br />9、repeat 循环<br />  repeat<br />    -------------;<br />    -------------;<br />    -------------;<br />  until ------;<br />10、case 语句<br />   case -------- of<br />     -------- : -------------;<br />     -------- : -------------;<br />     -------- : -------------;<br />           else -------------;<br />   end;<br />   case -------- of<br />      -------- :<br />        -----------------------------------------------------------------;<br />      -------- :<br />        -----------------------------------------------------------------;<br />      -------- :<br />        -----------------------------------------------------------------;<br />           else<br />        -----------------------------------------------------------------;<br />    end;<br />  case -------- of<br />     -------- : begin<br />                        --------------------------;<br />                        --------------------------;<br />                        --------------------------;<br />                    end;<br />     -------- : begin<br />                        --------------------------;<br />                        --------------------------;<br />                        --------------------------;<br />                     end;<br />     -------- : begin<br />                       --------------------------;<br />                       --------------------------;<br />                       --------------------------;<br />                    end<br />           else begin<br />                       -------------;<br />                       -------------;<br />                       -------------;<br />                    end;<br />  end;<br />11、with 语句<br />   with -------- do<br />      -------------;<br />   with -------- do<br />   begin<br />      -------------;<br />      -------------;<br />      -------------;<br />   end;<br />12、try 语句<br />     try<br />       -------------;<br />       -------------;<br />       -------------;<br />     finally<br />       -------------;<br />       -------------;<br />       -------------;<br />     end;<br />     try<br />       try<br />         -------------;<br />         -------------;<br />         -------------;<br />       except<br />          -------------;<br />           -------------;<br />       end;<br />     finally<br />       -------------;<br />       -------------;<br />       -------------;<br />     end;<br />13、其它<br />     运算:运算符前后要有空格<br />     w1[n] := ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) / depth;<br />     -- = --<br />     -- &gt;= --<br />     -- &lt;= --<br />     -- &gt; --<br />     -- &lt; --<br />     -- &lt;&gt; --<br />     -- := --; 赋值<br />     --: ----; 类型<br />     同一类型且含义逻辑上不并列的变量 20个字符长的变量名<br />     private<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />     var<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />       ------- : -------;<br />     function ---------------------(--: ----; --: ----; --: ----): ----;<br />     同一类型且含义逻辑上并列的变量 如 Error0,Error1,Error2 ; R,G,B<br />     private<br />       ------- ,<br />       ------- ,<br />       ------- ,<br />       ------- ,<br />       ------- : -------<br />     var<br />       ------- ,<br />       ------- ,<br />       ------- ,<br />       ------- ,<br />       ------- : -------<br />     function ---------------------(--, --, --: ----; var --, --, --: ----):<br /> ----;<br />     T------- = class(-------)<br />     private<br />       F-------: -------;<br />       F-------: -------;<br />       F-------: -------;<br />       function --------------: -------;<br />       procedure --------------;<br />     protected<br />       function --------------: -------;<br />       procedure --------------;<br />       function --------------: -------; virtual; abstract;<br />     public<br />       constructor Create(-------: -------); override; {if need to do someth<br />ing after Create}<br />       destructor Destroy; override; {if need to do something before Destroy<br />}<br />       function --------------: -------;<br />       procedure --------------;<br />       property -------: ------- read F-------;<br />     published<br />     end;<br />14、形式反映结构<br />  例子：<br />  TetIndex : array[0..3] of TInteger3v =<br />             ( (0, 1, 3),<br />                (2, 1, 0),<br />                (3, 2, 0),<br />                (1, 2, 3) );<br />  Cursors: array[0..4] of TIdentMapEntry = (<br />    (Value: crDefault; Name: 'crDefault'),<br />    (Value: crArrow; Name: 'crArrow'),<br />    (Value: crCross; Name: 'crCross'),<br />    (Value: crIBeam; Name: 'crIBeam') );<br />  if (dwFlags and PFD_DRAW_TO_WINDOW) = 0)<br />      or( (dwFlags and PFD_SUPPORT_OPENGL) = 0)<br />           or( (dwFlags and PFD_DOUBLEBUFFER) = 0)<br />              or (iPixelType &lt;&gt; PFD_TYPE_RGBA)<br />              or (cColorBits &lt; 16)<br />              )<br />         ) then<br />  raise Exception.Create('Inappropriate Pixel Format chosen.');<br />  glBegin(shadeType);<br />  glNormal3fv(@n0);<br />  glVertex3fv(@dodec[a, 0]);<br />  glVertex3fv(@dodec[b, 0]);<br />  glVertex3fv(@dodec[c, 0]);<br />  glVertex3fv(@dodec[d, 0]);<br />  glVertex3fv(@dodec[e, 0]);<br />  glEnd();<br />  dodec[0, 0] := -alpha; dodec[0, 1] := 0; dodec[0, 2] := beta;<br />  dodec[1, 0] := alpha; dodec[1, 1] := 0; dodec[1, 2] := beta;<br />  dodec[2, 0] := -1; dodec[2, 1] := -1; dodec[2, 2] := -1;<br />procedure glutWireTorus(<br />                        innerRadius : GLdouble; //---------<br />                        outerRadius : GLdouble; //---------<br />                        nsides : GLint; //---------<br />                        rings : GLint ); //---------<br />    case FRunDirection of<br />      rdRightToLeft : begin<br />                              StY:=CnY;<br />                                   StX:=Width - CurrentStep;<br />                              end;<br />      rdLeftToRight : begin<br />                                 StY:=CnY;<br />                                 StX:=-CurrentStep;<br />                              end;<br />      rdBottomToTop : begin<br />                                     StX:=CnX;<br />                                     StY:=Height - CurrentStep;<br />                                 end;<br />      rdTopToBottom : begin<br />                                     StX:=CnX;<br />                                     StY:=CurrentStep - RTHeight;<br />                                  end;<br />                           else begin<br />                                     StX:=CnX;<br />                                      StY:=CnY;<br />                                  end;<br />      end;<br />     case (DitherMode) of<br />        dmNearest:<br />          Ditherer := TDitherEngine.Create(Bitmap.Width, ColorLookup);<br />        dmFloydSteinberg:<br />          Ditherer := TFloydSteinbergDitherer.Create(Bitmap.Width, ColorLook<br />up);<br />        dmStucki:<br />          Ditherer := TStuckiDitherer.Create(Bitmap.Width, ColorLookup);<br />        dmSierra:<br />          Ditherer := TSierraDitherer.Create(Bitmap.Width, ColorLookup);<br />        dmJaJuNI:<br />          Ditherer := TJaJuNIDitherer.Create(Bitmap.Width, ColorLookup);<br />        dmSteveArche:<br />          Ditherer := TSteveArcheDitherer.Create(Bitmap.Width, ColorLookup);<br /><br />        dmBurkes:<br />          Ditherer := TBurkesDitherer.Create(Bitmap.Width, ColorLookup);<br />      else<br />        exit;<br />end;<br />返回<br />4、命名规则<br />  1、文件名称: u模块名称；见名知意<br />  2、控件名称: 功能_控件缩写；见名知意<br />  3、变量 : 尽量不用缩写，尽量用名词；见名知意<br />  4、方法与过程：尽量不用缩写，尽量用动宾词组；见名知意<br /> 5、常见的惯例<br />            类名以T打头 (Type之意)<br />            类的私有数据域以F打头(Field之意)<br />            对数据的存取操作分别以Set，Get打头<br />            事件属性以On打头<br /><br /><br />--End--<br /><img src ="http://www.cnitblog.com/yide/aggbug/16646.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:08 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16646.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>保存程序狀態方法</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16643.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:03:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16643.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16643.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16643.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16643.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16643.html</trackback:ping><description><![CDATA[Delphi应用程序中保存状态信息的两种方法<br />成都市电子科技大学９６<br />---- 许多For Windows的应用程序在一次运行结束时会自动保存此次运行的状态信息，<br />这<br />样做的好处是用户只要修改一次程序的运行状态，在下次启动此程序时，该程序会以上<br />次<br />运行的状态出现，用户可以按照自己的习惯来调整应用程序。<br />---- 在Delphi中有两种方法可以实现这种功能：使用INI文件或使用注册表。下面将详<br />细<br />阐述这两种方法。<br />---- 一、 使用INI文件保存状态信息<br />---- Delphi中提供了TIniFile类，TIniFile类能够在INI文件中存取应用程序专用信息<br />，我<br />们可以用它来处理INI文件。注意使用时将IniFiles单元加入uses列表中。<br />---- 使用INI文件存取应用程序专用信息是Windows 3.x中的标准方法。INI文件中的信<br />息<br />储存是分段的，每个段由一个括在方括号中的名称说明，比如WIN.INI中就包括［Deskt<br />op］<br />等段。每个段中又由一些键值组成，这些键值的格式是：&lt; keyname &gt;=&lt; value &gt;，共有<br />三<br />种类型：字符串、整型和布尔型，每种类型有两种方法可以读写：ReadBool，WriteBoo<br />l，<br />ReadInteger，WriteInteger，ReadString，WriteString。下面就一个例子来说明它们<br />的用法：<br />---- １．建立INI文件<br />  procedure  TForm1.FormCreate(Sender:Tobject);<br />   {如INI文件不存在，建立INI文件；<br />   否则，从INI文件中读取数据}<br />   var<br /> 　　status:integer;<br />     inifile:TIniFile;<br />     filename:String;<br />   begin<br />     filename:=extractfilepath<br />     (application.exename)+'iniexample.ini';<br />     inifiel:=Tinifile.create(filename);<br />     status:=inifile.readinteger<br />     ('MainForm','Status',0);<br />     if status&lt; &gt;0 then<br />     //INI文件存在，读状态信息<br />       case status of<br />       1: begin<br />         top:=inifiel.readinteger<br />         ('MainForm','Top',top);<br />          …………<br />         end;<br />       2: begin<br />         top:=100;<br />         left:=100;<br />         end;<br /> 　　　　  3: windowstate:=wsmaximized;<br />       end;<br />   end;<br /> ２．保存状态<br />   procedure  TForm1.FormDestroy<br />   (Sender:Tobject);<br />   var<br />     status:integer;<br />   begin<br />     case windowstate of<br />       wsnormal: begin<br />              inifile.writeinteger<br />              ('MainForm', 'Top',top);<br />              …………<br />              //保存状态信息<br /> 　　　　　　　　　 end;<br />       wsminimized: status:=2;<br />       wsmaximized: status:=3;<br />     end;<br />     inifile.writeinteger('MainForm',<br />    'Status',status);<br />     inifile.destroy;<br />   end;<br /> 上述程序运行之后，生成的iniexample.ini文件格式如下：<br /> 　　［MainForm］<br />    Top=60<br />    Left=100<br />    ………<br />    Status=1<br />---- 二、 使用注册表保存状态信息<br />---- INI文件只是为了兼容以前的应用程序而存在，Windows 95/NT使用系统注册表来代<br />替<br />INI文件，所有For Windows 95/NT的应用软件都应该使用注册表来保存状态，这也是<br />MicroSoft推荐的作法。Delphi提供了两个类来处理注册表。Tregistry类封装了系统注<br />册表。<br />而TRegIniFile类不但封装了注册表，还提供了一条简单的途径使现有的Windows 3.1应<br />用<br />软件升级到Windows 95/NT。TRegIniFile类提供了TIniFile类的接口，但没有使用文件<br />，<br />而是将数据保存在注册表中。文件名作为一个主键，默认建立在HKEY_CURRENT_USER<br />下。相应的，INI文件中的段名作为一个键建立，段中的各项数据就变为这个键下边的各<br /><br />项数值。仍以上面的例子为例，如果使用TRegIniFile类，只需改动三处：<br />---- １．在uses列表中用registry单元代替IniFiles单元<br />---- ２．用TRegIniFile类代替TIniFile类<br />---- ３．将inifiel:=Tinifile.create(filename);改为Inifile:=TRegIniFile.Creat<br />e(Filename);<br /><img src ="http://www.cnitblog.com/yide/aggbug/16643.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:03 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16643.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>delphi 函數</title><link>http://www.cnitblog.com/yide/archive/2006/09/11/16640.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 11 Sep 2006 02:00:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/11/16640.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16640.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/11/16640.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16640.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16640.html</trackback:ping><description><![CDATA[abort 函数 引起放弃的意外处理 <br />abs 函数 绝对值函数 <br />addexitproc 函数 将一过程添加到运行时库的结束过程表中 <br />addr 函数 返回指定对象的地址 <br />adjustlinebreaks 函数 将给定字符串的行分隔符调整为cr/lf序列 <br />align 属性 使控件位于窗口某部分 <br />alignment 属性 控件标签的文字位置 <br />allocmem 函数 在堆栈上分配给定大小的块 <br />allowgrayed 属性 允许一个灰度选择 <br />ansicomparestr 函数 比较字符串（区分大小写） <br />ansicomparetext 函数 比较字符串（不区分大小写） <br />ansilowercase 函数 将字符转换为小写 <br />ansiuppercase 函数 将字符转换为大写 <br />append 函数 以附加的方式打开已有的文件 <br />arctan 函数 余切函数 <br />assignfile 函数 给文件变量赋一外部文件名 <br />assigned 函数 测试函数或过程变量是否为空 <br />autosize 属性 自动控制标签的大小 <br />backgrounddi2001.jpg 属性 背景色 <br />beginthread 函数 以适当的方式建立用于内存管理的线程 <br />bevelinner 属性 控件方框的内框方式 <br />bevelouter 属性 控件方框的外框方式 <br />bevelwidth 属性 控件方框的外框宽度 <br />blockread 函数 读一个或多个记录到变量中 <br />blockwrite 函数 从变量中写一个或多个记录 <br />borderstyle 属性 边界类型 <br />borderwidth 属性 边界宽度 <br />break 命令 终止for、while、repeat循环语句 <br />brush 属性 画刷 <br />caption 属性 标签文字的内容 <br />changefileext 函数 改变文件的后缀 <br />chdir 函数 改变当前目录 <br />checked 属性 确定复选框选中状态 <br />chr 函数 返回指定序数的字符 <br />closefile 命令 关闭打开的文件 <br />color 属性 标签的颜色 <br />columns 属性 显示的列数 <br />comparestr 函数 比较字符串（区分大小写） <br />concat 函数 合并字符串 <br />continue 命令 继续for、while、repeat的下一个循环 <br />copy 函数 返回一字符串的子串 <br />cos 函数 余弦函数 <br />ctl3d 属性 是否具有3d效果 <br />cursor 属性 鼠标指针移入后的形状 <br />date 函数 返回当前的日期 <br />datetimetofiledate 函数 将delphi的日期格式转换为dos的日期格式 <br />datetimetostr 函数 将日期时间格式转换为字符串 <br />datetimetostring 函数 将日期时间格式转换为字符串 <br />datetostr 函数 将日期格式转换为字符串 <br />dayofweek 函数 返回星期的数值 <br />dec 函数 递减变量值 <br />decodedate 函数 将日期格式分解为年月日 <br />decodetime 函数 将时间格式分解为时、分、秒、毫秒 <br />delete 函数 从字符串中删除子串 <br />deletefile 命令 删除文件 <br />diskfree 函数 返回剩余磁盘空间的大小 <br />disksize 函数 返回指定磁盘的容量 <br />dispose 函数 释放动态变量所占的空间 <br />disposestr 函数 释放字符串在堆栈中的内存空间 <br />ditherbackgrounddi2001.jpg?使背景色的色彩加重或减少50% <br />dragcursor 属性 当鼠标按下时光标的形状 <br />dragmode 属性 按动的作用方式 <br />dropdowncount 属性 容许的显示数据项的数目 <br />editmask 属性 编辑模式 <br />enabled 属性 是否使标签呈现打开状态 <br />encodedate 函数 将年月日合成为日期格式 <br />encodetime 函数 将时、分、秒、毫秒合成为时间格式 <br />endmargin 属性 末尾边缘 <br />eof 函数 对有类型或无类型文件测试是否到文件尾 <br />eoln 函数 返回文本文件的行结束状态 <br />erase 命令 删除外部文件 <br />exceptaddr 函数 返回引起当前意外的地址 <br />exclude 函数 从集合中删除一些元素 <br />exceptobject 函数 返回当前意外的索引 <br />exit 命令 立即从当前的语句块中退出 <br />exp 函数 指数函数 <br />expandfilename 函数 返回包含绝对路径的字符串 <br />extendedselect 属性 是否允许存在选择模式，true时，multiselect才有意义 <br />extractfiledir 函数 返回驱动器和路径 <br />extractfileext 函数 返回文件的后缀 <br />extractfilename 函数 返回文件名 <br />extractfilepath 函数 返回指定文件的路径 <br />fileage 函数 返回文件已存在的时间 <br />fileclose 命令 关闭指定的文件 <br />filecreate 命令 用指定的文件名建立新文件 <br />filedatetodatetime 函数 将dos的日期格式转换为delphi的日期格式 <br />fileexists 函数 检查文件是否存在 <br />filegatattr 函数 返回文件的属性 <br />filegetdate 函数 返回文件的dos日期时间标记 <br />fileopen 命令 用指定的存取模式打开指定的文件 <br />filepos 函数 返回文件的当前指针位置 <br />fileread 命令 从指定的文件读取 <br />filesearch 命令 在目录中搜索指定的文件 <br />fileseek 函数 改变文件的指针 <br />filesetattr 函数 设置文件属性 <br />filesetdate 函数 设置文件的dos日期时间标记 <br />filesize 函数 返回当前文件的大小 <br />filewrite 函数 对指定的文件做写操作 <br />fillchar 函数 用指定的值填充连续字节的数 <br />findclose 命令 终止findfirst/findnext序列 <br />findfirst 命令 对指定的文件名及属性搜索目录 <br />findnext 命令 返回与文件名及属性匹配的下一入口 <br />floattodecimal 函数 将浮点数转换为十进制数 <br />floattostrf 函数 将浮点数转换为字符串 <br />floattostr 函数 将浮点数转换为字符串 <br />floattotext 函数 将给定的浮点数转换为十进制数 <br />floattotextfmt 函数 将给定的浮点数转换为十进制数 <br />flush 函数 将缓冲区的内容刷新到输出的文本文件中 <br />fmtloadstr 函数 从程序的资源字符串表中装载字符串 <br />fmtstr 函数 格式化一系列的参数，其结果以参数result返回 <br />font 属性 设置字体 <br />format 函数 格式化一系列的参数并返回pascal字符串 <br />formatbuf 函数 格式化一系列的参数 <br />formatdatetime 函数 用指定的格式来格式化日期和时间 <br />formatfloat 函数 指定浮点数格式 <br />frac 函数 返回参数的小数部分 <br />freemem 函数 按给定大小释放动态变量所占的空间 <br />getdir 返回指定驱动器的当前目录 <br />getheapstatus 返回内存管理器的当前状态 <br />getmem 建立一指定大小的动态变量，并将指针指向该处 <br />getmemorymanager 返回内存管理器的入口点 <br />glyph 函数 按钮上的图象 <br />halt 停止程序的执行并返回到操作系统 <br />hi 返回参数的高地址位 <br />high 返回参数的上限值 <br />hint 属性 提示信息 <br />int 返回参数的整数部分 <br />include 添加元素到集合中 <br />insert 在字符串中插入子串 <br />inttohex 将整型数转换为十六进制数 <br />inttostr 将整型数转换为字符串 <br />ioresult 返回最新的i/o操作完成状态 <br />isvalidident 测试字符串是否为有效的标识符 <br />items 属性 默认显示的节点 <br />kind 属性 摆放样式<br />largechange 属性 最大改变值 <br />layout 属性 图象布局 <br />length 函数 返回字符串的ざ?<br />lines 属性 缺省显示内容 <br />ln 函数 自然对数函数 <br />lo 函数 返回参数的低地址位 <br />loadstr 函数 从应用程序的可执行文件中装载字符资源 <br />lowercase 函数 将给定的字符串变为小写 <br />low 函数 返回参数的下限值 <br />max 属性 最大值 <br />maxlength 属性 最大长度 <br />min 属性 最小值 <br />mkdir 命令 建立一子目录 <br />move 函数 从源到目标复制字节 <br />multiselect 属性 允许同时选择几个数据项 <br />name 属性 控件的名字 <br />new 函数 建立新的动态变量并设置一指针变量指向他 <br />newstr 函数 在堆栈上分配新的字符串 <br />now 函数 返回当前的日期和时间 <br />odd 测试参数是否为奇数 <br />onactivate 事件 焦点移到窗体上时触发 <br />onclick 事件 单击窗体空白区域触发 <br />ondblclick 事件 双击窗体空白区域触发 <br />onclosequery 事件 使用者试图关闭窗体触发 <br />onclose 事件 窗体关闭后才触发 <br />oncreate 事件 窗体第一次创建时触发 <br />ondeactivate 事件 用户切换到另一应用程序触发 <br />ondragdrop 事件 鼠标拖放操作结束时触发 <br />ondragover 事件 有其他控件从他上面移过触发 <br />onmousedown 事件 按下鼠标键时触发 <br />onmouseup 事件 释放鼠标键时触发 <br />onmousemove 事件 移动鼠标时触发 <br />onhide 事件 隐藏窗体时触发 <br />onkeydown 事件 按下键盘某键时触发 <br />onkeypress 事件 按下键盘上的单个字符键时触发 <br />onkeyup 事件 释放键盘上的某键时触发 <br />onpaint 事件 窗体上有新部分暴露出来触发 <br />onresize 事件 重新调整窗体大小触发 <br />onshow 事件 在窗体实际显示之前瞬间触发 <br />ord 返回序数类的序数 <br />outlinestyle 属性 类型 <br />outofmemoryerror 引起outofmemory意外 <br />pageindex 属性 页索引 <br />pages 属性 页 <br />paramcount 函数 返回在命令行上传递给程序的参数数量 <br />paramstr 函数 返回指定的命令行参数 <br />pen 属性 画刷设置 <br />pi 函数 返回圆周率pi <br />picture 属性 显示图象 <br />pictureclosed 属性 设置closed位图 <br />pictureleaf 属性 设置leaf位图 <br />pictureminus 属性 设置minus位图 <br />pictureopen 属性 设置open位图 <br />pictureplus 属性 设置plus位图 <br />pos 函数 在字符串中搜索子串 <br />pred 函数 返回先前的参数 <br />random 函数 返回一随机函数 <br />randomize 函数 用一随机数初始化内置的随机数生成器 <br />read 函数 对有格式的文件，读一文件组件到变量中；<br />对文本文件，读一个或多个值到一个或多个变量中 <br />readln 函数 执行read过程，然后跳到文件下一行 <br />readonly 属性 只读属性 <br />reallocmem 函数 分配一动态变量 <br />rename 函数 重命名外部文件 <br />renamefile 函数 对文件重命名 <br />reset 函数 打开已有的文件 <br />rewrite 函数 建立并打开一新的文件 <br />rmdir 函数 删除空的子目录 <br />round 函数 将实数值舍入为整型值 <br />runerror 函数 停止程序的执行 <br />scrollbars 属性 滚动条状态 <br />seek 函数 将文件的鼻爸刚胍贫街付ǖ淖榧?<br />seekeof 函数 返回文件的文件结束状态 <br />seekeoln 函数 返回文件的行结束状态 <br />selectedcolor 属性 选中颜色 <br />setmemorymanager 函数 设置内存管理器的入口点 <br />settextbuf 函数 给文本文件指定i/o缓冲区 <br />shape 属性 显示的形状 <br />showexception 函数 显示意外消息与地址 <br />sin 函数 正弦函数 <br />sizeof 函数 返回参数所占的字节数 <br />smallchange 属性 最小改变值 <br />sorted 属性 是否允许排序 <br />sqr 函数 平方函数 <br />sqrt 函数 平方根函数 <br />startmargin 属性 开始边缘 <br />state 属性 控件当前状态 <br />str 函数 将数值转换为字符串<br />stralloc 函数 给以null结束的字符串分配最大长度-1的缓冲区 <br />strbufsize 函数 返回存储在由stralloc分配的字符缓冲区的最大字符数 <br />strcat 函数 将一字符串附加到另一字符串尾并返回合并的字符串 <br />strcomp 函数 比较两个字符串 <br />strcopy 函数 将一个字符串复制到另一个字符串中 <br />strdispose 函数 释放堆栈上的字符串 <br />strecopy 函数 将一字符串复制到另一个字符串并返回结果字符串尾部的指针 <br />strend 函数 返回指向字符串尾部的指针 <br />stretch 属性 自动适应控件的大小 <br />strfmt 函数 格式化一系列的参数 <br />stricomp 函数 比较两个字符串（不区分大小写） <br />stringtowidechar 函数 将ansi字符串转换为unicode字符串 <br />strlcat 函数 将一字符串中的字符附加到另一字符串尾并返回合并的字符串 <br />strlcomp 函数 以最大长度比较两个字符串 <br />strlcopy 函数 将一个字符串中的字符复制到另一个字符串中 <br />strlen 函数 返回字符串中的字符数 <br />strlfmt 函数 格式化一系列的参数，其结果中包含有指向目标缓冲区的指针 <br />strlicomp 函数 以最大长度比较两个字符串（不区分大小写） <br />strlower 函数 将字符串中的字符转换为小写 <br />strmove 函数 将一个字符串中的字符复制到另一个字符串中 <br />strnew 函数 在堆栈上分配一个字符串 <br />strpas 函数 将以null结束的字符串转换为pascal类的字符串 <br />strpcopy 函数 将pascal类的字符串复制为以null结束的字符串 <br />strplcopy 函数 从pascal类的最大长度字符串复制为以null结束的字符串 <br />strpos 函数 返回一个字符串在另一个字符串中首次出现指针 <br />strrscan 函数 返回字符串中最后出现字符的指针 <br />strscan 函数 返回字符串中出现首字符的指针 <br />strtodate 函数 将字符串转换为日期格式 <br />strtodatetime 函数 将字符串转换为日期/时间格式 <br />strtofloat 函数 将给定的字符串转换为浮点数 <br />strtoint 函数 将字符串转换为整型 <br />strtointdef 函数 将字符串转换为整型或默认值 <br />strtotime 函数 将字符串转换为时间格式 <br />strupper 函数 将字符串中的字符转换为大写 <br />style 属性 类型选择 <br />suce 函数 返回后继牟问?<br />swap 函数 交换参数的高低地址位 <br />tabs 属性 标记每一项的内容 <br />tabindex 属性 标记索引 <br />text 属性 显示的文本 <br />texttofloat 函数 将字符串（以null结束的格式）转换为浮点数 <br />time 函数 返回当前的时间 <br />timetostr 函数 将时间格式转换为字符串 <br />trim 函数 从给定的字符串中删除前导和尾部的空格及控制字符 <br />trimleft 函数 从给定的字符串中删除首部的空格及控制字符 <br />trimright 函数 从给定的字符串中删除尾部的空格及控制字符 <br />trunc 函数 将实型值截取为整型值 <br />truncate 函数 截去当前文件位置后的内容 <br />unselectedcolor 属性 未选中颜色 <br />upcase 将字符转换为大写 <br />uppercase 将给定的字符串变为大写 <br />val 函数 将字符串转换为整型值 <br />vararraycreate 函数 以给定的界限和维数建立变体数组 <br />vararraydimcount 函数 返回给定变体的维数 <br />vararrayhighbound 函数 返回给定变体数组维数的上界 <br />vararraylock 函数 锁定给定的变体数组 <br />vararraylowbound 函数 返回给定变体数组维数的下界 <br />vararrayof 函数 返回指定变体的数组元素 <br />vararrayredim 函数 通过改变上限来调整变体的大小 <br />vararrayunlock 函数 解锁指定的变体数组 <br />varastype 函数 将变体转换为指定的类型 <br />varcase 函数 将变体转换为指定的类型并保存他 <br />varclear 函数 清除指定的变体 <br />varcopy 函数 将指定的变体复制为指定的变体 <br />varformdatetime 函数 返回包含日期时间的变体 <br />varisarray 函数 测试变体是否为数组 <br />varisempty 函数 测试变体是否为unassigned <br />varisnull 函数 测试变体是否为null <br />vartodatetime 函数 将给定的变体转换为日期时间 <br />vartype 函数 将变体转换为指定的类型并保存他 <br />visible 属性 控件的可见性 <br />wantreturns 属性 为true时，按回车键产生一个回车符；<br />为false时，按下ctrl+enter才产生回车符 <br />write 命令 对有格式的文件，写一变量到文件组件中；<br />对文本文件，写一个或多个值到文件中 <br />writeln 命令 执行write过程，然后输出一行结束标志 <br />widecharlentostring 函数 将ansi字符串转换为unicode字符串 <br />widecharlentostrwar 函数 将unicode字符串转换为ansi字符串变量 <br />widechartostring 函数 将unicode字符串转换为ansi字符串 <br />widechartostrvar 函数 将unicode字符串转换为ansi字符串变量<br /><br /><img src ="http://www.cnitblog.com/yide/aggbug/16640.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-11 10:00 <a href="http://www.cnitblog.com/yide/archive/2006/09/11/16640.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>創建控件</title><link>http://www.cnitblog.com/yide/archive/2006/09/05/16380.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 05 Sep 2006 07:14:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/05/16380.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16380.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/05/16380.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16380.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16380.html</trackback:ping><description><![CDATA[
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有人说过“不会开发控件的</span>
		<span lang="EN-US">Delphi</span>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序员不是真正的程序员”。</span>
		<span lang="EN-US">Delphi</span>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正是由于高度的可扩展性和大量的第三方控件的支持才能吸引无数程序员挑剔的目光。即使是由于工作需要使用其他开发工具的开发者也常常怀念和</span>
		<span lang="EN-US">Delphi</span>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">度过的日日夜夜。接触</span>
		<span lang="EN-US">Delphi</span>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">已经一年多了，从当初对着</span>
		<span lang="EN-US">Delphi</span>
		<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件面板上上百个控件不知所措，到现在已经可以根据需要开发一些有一定难度的控件，其中走过的路是十分艰辛的，所以特此写下这篇文章，将自己的经验留给后来者，也算是献给“同门师弟”的一份厚礼吧！</span>
		<p class="MsoNormal">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要说明的一点是：在写这篇文章之前我假设读者已经对面向对象的基本知识有一定的了解，所以对于文章中面向对象相关的概念将不再展开讲述。</span>
		</p>
		<p class="MsoNormal" style="mso-outline-level: 1">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一、牛刀小试－</span>
				<span lang="EN-US">TURLLabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们从一个能够添加超链接的标签控件开始我们的控件开发之旅吧！</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">既然是</span>
				<span lang="EN-US">Label</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们就从</span>
				<span lang="EN-US">Tlabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生这个控件吧</span>
				<span lang="EN-US">(</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其实从</span>
				<span lang="EN-US">TcustomLabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生最好，不过出于简单的目的我们这里先从</span>
				<span lang="EN-US">Tlabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生</span>
				<span lang="EN-US">)</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">！</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">1</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、选择“</span>
				<span lang="EN-US">File</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”－</span>
				<span lang="EN-US">&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“</span>
				<span lang="EN-US">New</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”－</span>
				<span lang="EN-US">&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“</span>
				<span lang="EN-US">Component</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”</span>
				<span lang="EN-US">,</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将弹出如下的对话框：</span>
		</p>
		<p class="MsoNormal">
				<img height="276" alt="o_1.jpg" src="http://www.blogjava.net/images/blogjava_net/huanzhugege/4053/o_1.jpg" width="388" border="0" />
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Ancestor type</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中选择</span>
				<span lang="EN-US">Tlabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</span>
				<span lang="EN-US">ClassName</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中填入</span>
				<span lang="EN-US">TURLLabel(</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">名字可以任意取，但是要以</span>
				<span lang="EN-US">T</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开头，否则的话会出现注册控件时候的问题</span>
				<span lang="EN-US">)</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。这里</span>
				<span lang="EN-US">Ancestor type</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代表控件的基类，</span>
				<span lang="EN-US">TURLLabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代表控件的名称。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">2</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、超链接的视觉效果是带下划线的文字，所以我们覆盖父类的构造函数，在构造函数里修改控件的字体属性。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">constructor TUrlLabel.Create(AOwner:TComponent);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">begin</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>inherited Create(AOwner);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Cursor:=crHandPoint;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Font.Style:= [fsUnderline];</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码解释：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 12pt 0cm 0pt 54pt; TEXT-INDENT: -36pt; mso-list: l2 level1 lfo1; tab-stops: list 54.0pt">
				<span lang="EN-US" style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（1）<span style="FONT: 7pt 'Times New Roman'">    </span></span>
				<span lang="EN-US">inherited Create(AOwner);</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这句的意思是执行父类的构造函数。我们制作控件的时候，如果覆盖了父类的构造函数，那么在新的构造函数中一定要首先调用父类的构造函数，否则会引起错误。这是很多初学控件开发的人常常遇到的问题。当您把自己开发的控件从面板上拖放到窗体时，如果跳出一个“</span>
				<span lang="EN-US">Access Violent</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”的错误对话框的话，那么十有八九是因为您忘了调用父类的构造函数。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</span>
				<span lang="EN-US">2</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</span>
				<span lang="EN-US">Cursor:=crHandPoint;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt; TEXT-INDENT: 45pt">
				<span lang="EN-US">Font.Style:= [fsUnderline];<span style="mso-spacerun: yes">  </span></span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt; TEXT-INDENT: 42pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这三句的意思是修改标签的视觉效果。</span>
				<span lang="EN-US">Cursor:=crHandPoint;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是设定当鼠</span>
				<span lang="EN-US">
						<span style="mso-spacerun: yes">        </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标移动到控件上时鼠标的形状为“手型”；</span>
				<span lang="EN-US">Font.Style:= [fsUnderline];<span style="mso-spacerun: yes">  </span></span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是设定文字的下划线效果。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">3</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、既然是超链接控件，那么我们肯定要能使用户在使用控件的时候能在“</span>
				<span lang="EN-US">Object Inspector</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”中对超链接的</span>
				<span lang="EN-US">URL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行修改，所以我们应该为控件增加一个</span>
				<span lang="EN-US">Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">   </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性是访问控件字段的接口。通过属性，控件使用者可以间接读或者写控件的内部字段改变控件的状态。组件属性的声明需要以下几部分：属性名、属性类型、读方法（或读字段）、写方法（或写字段。如果没有写方法或写字段，则该属性为只读属性）。属性在控件类声明的</span>
				<span lang="EN-US">Published</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">部分声明。在</span>
				<span lang="EN-US">Published</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中声明的属性可以在设计期通过“</span>
				<span lang="EN-US">Object Inspector</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”对属性值进行修改。如果声明在</span>
				<span lang="EN-US">Public</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">部分则不可以在设计期通过“</span>
				<span lang="EN-US">Object Inspector</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”对属性值进行修改，但是可以在运行时通过代码进行读写。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes"> </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在类声明的</span>
				<span lang="EN-US">Private</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">访问区域中添加如下字段声明：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>FUrl: String;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在类声明中添加</span>
				<span lang="EN-US">Published</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">访问区域，并添加如下代码</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">property Url: String read FUrl write FUrl;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这段声明的意思是为控件添加一个</span>
				<span lang="EN-US">Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性，属性的类型是</span>
				<span lang="EN-US">string</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，在读</span>
				<span lang="EN-US">Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性时返回</span>
				<span lang="EN-US">Furl</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的值，在写</span>
				<span lang="EN-US"> Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性时设定</span>
				<span lang="EN-US">Furl</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的值。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">4</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、超链接的视觉效果有了，下面使它点击时调用浏览器打开</span>
				<span lang="EN-US">Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定的网址。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Delphi</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件的事件处理中很多事件都有对应的一个调度方法（这是设计模式中模板模式的典型应用）。比如在鼠标点击控件时，控件会首先调用</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，由</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法进行相应的处理，而绝大多数调度方法都会引发一个事件句柄（关于事件句柄我们后边有深入的介绍）。比如</span>
				<span lang="EN-US">Tlabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件中在用户用点击</span>
				<span lang="EN-US">Label</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时会首先调用控件的</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法（被声明为</span>
				<span lang="EN-US">Protected</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级别），</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法再触发</span>
				<span lang="EN-US">OnClick</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件。所以我们只要覆盖</span>
				<span lang="EN-US">Tlabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法进行我们自己的处理就可以了。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Protected</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">部分添加如下的声明：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">procedure Click;override;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>
				</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在实现部分为</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法写如下的代码：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">procedure TUrlLabel.Click;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">begin</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>ShellExecute(Application.Handle, nil, PChar(Url), nil, nil,SW_NORMAL);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>inherited;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">代码解释：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 12pt 0cm 0pt 54pt; TEXT-INDENT: -36pt; mso-list: l0 level1 lfo2; tab-stops: list 54.0pt">
				<span lang="EN-US" style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（1）<span style="FONT: 7pt 'Times New Roman'">    </span></span>
				<span lang="EN-US">ShellExecute</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的作用是用默认的程序打开第三个参数指定的文件。所以当第三个参数为一个</span>
				<span lang="EN-US">URL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，则用浏览器打开这个网址。关于</span>
				<span lang="EN-US">ShellExecute</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其他参数的使用方法可以查阅</span>
				<span lang="EN-US">MSDN</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或其他相关资料。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 12pt 0cm 0pt 54pt; TEXT-INDENT: -36pt; mso-list: l0 level1 lfo2; tab-stops: list 54.0pt">
				<span lang="EN-US" style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（2）<span style="FONT: 7pt 'Times New Roman'">    </span></span>
				<span lang="EN-US">Inherited;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的作用是调用父类的</span>
				<span lang="EN-US">Click</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法来由父类来对鼠标单击事件做其他的处理。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">5</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、源代码。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面给出这个控件的全部源代码：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">unit UrlLabel;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">interface</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">uses</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Windows, Messages, SysUtils, Classes, Controls, StdCtrls,Shellapi,</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Graphics, Forms;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">type</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>TUrlLabel = class(TLabel)</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>private</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>FUrl:AnsiString;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>protected</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>procedure Click;override;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>public</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>constructor Create(AOwner:TComponent);override;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>published</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">    </span>property Url:AnsiString read FUrl write FUrl;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">procedure Register;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">implementation</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">constructor TUrlLabel.Create(AOwner:TComponent);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">begin</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>inherited Create(AOwner);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Cursor:=crHandPoint;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>Font.Style:=[fsUnderline];</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">procedure TUrlLabel.Click;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">begin</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>ShellExecute(Application.Handle, nil, PChar(Url), nil, nil,SW_NORMAL);</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>inherited;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US"> <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">procedure Register;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">begin</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">
						<span style="mso-spacerun: yes">  </span>RegisterComponents('Linco', [TUrlLabel]);//</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件生成向导生成的注册控件用代码</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">end;</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US"> <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">end.</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">6</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、为控件添加图标。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果没有给自定义的控件定义图标，出现在控件面板上的自定义图标的图标是默认的图标，很没有“个性”，也不容易被用户与其他控件区别开来，所以我们需要给组件指定一个图标。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">首先利用</span>
				<span lang="EN-US">Delphi</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US">Image Editor</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">创建一个</span>
				<span lang="EN-US">24*24</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的位图，并把它保存到一个</span>
				<span lang="EN-US">DCR</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件中。创建了一个位图后，就需要给位图命名了。位图的名称必须和控件的类名相同，且为大写，而</span>
				<span lang="EN-US">DCR</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件的名字则必须与控件所在单元的单元名相同。如我们上边定义的控件，位图的名字应该为</span>
				<span lang="EN-US">TURLLABEL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</span>
				<span lang="EN-US">DCR</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件的名字应该是</span>
				<span lang="EN-US">UrlLabel.dcr</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，此</span>
				<span lang="EN-US">DCR</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件应该与组件的单元文件放在同一个目录下。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">打开</span>
				<span lang="EN-US">Image Editor,</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择</span>
				<span lang="EN-US">”File”</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
				<span lang="EN-US">&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“</span>
				<span lang="EN-US">New</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
				<span lang="EN-US">&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“</span>
				<span lang="EN-US">Component Resource File(.dcr)</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”，如下图：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<img height="379" alt="o_2.jpg" src="http://www.blogjava.net/images/blogjava_net/huanzhugege/4053/o_2.jpg" width="553" border="0" />
				<img height="379" alt="o_2.jpg" src="http://www.blogjava.net/images/blogjava_net/huanzhugege/4053/o_2.jpg" width="553" border="0" />
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在“</span>
				<span lang="EN-US">Contents</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”上单击鼠标右键，选择“</span>
				<span lang="EN-US">New</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”－</span>
				<span lang="EN-US">&gt;</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">“</span>
				<span lang="EN-US">BitMap</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”：</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<img height="162" alt="o_3.jpg" src="http://www.blogjava.net/images/blogjava_net/huanzhugege/4053/o_3.jpg" width="306" border="0" />
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Width,Height</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中都填入</span>
				<span lang="EN-US">24</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，点“</span>
				<span lang="EN-US">OK</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”即可。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<img height="379" alt="o_4.jpg" src="http://www.blogjava.net/images/blogjava_net/huanzhugege/4053/o_4.jpg" width="553" border="0" />
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以在</span>
				<span lang="EN-US">Bitmap1</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上点右键选择“</span>
				<span lang="EN-US">Rename</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”为位图重命名为</span>
				<span lang="EN-US">TURLLABEL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，然后双击</span>
				<span lang="EN-US">TURLLABEL</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，就可以像使用“画图”一样为您的控件设计图标了。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span lang="EN-US">7</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、注册组件。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点击</span>
				<span lang="EN-US">Componet</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
				<span lang="EN-US">&gt;Install Componet</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行自定义组件安装，此时将出现组件安装对话框。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
				<span lang="EN-US">Unit FilName </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中输入控件单元文件的文件名（包括路径），点击“</span>
				<span lang="EN-US">OK</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”</span>
				<span lang="EN-US">,</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在弹出的</span>
				<span lang="EN-US">Package Editor </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中按下</span>
				<span lang="EN-US">Install</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮。如果安装成功系统就会提示安装成功。关闭</span>
				<span lang="EN-US">Package Editor</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，会提示您是否保存修改，点击</span>
				<span lang="EN-US">Yes</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">即可。</span>
		</p>
		<p class="MsoNormal" style="MARGIN-TOP: 12pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装成功，建立一个测试程序。将</span>
				<span lang="EN-US">URLLabel</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件放到窗体上，设定</span>
				<span lang="EN-US">Url</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性为</span>
				<span lang="EN-US">http://www.sohu.com </span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">运行程序，点击此</span>
				<span lang="EN-US">Label</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，就会弹出浏览器打开</span>
				<span lang="EN-US">http://www.sohu.com</span>
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个网址。</span>
		</p>
<img src ="http://www.cnitblog.com/yide/aggbug/16380.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-05 15:14 <a href="http://www.cnitblog.com/yide/archive/2006/09/05/16380.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>修改控件圖標</title><link>http://www.cnitblog.com/yide/archive/2006/09/05/16379.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 05 Sep 2006 07:06:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/05/16379.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16379.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/05/16379.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16379.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16379.html</trackback:ping><description><![CDATA[可以在tools/image   editor下实现。 <br /><div class="ReplysRegion" id="ReplysRegion_17032865"><a name="Reply_17032865"><div class="ReplyContext"><br />请问用image   editor   修.res文件中的资源后影响哪个地方？ <br /></div><div class="GoTop"><a title="回到主题" href="http://topic.csdn.net/t/20031117/13/2465113.html#Top"> <br /></a><a name="Reply_17032886">用tool/image   editor   修改   borland目录下的.dcr文件中的bitmap文件即可。 </a></div></a></div><img src ="http://www.cnitblog.com/yide/aggbug/16379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-05 15:06 <a href="http://www.cnitblog.com/yide/archive/2006/09/05/16379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Method</title><link>http://www.cnitblog.com/yide/archive/2006/09/05/16369.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 05 Sep 2006 01:04:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/05/16369.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16369.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/05/16369.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16369.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16369.html</trackback:ping><description><![CDATA[用Delphi做过数据库编程的朋友肯定熟悉Query控件，这个控件实现的功能是执行一条SQL语句或一个SQL脚本，在我们进行数据库开发中使用的频率非常高。笔者在多年的使用过程中发现用好这个控件有两点要非常注意。<br /><br />  第一点是：区分好Query控件的Open方法和ExecSQL方法。这两个方法都可以实现执行SQL语句，但要根据不同情况分别使用。如果这条SQL语句将返回一个结果集，必须使用Open方法，如果不返回一个结果集，则要使用ExecSQL方法。例如：<br /><br />  ……<br /><br />  Query1:Tquery<br /><br />  Query2:Tquery<br /><br />  ……<br /><br />  Query1.Close;<br /><br />  Query1.SQL.Clear;<br /><br />  Query1.SQL.Add('select * from AA');<br /><br />  Query1.Open;<br /><br />  ……<br /><br />  Query2.Close;<br /><br />  Query2.SQL.Clear;<br /><br />  Query2.SQL.Add('delete AA');<br /><br />  Query2.ExecSQL;<br /><br />  ……<br /><br />  上述的例子中，Query1所执行的SQL语句将返回一个结果集，因此必须用Open方法；而Query2所执行的是一条删除表记录语句，不返回结果集，因此用ExecSQL方法。<br /><br />  第二点是：如果Query控件用Open方法执行SQL语句，并且所用的SQL语句访问的是一张或几张频繁使用的表，在执行完SQL语句后，一定要调用SQL的FetchAll方法，能大大地减少死锁发生的概率。例如：<br /><br />  ……<br /><br />  Query1:Tquery<br /><br />  ……<br /><br />  Query1.Close;<br /><br />  Query1.SQL.Clear;<br /><br />  Query1.SQL.Add('select * from AA');<br /><br />  Query1.Open;<br /><br />  Query1.FetchAll;<br /><br />  ……<br /><br />在上述的例子中，如果AA是一张被频繁访问的表，在对这个表执行这一条select语句的同时，如果恰好有其他人对这张表执行删除或更新操作，便有可能发生死锁。Query1.FetchAll这条语句实现的功能是释放加在表AA上的锁，这样死锁的发生概率可以大大减少。避免死锁，对我们将来进行大型数据库开发尤为重要。"<img src ="http://www.cnitblog.com/yide/aggbug/16369.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-05 09:04 <a href="http://www.cnitblog.com/yide/archive/2006/09/05/16369.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>時間差</title><link>http://www.cnitblog.com/yide/archive/2006/09/04/16353.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 04 Sep 2006 07:56:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/09/04/16353.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16353.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/09/04/16353.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16353.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16353.html</trackback:ping><description><![CDATA[
		<br />select a.id , a.key , a.time , a.nt1 , ( TRUNC(( a.nt1  -  a.time  )*24*3600) )  as interval<br />from<br />(<br />      select  t1.id , t1.key , t1.time , <br />        (<br />       select   time <br />           from   table<br />              where    rownum = 1 and key &gt;  t1.key <br />     ) as nt1<br />   <br />     from     table t1<br /> )   a     <img src ="http://www.cnitblog.com/yide/aggbug/16353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-09-04 15:56 <a href="http://www.cnitblog.com/yide/archive/2006/09/04/16353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>木馬</title><link>http://www.cnitblog.com/yide/archive/2006/08/31/16185.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 31 Aug 2006 01:00:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/08/31/16185.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16185.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/08/31/16185.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16185.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16185.html</trackback:ping><description><![CDATA[木马是随计算机或Windows的启动而启动并掌握一定的控制权的，其启动方式可谓多种多样，通过注册表启动、通过System.ini启动、通过某些特定程序启动等，真是防不胜防。其实只要能够遏制住不让它启动，木马就没什么用了，这里就简单说说木马的启动方式，知己知彼百战不殆嘛。 
<p></p><p>　　一、通过"开始\程序\启动" </p><p>　　隐蔽性:2星 </p><p>　　应用程度:较低 </p><p>　　这也是一种很常见的方式，很多正常的程序都用它，大家常用的QQ就是用这种方式实现自启动的，但木马却很少用它。因为启动组的每人会会出现在“系统配置实用程序”(msconfig.exe，以下简称msconfig)中。事实上，出现在“开始”菜单的“程序\启动”中足以引起菜鸟的注意，所以，相信不会有木马用这种启动方式。 </p><p>　　二、通过Win.ini文件 </p><p>　　隐蔽性:3星 </p><p>　　应用程度:较低 </p><p>　　应用案例:Asylum </p><p>　　同启动组一样，这也是从Windows3.2开始就可以使用的方法，是从Win16遗传到Win32的。在Windows3.2中，Win.ini就相当于Windows9x中的注册表，在该文件中的[Windows]域中的load和run项会在Windows启动时运行，这两个项目也会出现在msconfig中。而且，在Windows98安装完成后这两项就会被Windows的程序使用了，也不很适合木马使用。 </p><p>　　三、通过注册表启动 </p><p>　　1、通过HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run， </p><p>　　HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run和 </p><p>　　HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices </p><p>　　隐蔽性:3.5星 </p><p>　　应用程度:极高 </p><p>　　应用案例:BO2000，GOP，NetSpy，IEthief，冰河…… </p><p>　　这是很多Windows程序都采用的方法，也是木马最常用的。使用非常方便，但也容易被人发现，由于其应用太广，所以几乎提到木马，就会让人想到这几个注册表中的主键，通常木马会使用最后一个。使用Windows自带的程序:msconfig或注册表编辑器(regedit.exe，以下简称regedit)都可以将它轻易的删除，所以这种方法并不十分可靠。但可以在木马程序中加一个时间控件，以便实时监视注册表中自身的启动键值是否存在，一旦发现被删除，则立即重新写入，以保证下次Windows启动时自己能被运行。这样木马程序和注册表中的启动键值之间形成了一种互相保护的状态。木马程序未中止，启动键值就无法删除(手工删除后，木马程序又自动添加上了)，相反的，不删除启动键值，下次启动Windows还会启动木马。怎么办呢?其实破解它并不难，即使在没有任何工具软件的情况下也能轻易解除这种互相保护。 </p><p>　　破解方法:首先，以安全模式启动Windows，这时，Windows不会加载注册表中的项目，因此木马不会被启动，相互保护的状况也就不攻自破了;然后，你就可以删除注册表中的键值和相应的木马程序了。 </p><p>　　2、通过HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce， </p><p>　　HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce和 </p><p>　　HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce </p><p>　　隐蔽性:4星 </p><p>　　应用程度:较低 </p><p>　　应用案例:Happy99 </p><p>　　这种方法好像用的人不是很多，但隐蔽性比上一种方法好，它的内容不会出现在msconfig中。在这个键值下的项目和上一种相似，会在Windows启动时启动，但Windows启动后，该键值下的项目会被清空，因而不易被发现，但是只能启动一次，木马如何能发挥效果呢? </p><p>　　其实很简单，不是只能启动一次吗?那木马启动成功后再在这里添加一次不就行了吗?在Delphi中这不过3、5行程序。虽说这些项目不会出现在msconfig中，但是在Regedit中却可以直接将它删除，那么木马也就从此失效了。 </p><p>　　还有一种方法，不是在启动的时候加而是在退出Windows的时候加，这要求木马程序本身要截获WIndows的消息，当发现关闭Windows消息时，暂停关闭过程，添加注册表项目，然后才开始关闭Windows，这样用Regedit也找不到它的踪迹了。这种方法也有个缺点，就是一旦Windows异常中止(对于Windows9x这是经常的)，木马也就失效了。 </p><p>　　破解他们的方法也可以用安全模式。 </p><p>　　另外使用这三个键值并不完全一样，通常木马会选择第一个，因为在第二个键值下的项目会在Windows启动完成前运行，并等待程序结束会才继续启动Windows。 </p><p></p><p>　　四、通过Autoexec.bat文件，或winstart.bat，config.sys文件 </p><p>　　隐蔽性:3.5星 </p><p>　　应用程度:较低 </p><p>　　其实这种方法并不适合木马使用，因为该文件会在Windows启动前运行，这时系统处于DOS环境，只能运行16位应用程序，Windows下的32位程序是不能运行的。因此也就失去了木马的意义。不过，这并不是说它不能用于启动木马。可以想象，SoftIce for Win98(功能强大的程序调试工具，被黑客奉为至宝，常用于破解应用程序)也是先要在Autoexec.bat文件中运行然后才能在Windows中呼叫出窗口，进行调试的，既然如此，谁能保证木马不会这样启动呢?到目前为止，我还没见过这样启动的木马，我想能写这样木马的人一定是高手中的高手了。 </p><p>　　另外，这两个BAT文件常被用于破坏，它们会在这个文件中加入类似"Deltree C:\*.*"和"Format C:/u"的行，这样，在你启动计算机后还未启动Windows，你的C盘已然空空如也。 </p><p>　　五、通过System.ini文件 </p><p>　　隐蔽性:5星 </p><p>　　应用程度:一般 </p><p>　　应用案例:尼姆达 </p><p>　　事实上，System.ini文件并没有给用户可用的启动项目，然而通过它启动却是非常好用的。在System.ini文件的[Boot]域中的Shell项的值正常情况下是"Explorer.exe"，这是Windows的外壳程序，换一个程序就可以彻底改变Windows的面貌(如改为Progman.exe就可以让Win9x变成Windows3.2)。我们可以在"Explorer.exe"后加上木马程序的路径，这样Windows启动后木马也就随之启动，而且即使是安全模式启动也不会跳过这一项，这样木马也就可以保证永远随Windows启动了，名噪一时的尼姆达病毒就是用的这种方法。这时，如果木马程序也具有自动检测添加Shell项的功能的话，那简直是天衣无缝的绝配，我想除了使用查看进程的工具中止木马，再修改Shell项和删除木马文件外是没有破解之法了。但这种方式也有个先天的不足，因为只有Shell这一项嘛，如果有两个木马都使用这种方式实现自启动，那么后来的木马可能会使前一个无法启动，呵呵以毒攻毒啊。 </p><p>　　六、通过某特定程序或文件启动 </p><p>　　1、寄生于特定程序之中 </p><p>　　隐蔽性:5星 </p><p>　　应用程度:一般 </p><p>　　即木马和正常程序捆绑，有点类似于病毒，程序在运行时，木马程序先获得控制权或另开一个线程以监视用户操作，截取密码等，这类木马编写的难度较大，需要了解PE文件结构和Windows的底层知识(直接使用捆绑程序除外)。 </p><p>　　2、将特定的程序改名 </p><p>　　隐蔽性:5星 </p><p>　　应用程度:常见 </p><p>　　这种方式常见于针对QQ的木马，例如将QQ的启动文件QQ2000b.exe，改为QQ2000b.ico.exe(Windows默认是不显示扩展名的，因此它会被显示为QQ2000b.ico，而用户会认为它是一个图标),再将木马程序改为QQ2000b.exe，此后，用户运行QQ，实际是运行了QQ木马，再由QQ木马去启动真正的QQ，这种方式实现起来要比上一种简单的多。 </p><p>　　3、文件关联 </p><p>　　隐蔽性:5星 </p><p>　　应用程度:常见 </p><p>　　应用案例:广外女生 </p><p>　　通常木马程序会将自己和TXT文件或EXE文件关联，这样当你打开一个文本文件或运行一个程序时，木马也就神不知鬼不觉的启动了。 </p><p>　　这类通过特定程序或文件启动的木马，发现比较困难，但查杀并不难。一般地，只要删除相应的文件和注册表键值即可。<br /></p><img src ="http://www.cnitblog.com/yide/aggbug/16185.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-08-31 09:00 <a href="http://www.cnitblog.com/yide/archive/2006/08/31/16185.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Regedit--L1</title><link>http://www.cnitblog.com/yide/archive/2006/08/31/16184.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 31 Aug 2006 00:37:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/08/31/16184.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/16184.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/08/31/16184.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/16184.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/16184.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息。  　　一、创建和释放TRegistry对象  　　1.创建TRegistry对象。为了操作注册表，要创建一个TRegistry对象：ARegistry := TRegistry.Create；  　　2.释放TRegistry对象。对注册表操作结束后，应释放TRegistry对象所占内存：ARegistry.Destr...&nbsp;&nbsp;<a href='http://www.cnitblog.com/yide/archive/2006/08/31/16184.html'>阅读全文</a><img src ="http://www.cnitblog.com/yide/aggbug/16184.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-08-31 08:37 <a href="http://www.cnitblog.com/yide/archive/2006/08/31/16184.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>regedit</title><link>http://www.cnitblog.com/yide/archive/2006/08/25/15918.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Fri, 25 Aug 2006 01:20:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/08/25/15918.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/15918.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/08/25/15918.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/15918.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/15918.html</trackback:ping><description><![CDATA[Delphi的TRegistry注册表类方法详解  <br /><br />●GetDataInfo方法<br />Function GetDataInfo(const ValueName:String;Var Value:TRegDataInfo):Boolean;<br />TregDataType=(rdunknown,rdstring,rdexpandstring,rdexpandstring,rdinterger,rdbinary);<br />TregDataInfo=record<br />　　　Regdata:TRegDataType;数据类型<br />　 dataSize:integer;数据大小<br />end<br />valuename:和当前键关联的数据值名称<br />value：返回数据的信息，如为rdstring和rdexpandstring类型，则数据大小包括字符串未尾的空结束字符。<br />　　如果成功返回True，失败返回False，并且Value的值为zeros<br />rdexpandstring：是一个包含环境变量的字符串;如“%PATH%”。<br /><br />●CreateKey方法<br />Function CreateKey(const Key:string):Boolena;<br />　　新建一个名为Key的键，Key可以为绝对的或相对的名字，绝对名用反斜杠“\”开头，相对名是新建一个当前键的子键。新建没有值。<br />　　成功返回True，否则返回False,如果该键已存在将不产生效果。<br /><br />●DeleteKey方法<br />Function DeleteKey(const Key:string):Boolean;<br />　　删除一个键及相关联的数据，在win95中子键也将被删除，NT中子键必须一个个删除。<br /><br />●DeleteValue方法<br />Function DeleteValue (const Name:string):Boolean;<br />　　删除当前键中指定的一个数据值name。<br /><br />●GetDataSize方法<br />Function GetDataSize(const ValueName:string):integer;<br />　　返回当前键中一个指定数值ValueName数据的大小。<br /><br />●GetDataType方法<br />Function GetDataType(const Valuename;string):TRegDataType;<br />　　返回当前键中一个指定数值Valuename数据的类型。<br /><br />●GetKeyInfo方法<br />Function GetKeyInfo(var value:TRegkeyinfo):Boolean;<br />　　返回当前键的信息，在于value中。<br />TRegkeyinfo=record<br />　 maxsubkeylen:integer;子键名的最长值（字节）<br />　 numvalues:integer;键值的数量<br />　 maxvaluelen;最长的键值名的长度<br />　 Filetime:TFileTime;最后一次更改的时间<br />end;<br /><br />●Getkeynames方法<br />Procedure Getkeynames(strings:Tsrtings);<br />　　返回当前键所有子键的名子列表串。<br /><br />●Getvaluenames<br />Procedure Getvaluenames(strings:Tstrings);<br />　 返回当前键所有键值名的列表串。<br /><br />●Hassubkeys方法<br />Function hassubKeys:Boolean;<br />　　判断当前键是否有子键，有返回True，否则返回False。<br /><br />●keyExists方法<br />Function KeyExists(const Key:string):Boolean;<br />　　判断指定的键是否存在。<br /><br />●LoadKey方法<br />Function LoadKey(const Key,fileNmae:string):Boolean;<br />　在根键下新建<br />　从一个文件中加载注册信息到子键中，文件注册信息中包含数据值名、子键和数据。<br />　　LoadKey使创建一个键单一化，子键，键值和数据在一人操作中完成，所有这些称为一组，和单独地创建它们不同应用程序可以在一个文件中读取一组数据，这在用户运行中重新设置有特别的用处。<br />　Key为要创建子键的名子<br />　FileName：为文件的位置，所指定的文件必须为以前用SaveKey函数或RegSaveKey API函数所建立的，文件名不能包括扩展名。<br /><br />●OpenKey方法<br />Function OpenKey(const Key:string;cancreate:Boolean):Boolean;<br />　　使用该函数可以指定一个键作为当前键，如果键为nil，则当前键 将设置为根键。<br />　　Cancreate决定是否在指定键不存在时创建该键，该函数创建的键的键值将不确定。<br />　　如果成功地打开或创建，该函数返回True。<br /><br />●OpenKeyReadOnly方法<br />function OpenKeyReadOnly(const Key: String): Boolean;<br />　　以只读的方式打开Key值指定的键。<br /><br />●CloseKey方法<br />procedure CloseKey;<br />　 当不再使用一个键时应用该方法关闭该键。<br /><br />●MoveKey方法<br />procedure MoveKey(const OldName, NewName: String; Delete: Boolean);<br />　 该方法移动或复制一个键到一个新的位置，并把键的名子改为NewName。<br />　 在Win95/98下该的子键和数据将被一起移动或复制到新的位置，在NT下子键必须用MoveKey明确的移动或自制。<br /><br />●读取数据的方法<br />function ReadBinaryData(const Name: String; var Buffer; BufSize: Integer):Integer;<br />function ReadBool(const Name: String): Boolean;<br />function ReadCurrency(const Name: String): Currency;<br />function ReadDate(const Name: String): TDateTime;<br />function ReadDateTime(const Name: String): TDateTime;<br />function ReadFloat(const Name: String): Double;<br />function ReadInteger(const Name: String): Integer;<br />function ReadString(const Name: String): String;<br />function ReadTime(const Name: String): TDateTime;<br />　　以上方法从当前主键读取相应数据类型的键值的数据，如果类型不匹配将产生一个异常。<br /><br />●RegistryConnect方法<br />function RegistryConnect(const UNCName: String): Boolean;<br />　与另一台计算机的注册表建立连接，在建立连接前应将Rootkey属性设为HKEY_USERS或HKEY_LOCAL_MACHINE。<br />　UNCName是另一台计算机的名子。格式如：\\computername <br />　假如UNCName为nil，将打开本地计算机。<br /><img src ="http://www.cnitblog.com/yide/aggbug/15918.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-08-25 09:20 <a href="http://www.cnitblog.com/yide/archive/2006/08/25/15918.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Edit Excel 2</title><link>http://www.cnitblog.com/yide/archive/2006/07/04/13207.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Tue, 04 Jul 2006 01:04:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/07/04/13207.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/13207.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/07/04/13207.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/13207.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/13207.html</trackback:ping><description><![CDATA[
		<p>(一) 使用动态创建的方法<br /><br />首先创建 Excel 对象，使用ComObj:<br />var ExcelApp: Variant;<br />ExcelApp := CreateOleObject( 'Excel.Application' );<br /><br />1) 显示当前窗口：<br />ExcelApp.Visible := True;<br /><br />2) 更改 Excel 标题栏：<br />ExcelApp.Caption := '应用程序调用 Microsoft Excel';<br /><br />3) 添加新工作簿：<br />ExcelApp.WorkBooks.Add;<br /><br />4) 打开已存在的工作簿：<br />ExcelApp.WorkBooks.Open( 'C:\Excel\Demo.xls' );<br /><br />5) 设置第2个工作表为活动工作表：<br />ExcelApp.WorkSheets[2].Activate;  <br />或 <br />ExcelApp.WorksSheets[ 'Sheet2' ].Activate;<br /><br />6) 给单元格赋值：<br />ExcelApp.Cells[1,4].Value := '第一行第四列';<br /><br />7) 设置指定列的宽度（单位：字符个数），以第一列为例：<br />ExcelApp.ActiveSheet.Columns[1].ColumnsWidth := 5;<br /><br />8) 设置指定行的高度（单位：磅）（1磅＝0.035厘米），以第二行为例：<br />ExcelApp.ActiveSheet.Rows[2].RowHeight := 1/0.035; // 1厘米<br /><br />9) 在第8行之前插入分页符：<br />ExcelApp.WorkSheets[1].Rows[8].PageBreak := 1;<br /><br />10) 在第8列之前删除分页符：<br />ExcelApp.ActiveSheet.Columns[4].PageBreak := 0;<br /><br />11) 指定边框线宽度：<br />ExcelApp.ActiveSheet.Range[ 'B3:D4' ].Borders[2].Weight := 3;<br />1-左    2-右   3-顶    4-底   5-斜( \ )     6-斜( / )<br /><br />12) 清除第一行第四列单元格公式：<br />ExcelApp.ActiveSheet.Cells[1,4].ClearContents;<br /><br />13) 设置第一行字体属性：<br />ExcelApp.ActiveSheet.Rows[1].Font.Name := '隶书';<br />ExcelApp.ActiveSheet.Rows[1].Font.Color  := clBlue;<br />ExcelApp.ActiveSheet.Rows[1].Font.Bold   := True;<br />ExcelApp.ActiveSheet.Rows[1].Font.UnderLine := True;<br /><br />14) 进行页面设置：<br /><br />a.页眉：<br />    ExcelApp.ActiveSheet.PageSetup.CenterHeader := '报表演示';<br />b.页脚：<br />    ExcelApp.ActiveSheet.PageSetup.CenterFooter := '第&amp;P页';<br />c.页眉到顶端边距2cm：<br />    ExcelApp.ActiveSheet.PageSetup.HeaderMargin := 2/0.035;<br />d.页脚到底端边距3cm：<br />    ExcelApp.ActiveSheet.PageSetup.HeaderMargin := 3/0.035;<br />e.顶边距2cm：<br />    ExcelApp.ActiveSheet.PageSetup.TopMargin := 2/0.035;<br />f.底边距2cm：<br />    ExcelApp.ActiveSheet.PageSetup.BottomMargin := 2/0.035;<br />g.左边距2cm：<br />    ExcelApp.ActiveSheet.PageSetup.LeftMargin := 2/0.035;<br />h.右边距2cm：<br />    ExcelApp.ActiveSheet.PageSetup.RightMargin := 2/0.035;<br />i.页面水平居中：<br />    ExcelApp.ActiveSheet.PageSetup.CenterHorizontally := 2/0.035;<br />j.页面垂直居中：<br />    ExcelApp.ActiveSheet.PageSetup.CenterVertically := 2/0.035;<br />k.打印单元格网线：<br />    ExcelApp.ActiveSheet.PageSetup.PrintGridLines := True;<br /><br />15) 拷贝操作：<br /><br />a.拷贝整个工作表：<br />    ExcelApp.ActiveSheet.Used.Range.Copy;<br />b.拷贝指定区域：<br />    ExcelApp.ActiveSheet.Range[ 'A1:E2' ].Copy;<br />c.从A1位置开始粘贴：<br />    ExcelApp.ActiveSheet.Range.[ 'A1' ].PasteSpecial;<br />d.从文件尾部开始粘贴：<br />    ExcelApp.ActiveSheet.Range.PasteSpecial;<br /><br />16) 插入一行或一列：<br />a. ExcelApp.ActiveSheet.Rows[2].Insert;<br />b. ExcelApp.ActiveSheet.Columns[1].Insert;<br /><br />17) 删除一行或一列：<br />a. ExcelApp.ActiveSheet.Rows[2].Delete;<br />b. ExcelApp.ActiveSheet.Columns[1].Delete;<br /><br />18) 打印预览工作表：<br />ExcelApp.ActiveSheet.PrintPreview;<br /><br />19) 打印输出工作表：<br />ExcelApp.ActiveSheet.PrintOut;<br /><br />20) 工作表保存：<br />if not ExcelApp.ActiveWorkBook.Saved then<br />   ExcelApp.ActiveSheet.PrintPreview;<br /><br />21) 工作表另存为：<br />ExcelApp.SaveAs( 'C:\Excel\Demo1.xls' );<br /><br />22) 放弃存盘：<br />ExcelApp.ActiveWorkBook.Saved := True;<br /><br />23) 关闭工作簿：<br />ExcelApp.WorkBooks.Close;<br /><br />24) 退出 Excel：<br />ExcelApp.Quit;<br /><br />(二) 使用Delphi 控件方法<br />在Form中分别放入ExcelApplication, ExcelWorkbook和ExcelWorksheet。 <br /><br />1）  打开Excel <br />ExcelApplication1.Connect;<br /><br />2) 显示当前窗口：<br />ExcelApplication1.Visible[0]:=True;<br /><br />3) 更改 Excel 标题栏：<br />ExcelApplication1.Caption := '应用程序调用 Microsoft Excel';<br /><br />4) 添加新工作簿：<br />ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));<br /><br />5) 添加新工作表：<br />var Temp_Worksheet: _WorkSheet;<br />begin<br />Temp_Worksheet:=ExcelWorkbook1.<br />WorkSheets.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam,0) as _WorkSheet;<br />ExcelWorkSheet1.ConnectTo(Temp_WorkSheet);<br />End;<br /> <br />6) 打开已存在的工作簿：<br />ExcelApplication1.Workbooks.Open (c:\a.xls<br />EmptyParam,EmptyParam,EmptyParam,EmptyParam,<br />EmptyParam,EmptyParam,EmptyParam,EmptyParam,<br />    EmptyParam,EmptyParam,EmptyParam,EmptyParam,0)<br /><br />7) 设置第2个工作表为活动工作表：<br />ExcelApplication1.WorkSheets[2].Activate;  或<br />ExcelApplication1.WorksSheets[ 'Sheet2' ].Activate;<br /><br />8) 给单元格赋值：<br />ExcelApplication1.Cells[1,4].Value := '第一行第四列';<br /><br />9) 设置指定列的宽度（单位：字符个数），以第一列为例：<br />ExcelApplication1.ActiveSheet.Columns[1].ColumnsWidth := 5;<br /><br />10) 设置指定行的高度（单位：磅）（1磅＝0.035厘米），以第二行为例：<br />ExcelApplication1.ActiveSheet.Rows[2].RowHeight := 1/0.035; // 1厘米<br /><br />11) 在第8行之前插入分页符：<br />ExcelApplication1.WorkSheets[1].Rows[8].PageBreak := 1;<br /><br />12) 在第8列之前删除分页符：<br />ExcelApplication1.ActiveSheet.Columns[4].PageBreak := 0;<br /><br />13) 指定边框线宽度：<br />ExcelApplication1.ActiveSheet.Range[ 'B3:D4' ].Borders[2].Weight := 3;<br />1-左    2-右   3-顶    4-底   5-斜( \ )     6-斜( / )<br /><br />14) 清除第一行第四列单元格公式：<br />ExcelApplication1.ActiveSheet.Cells[1,4].ClearContents;<br /><br />15) 设置第一行字体属性：<br />ExcelApplication1.ActiveSheet.Rows[1].Font.Name := '隶书';<br />ExcelApplication1.ActiveSheet.Rows[1].Font.Color  := clBlue;<br />ExcelApplication1.ActiveSheet.Rows[1].Font.Bold   := True;<br />ExcelApplication1.ActiveSheet.Rows[1].Font.UnderLine := True;<br /><br />16) 进行页面设置：<br /> a.页眉：<br />    ExcelApplication1.ActiveSheet.PageSetup.CenterHeader := '报表演示';<br />b.页脚：<br />    ExcelApplication1.ActiveSheet.PageSetup.CenterFooter := '第&amp;P页';<br />c.页眉到顶端边距2cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.HeaderMargin := 2/0.035;<br />d.页脚到底端边距3cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.HeaderMargin := 3/0.035;<br />e.顶边距2cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.TopMargin := 2/0.035;<br />f.底边距2cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.BottomMargin := 2/0.035;<br />g.左边距2cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.LeftMargin := 2/0.035;<br />h.右边距2cm：<br />    ExcelApplication1.ActiveSheet.PageSetup.RightMargin := 2/0.035;<br />i.页面水平居中：<br />    ExcelApplication1.ActiveSheet.PageSetup.CenterHorizontally := 2/0.035;<br />j.页面垂直居中：<br />    ExcelApplication1.ActiveSheet.PageSetup.CenterVertically := 2/0.035;<br />k.打印单元格网线：<br />    ExcelApplication1.ActiveSheet.PageSetup.PrintGridLines := True;<br /><br />17) 拷贝操作：<br /><br />a.拷贝整个工作表：<br />    ExcelApplication1.ActiveSheet.Used.Range.Copy;<br /><br />b.拷贝指定区域：<br />    ExcelApplication1.ActiveSheet.Range[ 'A1:E2' ].Copy;<br /><br />c.从A1位置开始粘贴：<br />    ExcelApplication1.ActiveSheet.Range.[ 'A1' ].PasteSpecial;<br /><br />d.从文件尾部开始粘贴：<br />    ExcelApplication1.ActiveSheet.Range.PasteSpecial;<br /><br />18) 插入一行或一列：<br />a. ExcelApplication1.ActiveSheet.Rows[2].Insert;<br />b. ExcelApplication1.ActiveSheet.Columns[1].Insert;<br /><br />19) 删除一行或一列：<br />a. ExcelApplication1.ActiveSheet.Rows[2].Delete;<br />b. ExcelApplication1.ActiveSheet.Columns[1].Delete;<br /><br />20) 打印预览工作表：<br />ExcelApplication1.ActiveSheet.PrintPreview;<br /><br />21) 打印输出工作表：<br />ExcelApplication1.ActiveSheet.PrintOut;<br /><br />22) 工作表保存：<br />if not ExcelApplication1.ActiveWorkBook.Saved then<br />   ExcelApplication1.ActiveSheet.PrintPreview;<br /><br />23) 工作表另存为：<br />ExcelApplication1.SaveAs( 'C:\Excel\Demo1.xls' );<br /><br />24) 放弃存盘：<br />ExcelApplication1.ActiveWorkBook.Saved := True;<br /><br />25) 关闭工作簿：<br />ExcelApplication1.WorkBooks.Close;<br /><br />26) 退出 Excel：<br />ExcelApplication1.Quit;<br />ExcelApplication1.Disconnect;<br /><br />(三) 使用Delphi 控制Excle二维图<br />在Form中分别放入ExcelApplication, ExcelWorkbook和ExcelWorksheet<br />var asheet1,achart, range:variant;<br /><br />1）选择当第一个工作薄第一个工作表<br />asheet1:=ExcelApplication1.Workbooks[1].Worksheets[1];<br /><br />2）增加一个二维图<br />achart:=asheet1.chartobjects.add(100,100,200,200);<br /><br />3）选择二维图的形态<br />achart.chart.charttype:=4;<br /><br />4）给二维图赋值<br />series:=achart.chart.seriescollection;<br />range:=sheet1!r2c3:r3c9;<br />series.add(range,true);<br /> <br />5）加上二维图的标题<br />achart.Chart.HasTitle:=True;<br />achart.Chart.ChartTitle.Characters.Text:=’ Excle二维图’          <br /><br />6）改变二维图的标题字体大小<br />achart.Chart.ChartTitle.Font.size:=6;<br /><br />7）给二维图加下标说明<br />achart.Chart.Axes(xlCategory, xlPrimary).HasTitle := True;<br />achart.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text := '下标说明';<br /><br />8）给二维图加左标说明<br />achart.Chart.Axes(xlValue, xlPrimary).HasTitle := True;<br />achart.Chart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text := '左标说明';<br /><br />9）给二维图加右标说明<br />achart.Chart.Axes(xlValue, xlSecondary).HasTitle := True;<br />achart.Chart.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text := '右标说明';<br /><br />10）改变二维图的显示区大小<br />achart.Chart.PlotArea.Left := 5;<br />achart.Chart.PlotArea.Width := 223;<br />achart.Chart.PlotArea.Height := 108;<br /><br />11）给二维图坐标轴加上说明<br />achart.chart.seriescollection[1].NAME:='坐标轴说明';<br /><br />(三) 数据库<br />1.存储过程<br /><br />先执行如下存储过程<br />EXEC sp_addlinkedserver <br />   'ExcelSource',<br />   'Jet 4.0',<br />   'Microsoft.Jet.OLEDB.4.0',<br />   'C:\Documents and Settings\Administrator\桌面\xinxi3.xls',<br />   NULL,<br />   'Excel 5.0'<br /><br />EXEC sp_addlinkedsrvlogin ExcelSource, FALSE, NULL, NULL<br />然后执行下面这个存储过程<br /><br />EXEC sp_tables_ex ExcelSource  //显示几张表<br />这时会返回几个表的名称（个数与excel中sheet的个数一致）<br />然后你用以下语句：<br />select * from ExcelSource...Sheet1$<br />就可以查出来excel中的数据，然后就可以进行倒入的操作了<br />导入完毕记得执行以下两个存储过程：<br />--EXEC sp_droplinkedsrvlogin ExcelSource, NULL<br /><br />--EXEC sp_dropserver ExcelSource<br />以上所有的操作可以先在查询分析器中test一下，然后你可以写存储过程来实现<br /><br />2.ADO<br /><br />procedure TForm1.BitBtn1Click(Sender: TObject);<br />var<br />  a,b,c,FileName,SheetName,SqlStr,ConnStr :string ;<br /><br />begin<br />  FileName :='D:\abc.xls' ;<br />  SheetName :='Sheet1' ;<br />  ADOQuery1.Close ;<br />  ADOQuery1.SQL.Clear ;<br />  ConnStr :='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + FileName + ';Extended Properties=Excel 8.0;Persist Security Info=False';<br />  ADOQuery1.ConnectionString :=ConnStr ;<br />  SqlStr :='Select * from [' + SheetName + '$]' ;<br />  ADOQuery1.SQL.Add(SqlStr) ;<br />  ADOQuery1.Prepared ;<br />  ADOQuery1.Open ;<br />  while not ADOQuery1.Eof do<br />  begin<br />    a :=ADOQuery1.Fields[0].AsString ;<br />    b :=ADOQuery1.Fields[1].AsString ;<br />    c :=ADOQuery1.Fields[2].AsString ;<br />  end ;<br />end; <br /></p>
<img src ="http://www.cnitblog.com/yide/aggbug/13207.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-07-04 09:04 <a href="http://www.cnitblog.com/yide/archive/2006/07/04/13207.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse环境的下载和安装</title><link>http://www.cnitblog.com/yide/archive/2006/06/12/12053.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Mon, 12 Jun 2006 00:54:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/06/12/12053.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/12053.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/06/12/12053.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/12053.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/12053.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt" align="center">
				<font size="3">
						<strong>
								<span lang="EN-US">
										<font face="Times New Roman">Eclipse</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境的下载和安装</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">
								</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<strong>
								<span lang="EN-US">
										<font face="Times New Roman">1</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、安装</span>
								<span lang="EN-US">
										<font face="Times New Roman">jdk</font>
								</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">首先要创建一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">java</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的工作环境，在</span>
						<span lang="EN-US">
								<font face="Times New Roman">sun</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的网站上下载</span>
						<span lang="EN-US">
								<font face="Times New Roman">j2se</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，安装到自己的系统中，我下载的是</span>
						<span lang="EN-US">
								<font face="Times New Roman">1.4</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">版本，安装目录为“</span>
						<span lang="EN-US">
								<font face="Times New Roman">D:\j2sdk<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.4.2</chsdate>_04</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下载地址：</span>
						<span lang="EN-US">
								<font face="Times New Roman">
										<a href="http://java.sun.com/j2se/1.4.2/download.html">http://java.sun.com/j2se/<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.4.2</chsdate>/download.html</a>
								</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">设置环境参数</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">右键“我的电脑”－“属性”－“高级”－“环境变量”</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">增加：</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">java_home</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＝</span>
						<span lang="EN-US">
								<font face="Times New Roman">D:\j2sdk<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.4.2</chsdate>_04\</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">Classpath</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＝</span>
						<span lang="EN-US">
								<font face="Times New Roman">d:\j2sdk<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.4.2</chsdate>_04\;d:\j2sdk1.4.2_04\lib\tools.jar;d:\j2sdk1.4.2_04\lib\dt.jar;d:\j2sdk1.4.2_04\bin</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">Path</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＝</span>
						<span lang="EN-US">
								<font face="Times New Roman">d:\j2sdk<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.4.2</chsdate>_04\bin\</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">环境就设置好了。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">
								</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<strong>
								<span lang="EN-US">
										<font face="Times New Roman">2</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、下载</span>
								<span lang="EN-US">
										<font face="Times New Roman">Eclipse</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">及插件</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以在它的主页下载：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<font face="Times New Roman" size="3">http://www.eclipse.org/downloads/index.php</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img height="600" alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/1.jpg" width="784" /> </font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们除了下载</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse Platform SDK <chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">3.0.1</chsdate></font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">外，还要下载</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse Tools Project</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</span>
						<span lang="EN-US">
								<font face="Times New Roman">EMF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span>
						<span lang="EN-US">
								<font face="Times New Roman">GEF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span>
						<span lang="EN-US">
								<font face="Times New Roman">VE</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，读者可以自己下载别的工具，但是这几个是必下的。</span>
						<span lang="EN-US">
								<font face="Times New Roman">EMF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件为很多其它插件所使用，特别是我们经常用到</span>
						<span lang="EN-US">
								<font face="Times New Roman">Lomboz</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件写</span>
						<span lang="EN-US">
								<font face="Times New Roman">J2EE</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，</span>
						<span lang="EN-US">
								<font face="Times New Roman">J2EE</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境在以后介绍。</span>
						<span lang="EN-US">
								<font face="Times New Roman">GEF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是为</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供一个图形编辑的框架，而</span>
						<span lang="EN-US">
								<font face="Times New Roman">VE</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则提供了图形化编程的环境。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">下载可得到了几个压缩包。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<strong>
								<span lang="EN-US">
										<font face="Times New Roman">3</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、安装</span>
								<span lang="EN-US">
										<font face="Times New Roman">Eclipse</font>
								</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将下载的</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的压缩包解压，解压后即可使用。但是前提是之前</span>
						<span lang="EN-US">
								<font face="Times New Roman">jdk</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境已经设置好。（见上文）</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我将它解压至</span>
						<span lang="EN-US">
								<font face="Times New Roman">e:\eclipse</font>
						</span>
				</font>
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3"> <img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/2.jpg" /></font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后双击</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图标即可运行，界面如下：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/3.jpg" />
								</font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">是不是很漂亮啊。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点开</span>
						<span lang="EN-US">
								<font face="Times New Roman">window</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
						<span lang="EN-US">
								<font face="Times New Roman">preferences</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，设置如图，设置好后点</span>
						<span lang="EN-US">
								<font face="Times New Roman">Apply</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，即可。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/4.jpg" />
								</font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">这样就好。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">我们来使用它编第一个程序。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">java</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">再新建一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">Class，如下</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3"> <img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/a.jpg" /></font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点击</span>
						<span lang="EN-US">
								<font face="Times New Roman">Finish</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完成。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">然后添加代码：</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/b.jpg" /> </font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后点击</span>
						<span lang="EN-US">
								<font face="Times New Roman">Run</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
						<span lang="EN-US">
								<font face="Times New Roman">Run as…</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
						<span lang="EN-US">
								<font face="Times New Roman">2.Java Aplication</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可看到结果：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/c.jpg" />
								</font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US">
								<font face="Times New Roman">
								</font>
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<strong>
								<span lang="EN-US">
										<font face="Times New Roman">4</font>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、安装插件</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这里以</span>
						<span lang="EN-US">
								<font face="Times New Roman">GEF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">插件为例子。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</span>
						<span lang="EN-US">
								<font face="Times New Roman">GEF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的压缩包解压，可得到</span>
						<span lang="EN-US">
								<font face="Times New Roman">features</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
						<span lang="EN-US">
								<font face="Times New Roman">plugins</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件夹。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
								<strong>第一种安装方法</strong>，是将这两个文件夹的内容直接拷贝到</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装文件夹的相关目录下，然后再删除</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装目录下的</span>
						<span lang="EN-US">
								<font face="Times New Roman">configuration</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</span>
						<span lang="EN-US">
								<font face="Times New Roman">org.eclipse.update</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，即可。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">但是这种安装方法不便于管理，安装的插件多了不便维护，所以我们通常采用第二种安装方法。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
								<strong>第二种安装的方法</strong>，</span>
						<span lang="EN-US">
								<font face="Times New Roman">Link</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方法。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</span>
						<span lang="EN-US">
								<font face="Times New Roman">GEF</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">压缩包解压在自己定义的一个目录里，我解压到</span>
						<span lang="EN-US">
								<font face="Times New Roman">e:\plugins\gef</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，在</span>
						<span lang="EN-US">
								<font face="Times New Roman">gef</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录中建立一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，然后将</span>
						<span lang="EN-US">
								<font face="Times New Roman">features</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
						<span lang="EN-US">
								<font face="Times New Roman">plugins</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录拷贝到这个</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录中。因为在</span>
						<span lang="EN-US">
								<font face="Times New Roman">link</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的时候，</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">会寻找解压目录中的</span>
						<span lang="EN-US">
								<font face="Times New Roman">eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，然后在该目录中读取</span>
						<span lang="EN-US">
								<font face="Times New Roman">features</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
						<span lang="EN-US">
								<font face="Times New Roman">plugins</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录。如图：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/5.jpg" />
								</font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后删去</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装目录下的</span>
						<span lang="EN-US">
								<font face="Times New Roman">configuration</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，建立</span>
						<span lang="EN-US">
								<font face="Times New Roman">links</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录，在</span>
						<span lang="EN-US">
								<font face="Times New Roman">links</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录中建立</span>
						<span lang="EN-US">
								<font face="Times New Roman">gef.link</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件，在文件中指出</span>
						<span lang="EN-US">
								<font face="Times New Roman">gef</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">解压的目录，如图：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/6.jpg" /> </font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意，</span>
						<span lang="EN-US">
								<font face="Times New Roman">gef.link</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件的文件名可以任意取，便于自己维护为好。文件中使用的是“</span>
						<span lang="EN-US">
								<font face="Times New Roman">/</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”或者“</span>
						<span lang="EN-US">
								<font face="Times New Roman">\\</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这样，</span>
						<span lang="EN-US">
								<font face="Times New Roman">gef</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就安装好了。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用同样的方法可以安装</span>
						<span lang="EN-US">
								<font face="Times New Roman">emf</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
						<span lang="EN-US">
								<font face="Times New Roman">ve</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，装好后再次启动</span>
						<span lang="EN-US">
								<font face="Times New Roman">Eclipse</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，点击</span>
						<span lang="EN-US">
								<font face="Times New Roman">File</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
						<span lang="EN-US">
								<font face="Times New Roman">New</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span>
						<span lang="EN-US">
								<font face="Times New Roman">Others…</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，看到比以前没装插件多了些东西吧。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3"> <img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/7.jpg" /></font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">java</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3"> <img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/8.jpg" /></font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">再建一个</span>
						<span lang="EN-US">
								<font face="Times New Roman">Visual Class</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/9.jpg" />
								</font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
								</span>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点击finish，可以看到：</span>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<p>
								<font face="Times New Roman" size="3">
										<img alt="" src="http://dev.csdn.net/images/blog_csdn_net/ogogohg/10.jpg" /> </font>
						</p>
				</span>
		</p>
		<p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="3">是不是很棒？</font>
				</span>
		</p>
<img src ="http://www.cnitblog.com/yide/aggbug/12053.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-06-12 08:54 <a href="http://www.cnitblog.com/yide/archive/2006/06/12/12053.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IniFile</title><link>http://www.cnitblog.com/yide/archive/2006/06/01/11413.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 01 Jun 2006 08:56:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/06/01/11413.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/11413.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/06/01/11413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/11413.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/11413.html</trackback:ping><description><![CDATA[
		<p>{ <br />   <br />  [Section_Name] <br />  Key_Name1=Value1 <br />  Key_Name2=Value2 <br />   <br />} </p>
		<p>uses <br />  IniFiles; </p>
		<p>// Write values to a INI file </p>
		<p>procedure TForm1.Button1Click(Sender: TObject); <br />var <br />  ini: TIniFile; <br />begin <br />  // Create INI Object and open or create file test.ini <br />  ini := TIniFile.Create('c:\MyIni.ini'); <br />  try <br />    // Write a string value to the INI file. <br />    ini.WriteString('Section_Name', 'Key_Name', 'String Value'); <br />    // Write a integer value to the INI file. <br />    ini.WriteInteger('Section_Name', 'Key_Name', 2002); <br />    // Write a boolean value to the INI file. <br />    ini.WriteBool('Section_Name', 'Key_Name', True); <br />  finally <br />    ini.Free; <br />  end; <br />end; </p>
		<p>
				<br />// Read values from an INI file </p>
		<p>procedure TForm1.Button2Click(Sender: TObject); <br />var <br />  ini: TIniFile; <br />  res: string; <br />begin <br />  // Create INI Object and open or create file test.ini <br />  ini := TIniFile.Create('c:\MyIni.ini'); <br />  try <br />    res := ini.ReadString('Section_Name', 'Key_Name', 'default value'); <br />    MessageDlg('Value of Section:  ' + res, mtInformation, [mbOK], 0); <br />  finally <br />    ini.Free; <br />  end; <br />end; </p>
		<p>// Read all sections </p>
		<p>procedure TForm1.Button3Click(Sender: TObject); <br />var  <br />  ini: TIniFile; <br />begin <br />  ListBox1.Clear; <br />  ini := TIniFile.Create('MyIni.ini'); <br />  try <br />    ini.ReadSections(listBox1.Items); <br />  finally  <br />    ini.Free;  <br />  end; <br />end; </p>
		<p>// Read a section </p>
		<p>procedure TForm1.Button4Click(Sender: TObject); <br />var  <br />  ini: TIniFile; <br />begin <br />  ini: = TIniFile.Create('WIN.INI'); <br />  try <br />    ini.ReadSection('Desktop', ListBox1.Items); <br />  finally <br />    ini.Free; <br />  end; <br />end; </p>
		<p>
				<br />// Read section values </p>
		<p>procedure TForm1.Button5Click(Sender: TObject); <br />var <br />  ini: TIniFile; <br />begin <br />  ini := TIniFile.Create('WIN.INI'); <br />  try <br />    ini.ReadSectionValues('Desktop', ListBox1.Items); <br />  finally  <br />    ini.Free;   <br />  end; <br />end; </p>
		<p>// Erase a section </p>
		<p>procedure TForm1.Button6Click(Sender: TObject); <br />var  <br />  ini: TIniFile; <br />begin <br />  ini := TIniFile.Create('MyIni.ini'); <br />  try <br />    ini.EraseSection('My_Section'); <br />  finally <br />    ini.Free; <br />  end; <br />end;<br /><br />*****************************************************************8<br /><br />谢谢楼上各位的回答。但我想大家可能理会错我的意思了。我的意思是：<br />假如我有一个文件Myini.ini，内容如下：<br />[AAA]<br />Test1=Test<br />Test2=Test<br />[BBB]<br />Test1=Test<br />Test2=Test<br />[CCC]<br />...=...<br />...</p>
		<p>我想得到所有的小节的名称，即AAA、BBB和CCC，改怎么做呢？<br /><br />************************************************************************<br /><br />这么做：<br />1、声明一个var ini_file:TIniFile; sectionlist:Tstringlist;<br />2、创建  ini_file:=TIniFile.Create('这里是文件路径');<br />         sectionlist:=Tstringlist.create;  //存放所有section的name<br />3、ini_file.ReadSections(sectionlist);<br />至此，sectionlist这个list里面就是你要的section name了<br /><br />***************************************************************<br /><br />100、如何操作INI文件？   <br />INI 文件在系统配置及应用程序参数保存与设置方面，具有很重要的作用，所以可视化的编程一族，如 VB、VC、VFP、Delphi 等都提供了读写 INI 文件的方法，其中Delphi中操作 INI 文件，最为简洁，这是因为Delphi3提供了一个 TInifile 类，使我们可以非常灵活的处理 INI 文件。 </p>
		<p>一、有必要了解 INI 文件的结构：<br />;注释 <br />[小节名] <br />关键字=值<br />...<br />INI文件允许有多个小节，每个小节又允许有多个关键字，“=”后面是该关键字的值。 <br />值的类型有三种：字符串、整型数值和布尔值。其中字符串存贮在INI文件中时没有引号，布尔真值用1表示，布尔假值用0表示。<br />注释以分号“;”开头。</p>
		<p>二、定义 <br />1、在Interface的Uses节增加IniFiles；<br />2、在Var变量定义部分增加一行：<br />myinifile:Tinifile; <br />然后，就可以对变量myinifile进行创建、打开、读取、写入等操作了。 </p>
		<p>三、打开INI文件<br />myinifile:=Tinifile.create('program.ini');<br />上面这一行语句将会为变量myinifile与具体的文件program.ini建立联系，然后，就可以通过变量myinifile，来读写program.ini文件中的关键字的值了。 </p>
		<p>值得注意的是，如果括号中的文件名没有指明路径的话，那么这个Program.ini文件会存储在Windows目录中 </p>
		<p>把Program.ini文件存储在应用程序当前目录中的方法是：为其指定完整的路径及文件名。下面的两条语句可以完成这个功能：<br />Filename:=ExtractFilePath(Paramstr (0))+'program.ini'; myinifile:=Tinifile.Create(filename); </p>
		<p>四、读取关键字的值<br />针对INI文件支持的字符串、整型数值、布尔值三种数据类型，TINIfiles类提供了三种不同的对象方法来读取INI文件中关键字的值。 </p>
		<p>假设已定义变量vs、vi、vb分别为string、integer、boolean类型。<br />vs:=myinifile.Readstring ('小节名','关键字',缺省值); <br />vi:=myinifile.Readinteger ('小节名','关键字',缺省值);<br />vb:=myinifile.Readbool ('小节名','关键字',缺省值); <br />其中缺省值为该INI文件不存在该关键字时返回的缺省值。 </p>
		<p>五、写入INI文件<br />同样的，TInifile类也提供了三种不同的对象方法，向INI文件写入字符串、整型数及布尔类型的关键字。 <br />myinifile.writestring('小节名','关键字',变量或字符串值); <br />myinifile.writeinteger('小节名','关键字',变量或整型数值); <br />myinifile.writebool('小节名','关键字',变量或True或False); <br />当这个INI文件不存在时，上面的语句还会自动创建该INI文件。 </p>
		<p>六、删除关键字 <br />除了可用写入方法增加一个关键字，Tinifile类还提供了一个删除关键字的对象方法： <br />myinifile.DeleteKey('小节名','关键字'); </p>
		<p>七、小节操作 <br />增加一个小节可用写入的方法来完成，删除一个小节可用下面的对象方法： <br />myinifile.EraseSection('小节名'); <br />另外Tinifile类还提供了三种对象方法来对小节进行操作： <br />myinifile.readsection('小节名' TStrings变量);可将指定小节中的所有关键字名读取至一个字符串列表变量中；<br />myinifile.readsections(TStrings变量);可将INI文件中所有小节名读取至一个字符串列表变量中去。<br />myinifile.readsectionvalues('小节名',TStrings变量);可将INI文件中指定小节的所有行（包括关键字、=、值）读取至一个字符串列表变量中去。</p>
		<p>八、释放 <br />在适当的位置用下面的语句释放myinifile： <br />myinifile.distory; </p>
		<p>九、一个实例 </p>
		<p>下面用一个简单的例子(如图)，演示了建立、读取、存贮INI文件的方法。myini.ini文件中包含有“程序参数”小节，和用户名称（字符串）、是否正式用户（布尔值）和已运行时间（整型值）三个关键字。程序在窗体建立读取这些数据，并在窗体释放时写myini.ini文件。 </p>
		<p>附源程序清单 </p>
		<p>unit Unit1; <br />interface </p>
		<p>uses <br />Windows,Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, inifiles, StdCtrls, ExtCtrls; </p>
		<p>type <br />TForm1=class(TForm) <br />Edit1:TEdit; <br />CheckBox1:TCheckBox; <br />Edit2:TEdit; <br />Label1:TLabel; <br />Label2:TLabel; <br />Timer1:TTimer; <br />Label3:TLabel; <br />procedureFormCreate(Sender:TObject); <br />procedureFormDestroy(Sender:TObject); <br />procedureTimer1Timer(Sender:TObject); </p>
		<p>private <br />{Privatedeclarations} <br />public <br />{Publicdeclarations} <br />end; </p>
		<p>var <br />Form1:TForm1; </p>
		<p>implementation <br />var <br />myinifile:TInifile;<br /> <br />{$R*.DFM} </p>
		<p>procedureTForm1.FormCreate(Sender:TObject); <br />var <br />filename:string; <br />begin <br />filename:=ExtractFilePath(paramstr(0))+'myini.ini'; <br />myinifile:=TInifile.Create(filename); <br />edit1.Text:=myinifile.readstring ('程序参数','用户名称','缺省的用户名称'); <br />edit2.text:=inttostr(myinifile.readinteger('程序参数','已运行时间',0));<br />checkbox1.Checked:=myinifile.readbool ('程序参数','是否正式用户',False);<br />end; </p>
		<p>procedureTForm1.FormDestroy(Sender:TObject); <br />begin <br />myinifile.writestring('程序参数','用户名称',edit1.Text); <br />myinifile.writeinteger('程序参数','已运行时间',strtoint(edit2.text)); <br />myinifile.writebool('程序参数','是否正式用户',checkbox1.Checked); <br />myinifile.Destroy; <br />end; </p>
		<p>procedureTForm1.Timer1Timer(Sender:TObject); <br />begin <br />edit2.Text:=inttostr(strtoint(edit2.text)+1); <br />end; <br />end. </p>
		<p>**************************************************************8<br />看看我的笨方法：</p>
		<p>var<br />  slTemp:TStringList;<br />  iCount:Integer;<br />  sList:Array of String;<br />  sTemp:String;<br />begin<br />  slTemp:=TStringList.Create;<br />  slTemp.LoadFromFile('abc.ini');<br />  SetLength(sList,0);<br />  for iCount:=0 to slTemp.Count-1 do<br />  begin<br />    if (LeftStr(slTemp.Strings[iCount]&lt;&gt;'[') and (RightStr(slTemp.Strings[iCont]&lt;&gt;']') then Continue;<br />    SetLength(sList,Length(sList)+1);<br />    sList[High(sList)]:=slTemp.Strings[iCount];<br />  end;<br />end;<br /><br /><br />**************************<br /><br /><br /><br /></p>
<img src ="http://www.cnitblog.com/yide/aggbug/11413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-06-01 16:56 <a href="http://www.cnitblog.com/yide/archive/2006/06/01/11413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>delphi----IniFile</title><link>http://www.cnitblog.com/yide/archive/2006/06/01/11411.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 01 Jun 2006 08:47:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/06/01/11411.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/11411.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/06/01/11411.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/11411.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/11411.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在				Windows				中的应用程序极大多数拥有自己的初始化文件，如				PowerBuilder、Office及Cstar等。因此				初始化文件的读写是每个高级程序员必须掌握的技术。虽然初始化文件的读写也可用				Object Pascal				中的文本文件一样读写，但因初始化文件不同于一般的文本文件，它有自己固定的格式（见下面的初始化文件是				...&nbsp;&nbsp;<a href='http://www.cnitblog.com/yide/archive/2006/06/01/11411.html'>阅读全文</a><img src ="http://www.cnitblog.com/yide/aggbug/11411.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-06-01 16:47 <a href="http://www.cnitblog.com/yide/archive/2006/06/01/11411.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Edit File -- delhpi</title><link>http://www.cnitblog.com/yide/archive/2006/06/01/11377.html</link><dc:creator>青蛙學堂</dc:creator><author>青蛙學堂</author><pubDate>Thu, 01 Jun 2006 03:58:00 GMT</pubDate><guid>http://www.cnitblog.com/yide/archive/2006/06/01/11377.html</guid><wfw:comment>http://www.cnitblog.com/yide/comments/11377.html</wfw:comment><comments>http://www.cnitblog.com/yide/archive/2006/06/01/11377.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/yide/comments/commentRss/11377.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/yide/services/trackbacks/11377.html</trackback:ping><description><![CDATA[
		<div class="content" id="BodyLabel" style="PADDING-RIGHT: 10px; DISPLAY: block; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">1.AssignFile 过程<br />关联一个外部文件名到一个文件变量上。 
<p>单元<br />System</p><p>语法<br />procedure AssignFile(var F; FileName: string);</p><p>描述<br />调用AssignFile来初始化Delphi代码中的文件变量。F是一个任何文件类型的文件变量。FileName是一个字符串类型的表达式，或者，如果扩展的语法激活的话，是PChar类型的表达式。<br />调用AssignFile之后，F就和外部文件关联起来直到F被关闭。所有在文件变量F上的更多的操作都会操作在名为Filename的外部文件上。<br />当FileName参数为空时，AssignFile会将F和标准输入或标准输出文件关联起来。如果赋予一个空名字，在调用了Reset(F)之后，F将引用标准输入文件，而在调用了Rewrite(F)之后，F将引用标准输出文件。<br />不要在已经打开的文件变量上使用AssignFile。<br />注意：为了避免范围冲突，AssignFile 代替了在早期版本的Delphi产品中可用的Assign过程。然而为了向后兼容Assign仍然是可用的。<br />示例<br />var <br />F: TextFile;<br />S: string;<br />begin<br />if OpenDialog1.Execute then { Display Open dialog box }<br />begin<br />AssignFile(F, OpenDialog1.FileName); { File selected in dialog }<br />Reset(F);<br />Readln(F, S); { Read first line of file }<br />Edit1.Text := S; { Put string in a TEdit control }<br />CloseFile(F);<br />end;<br />end;</p><p>2.ChDir 过程<br />改变当前目录</p><p>单元<br />System</p><p>语法<br />procedure ChDir(const S: string); overload;<br />procedure ChDir(P: PChar); overload;</p><p>描述<br />ChDir 会将当前目录改变为由S或P指定的路径。如果这个操作失败，异常EInOutError将会引发。<br />在Windows上，路径可以包含驱动器指示符(drive specifier)，而这将导致当前的驱动盘同时改变。<br />注意：在Delphi中，{$I+} 使用异常来处理运行时错误。当使用{$I-}时，要使用IOResult来检查I/O错误。<br />示例<br />begin<br />{$I-}<br />{ Change to directory specified in Edit1 }<br />ChDir(Edit1.Text);<br />if IOResult &lt;&gt; 0 then<br />MessageDlg('Cannot find directory', mtWarning, [mbOk], 0);<br />end;</p><p>3.CloseFile 过程<br />终止文件变量和外部磁盘文件之间的关联</p><p>单元<br />System</p><p>语法<br />procedure CloseFile(var F);</p><p>描述<br />由于命名冲突，CloseFile代替了Close过程。使用CloseFile过程而不是Close来终止文件变量和外部磁盘文件之间的关联。<br />F是一个使用Reset，Rewrite或Append打开的任何文件类型的文件变量。和F关联的外部文件会完全地更新然后关闭并释放文件句柄便于重用。<br />注意：{$I+} 使用异常来处理运行时错误。当使用{$I-}时，要使用IOResult检查I/O 错误。</p><p>4.CreateDir 函数<br />创建一个新目录<br />单元 <br />SysUtils<br />语法<br />function CreateDir(const Dir: string): Boolean;<br />描述<br />CreateDir 创建一个新目录。如果新目录成功创建，则返回值为true，或者如果出现错误则返回值为false。<br />示例<br />下面的例子会创建目录'C:\temp'，如果目录不存在的话。</p><p>uses FileCtrl;</p><p>procedure TForm1.Button1Click(Sender: TObject);<br />begin<br />if not DirectoryExists('c:\temp') then<br />if not CreateDir('C:\temp') then<br />raise Exception.Create('Cannot create c:\temp');<br />end;</p><p>5.DeleteFile 函数<br />从删除一个磁盘文件<br />单元<br />SysUtils<br />语法<br />function DeleteFile(const FileName: string): Boolean;<br />描述<br />DeleteFile 删除磁盘上由 FileName 命名的文件。如果文件不能被删除或者文件不存在，函数将返回false。<br />示例<br /><br />if FileExists(FileName) then<br />if MessageDlg('Do you really want to delete ' + ExtractFileName(FileName) + '?'), mtConfirmation, [mbYes, mbNo], 0, mbNo) = IDYes then <br />DeleteFile(FileName);</p><p>6.DirectoryExists 函数<br />确定指定的目录是否存在<br />单元<br />SysUtils<br />语法<br />function DirectoryExists(const Directory: string): Boolean;<br />描述<br />调用 DirectoryExists 来确定由Directory参数指定的目录是否存在。如果目录存在，函数返回true。如果目录不存在，函数返回false。<br />如果输入的是全称路径名(full path name)，DirectoryExists 会沿着指定的路径查找目录。否则Directory参数会被认为是当前目录的相对路径。<br />FileCtrl 单元(仅用于Windows) 同样包含一个 DirectoryExists 函数。然而，FileCtrl 版本是不赞成的，SysUtils 版本是首选的，即使代码不需要跨平台(However, the FileCtrl version is deprecated, and the SysUtils version preferred, even if the code does not need to be cross-platform)。</p><p>7.DiskFree 函数<br />返回指定盘符上空闲的字节数<br />单元<br />SysUtils<br />语法<br />function DiskFree(Drive: Byte): Int64;<br />描述<br />DiskFree 返回指定驱动盘()的空闲字节数，其中 0 = 当前盘， 1 = A， 2 = B，等等。如果驱动盘数字无效，DiskFree 返回-1。<br />注意：DiskFree 仅在Windows上可用。<br />示例<br />var<br />S: string;<br />AmtFree: Int64;<br />Total: Int64;<br />begin<br />AmtFree := DiskFree(0);<br />Total := DiskSize(0);<br />S := IntToStr(AmtFree div Total) + 'percent of the space on drive 0 is free: ' (AmtFree div 1024) + ' Kbytes free. ';<br />Label1.Caption := S;<br />end;</p><p>8.DiskSize 函数<br />返回指定盘符的字节大小<br />单元<br />SysUtils<br />语法<br />function DiskSize(Drive: Byte): Int64;<br />描述<br />DiskSize 返回指定驱动盘的字节大小，其中 0 = 当前盘，1 = A， 2 = B， 等等。如果驱动盘数字无效，DiskSize返回-1。<br />注意：DiskSize 仅在Windows上可用。</p><p>9.文件模式常量(File mode constants)<br />文件模式常量用于打开和关闭磁盘文件<br />单元<br />System<br />语法<br />const fmClosed = $D7B0; // closed file<br />const fmInput = $D7B1; // reset file (TTextRec)<br />const fmOutput = $D7B2; // rewritten file (TTextRec)<br />const fmInOut = $D7B3; // reset or rewritten file (TFileRec)<br />const fmCRLF = $8 // DOS-style EoL and EoF markers (TTextRec)<br />const fmMask = $D7B3; // mask out fmCRLF flag (TTextRec)<br />描述 当打开和关闭磁盘文件时，使用文件模式常量。这些常量主要用在这样的Delphi代码中，TFileRec和TTextRec的Mode字段包含这些值中的某个值(These constants are used primarily in Delphi code, where the Mode field of TFileRec and TTextRec contain one of these values.)。</p><p>10.文件名称常量(File name constants) <br />文件名称常量用于以平台中立的方式表达文件名称。<br />单元<br />SysUtils<br />语法<br />const<br />PathDelim = {$IFDEF MSWINDOWS} '\'; {$ELSE} '/'; {$ENDIF}<br />DriveDelim = {$IFDEF MSWINDOWS} ':'; {$ELSE} ''; {$ENDIF}<br />PathSep = {$IFDEF MSWINDOWS} ';'; {$ELSE} ':'; {$ENDIF}<br />描述<br />文件名称常量指定了在Windows和Linux中不同的的定界符和分隔符(delimiter and separator)。</p><p>11.文件打开模式常量(File open mode constants) <br />打开打开模式常量用于控制对文件或流的访问模式。<br />单元<br />SysUtils<br />语法<br />On Windows:<br />const<br />fmCreate = $FFFF;<br />fmOpenRead = $0000;<br />fmOpenWrite = $0001;<br />fmOpenReadWrite = $0002;</p><p>fmShareCompat = $0000 platform;<br />fmShareExclusive = $0010;<br />fmShareDenyWrite = $0020;<br />fmShareDenyRead = $0030 platform;<br />fmShareDenyNone = $0040;</p><p>On Linux:<br />const<br />fmOpenRead = O_RDONLY;<br />fmOpenWrite = O_WRONLY;<br />fmOpenReadWrite = O_RDWR;<br />fmShareExclusive = $0010;<br />fmShareDenyWrite = $0020;<br />fmShareDenyNone = $0030;</p><p>描述<br />当文件或流被打开时，文件打开模式常量用于控制文件或流能够如何共享。<br />TFileStream构造函数有一个Mode参数，你能够设置为这些常量中的一个：<br />Constant Definition</p><p>fmCreate 如果文件存在，那么将打开用于写访问，否则会创建新文件。其他的常量都声明在 SysUtils 单元，而这个常量声明在 Classes 单元中<br />fmOpenRead 仅以读访问方式打开<br />fmOpenWrite 仅以写访问方式打开<br />fmOpenReadWrite 以读写访问方式打开<br />fmShareCompat 和FCB打开的方法兼容。不要在跨平台应用程序中使用这个模式<br />fmShareExclusive 读写访问被拒绝<br />fmShareDenyWrite 写访问被拒绝<br />fmShareDenyRead 读访问被拒绝。不要在跨平台应用程序中使用这个模式<br />fmShareDenyNone 允许其他代码进行完全的访问</p><p>12.FileAccessRights 变量 <br />当应用程序被调用时指向特殊的命令行参数。<br />单元<br />System<br />语法<br />var FileAccessRights: Integer platform;<br />描述<br />在 Windows 中，FileAccessRights 变量被忽略。<br />在 Linux 中，每个文件都有一组许可位(permission bits)控制着对文件的访问。当创建新文件时，FileAccessRights 指定了一组默认的许可标记来使用。当你没有显式指定要使用的许可位时，FileCreate 方法使用 FileAccessRights 来设置它创建的文件的访问权力。<br />13.FileAge 函数 <br />返回文件的OS时间戳(Returns the OS timestamp of a file.)<br />单元<br />SysUtils<br />语法<br />function FileAge(const FileName: string): Integer;<br />描述<br />调用 FileAge 来获得由 FileNameto 指定的文件的 OS 时间戳。返回值可以使用 FileDateToDateTime函数转换为TDateTime对象。如果文件不存在返回值为 -1。<br />在Linux中，-1 是一个有效的时间戳。可使用 FileExists 核实文件不存在。<br />示例<br />下面的代码将一个文件的属性读入一组变量中，并在文件属性对话框中设置检查框以表现当前的属性，然后执行对话框。如果用户改变并接受对话框的设置，代码将设置文件属性以匹配改变的设置：<br />procedure TFMForm.Properties1Click(Sender: TObject);<br />var<br />Attributes, NewAttributes: Word;<br />begin<br />with FileAttrForm do<br />begin<br />FileDirName.Caption := FileList.Items[FileList.ItemIndex];<br />{ set box caption }<br />PathName.Caption := FileList.Directory;<br />{ show directory name }<br />ChangeDate.Caption := <br />DateTimeToStr(FileDateToDateTime(FileAge(FileList.FileName)));<br />Attributes := FileGetAttr(FileDirName.Caption);<br />{ read file attributes }<br />ReadOnly.Checked := (Attributes and SysUtils.faReadOnly) = faReadOnly;<br />Archive.Checked := (Attributes and faArchive) = faArchive;<br />System.Checked := (Attributes and faSysFile) = faSysFile;<br />Hidden.Checked := (Attributes and faHidden) = faHidden;<br />if ShowModal &lt;&gt; id_Cancel then { execute dialog box }<br />begin<br />NewAttributes := Attributes;<br />{ start with original attributes }<br />if ReadOnly.Checked then<br />NewAttributes := NewAttributes or SysUtils.faReadOnly<br />else <br />NewAttributes := NewAttributes and not SysUtils.faReadOnly;<br />if Archive.Checked then<br />NewAttributes := NewAttributes or faArchive<br />else <br />NewAttributes := NewAttributes and not faArchive;<br />if System.Checked then <br />NewAttributes := NewAttributes or faSysFile<br />else <br />NewAttributes := NewAttributes and not faSysFile;<br />if Hidden.Checked then <br />NewAttributes := NewAttributes or faHidden<br />else <br />NewAttributes := NewAttributes and not faHidden;<br />if NewAttributes &lt;&gt; Attributes then { if anything changed... }<br />FileSetAttr(FileDirName.Caption, NewAttributes);<br />{ ...write the new values }<br />end;<br />end;<br />end;<br /><br />14.FileClose 过程 <br />关闭指定的文件<br />单元<br />SysUtils<br />语法<br />procedure FileClose(Handle: Integer);<br />描述<br />FileClose 关闭给定文件句柄的文件。句柄在文件使用FileOpen或FileCreate打开时获得。<br />当和Delphi语言的文件变量一起使用时，应使用 CloseFile 过程代替。<br />示例<br />下面的例子使用了一个按钮，一个字符串栅格和一个保存对话框在窗体上。单击按钮后，用户将被提示输入文件名。当用户单OK后，字符串栅格的内容将被写到指定的文件中。附加的信息同样被写到文件中，以便文件能够使用FileRead函数容易地读取。<br />procedure TForm1.Button1Click(Sender: TObject);<br />var<br />BackupName: string;<br />FileHandle: Integer;<br />StringLen: Integer;<br />X: Integer;<br />Y: Integer;<br />begin<br />if SaveDialog1.Execute then<br />begin<br />if FileExists(SaveDialog1.FileName) then<br />begin<br />BackupName := ExtractFileName(SaveDialog1.FileName);<br />BackupName := ChangeFileExt(BackupName, '.BAK');<br />if not RenameFile(SaveDialog1.FileName, BackupName) then<br />raise Exception.Create('Unable to create backup file.');<br />end;<br />FileHandle := FileCreate(SaveDialog1.FileName);<br />{ Write out the number of rows and columns in the grid. }<br />FileWrite(FileHandle, <br />StringGrid1.ColCount, SizeOf(StringGrid1.ColCount));<br />FileWrite(FileHandle, <br />StringGrid1.RowCount, SizeOf(StringGrid1.RowCount));<br />for X := 0 to StringGrid1.ColCount - 1 do<br />begin<br />for Y := 0 to StringGrid1.RowCount - 1 do<br />begin<br />{ Write out the length of each string, followed by the string itself. }<br />StringLen := Length(StringGrid1.Cells[X,Y]);<br />FileWrite(FileHandle, StringLen, SizeOf(StringLen));<br />FileWrite(FileHandle,<br />StringGrid1.Cells[X,Y], Length(StringGrid1.Cells[X,Y]);<br />end;<br />end;<br />FileClose(FileHandle);<br />end;<br />end;</p><p>15.FileCreate 函数 <br />创建一个新文件<br />单元<br />SysUtils<br />语法<br />function FileCreate(const FileName: string): Integer; overload;<br />function FileCreate(const FileName: string; Rights: Integer): Integer; overload;<br />描述<br />FileCreate 用指定的名称创建新文件。如果返回值是正数，说明函数成功而且值是新文件的句柄。返回值是-1说明有错误发生。<br />在 Windows中，FileAccessRights 变量和 Rights 参数被忽略。<br /></p></div>
<img src ="http://www.cnitblog.com/yide/aggbug/11377.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/yide/" target="_blank">青蛙學堂</a> 2006-06-01 11:58 <a href="http://www.cnitblog.com/yide/archive/2006/06/01/11377.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>