﻿<?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>博客园-爱.NET没商量</title><link>http://www.cnblogs.com/msnadair/</link><description>其中的代码,如果您有更好的改进,请一定提出您的宝贵意见</description><language>zh-cn</language><lastBuildDate>Wed, 15 Oct 2008 23:04:38 GMT</lastBuildDate><pubDate>Wed, 15 Oct 2008 23:04:38 GMT</pubDate><ttl>60</ttl><item><title>AxWindowsMediaPlayer媒体文件主要方法属性 (转)</title><link>http://www.cnblogs.com/msnadair/archive/2008/05/28/1209325.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Wed, 28 May 2008 08:45:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2008/05/28/1209325.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/1209325.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2008/05/28/1209325.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/1209325.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/1209325.html</trackback:ping><description><![CDATA[<span  style="color: #222222; font-family: Verdana; font-size: 12px; line-height: 24px; ">
<div class="postTitle" align="left">
<p align="center" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><strong>转自:<span  style="color: #000000; font-family: 'Lucida Grande'; font-weight: normal; line-height: normal; white-space: pre; ">http://www.cnblogs.com/Impulse/</span></strong></p>
<p align="center" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><strong>AxWindowsMediaPlayer媒体文件主要方法属性</strong>&#160;&#160;&#160;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><font size="2"><font color="#0000ff"><font color="#0000ff">属性/方法名： 说明：&#160;<br />
[基本属性] 　&#160;<br />
</font><font color="#0000ff">URL:String</font><font color="#0000ff">; 指定媒体位置，本机或网络地址&#160;<br />
uiMode:String; 播放器界面模式，可为Full, Mini, None, Invisible&#160;<br />
playState:integer; 播放状态，1=停止，2=暂停，3=播放，6=正在缓冲，9=正在连接，10=准备就绪&#160;<br />
enableContextMenu:Boolean; 启用/禁用右键菜单&#160;<br />
fullScreen:boolean; 是否全屏显示&#160;<br />
//播放器基本控制&#160;<br />
Ctlcontrols.play; 播放&#160;<br />
Ctlcontrols.pause; 暂停&#160;<br />
Ctlcontrols.stop; 停止&#160;<br />
Ctlcontrols.currentPosition:double; 当前进度&#160;<br />
Ctlcontrols.currentPositionString:string; 当前进度，字符串格式。如&#8220;00:23&#8221;&#160;<br />
Ctlcontrols.fastForward; 快进&#160;<br />
Ctlcontrols.fastReverse; 快退&#160;<br />
Ctlcontrols.next; 下一曲&#160;<br />
Ctlcontrols.previous; 上一曲&#160;<br />
[settings] wmp.settings //播放器基本设置&#160;<br />
settings.volume:integer; 音量，0-100&#160;<br />
settings.autoStart:Boolean; 是否自动播放&#160;<br />
settings.mute:Boolean; 是否静音&#160;<br />
settings.playCount:integer; 播放次数&#160;<br />
[currentMedia] wmp.currentMedia //当前媒体属性&#160;<br />
currentMedia.duration:double; 媒体总长度&#160;<br />
currentMedia.durationString:string; 媒体总长度，字符串格式。如&#8220;03:24&#8221;&#160;<br />
currentMedia.getItemInfo(const string); 获取当前媒体信息"Title"=媒体标题，"Author"=艺术家，"Copyright"=版权信息，"Description"=媒体内容描述， "Duration"=持续时间（秒），"FileSize"=文件大小，"FileType"=文件类型，"sourceURL"=原始地址&#160;<br />
currentMedia.setItemInfo(const string); 通过属性名设置媒体信息&#160;<br />
currentMedia.name:string; 同 currentMedia.getItemInfo("Title")&#160;<br />
[currentPlaylist] wmp.currentPlaylist //当前播放列表属性&#160;<br />
currentPlaylist.count:integer; 当前播放列表所包含媒体数&#160;<br />
currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息，其子属性同wmp.currentMedia&#160;<br />
</font>axWindowsMediaPlayer1.currentMedia.sourceURL; //获取正在播放的媒体文件的路径<br />
</font></font><font size="2"><font color="#0000ff">axWindowsMediaPlayer1.currentMedia.name;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //</font><font color="#0000ff">获取正在播放的媒体文件的名称</font><br />
axWindowsMediaPlayer1.Ctlcontrols.Play<font face="宋体">　　　　　　　　　　播放</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Stop<font face="宋体">　　　　　　　　　　停止</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Pause<font face="宋体">　　　　　　　　　</font>&#160;<font face="宋体">暂停</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.PlayCount<font face="宋体">　　　　　　　　文件播放次数</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.AutoRewind<font face="宋体">　　　　　　　是否循环播放</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Balance<font face="宋体">　　　　　　　　　声道</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Volume<font face="宋体">　　　　　　　　　音量</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Mute<font face="宋体">　　　　　　　　　　静音</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.EnableContextMenu<font face="宋体">　　　　是否允许在控件上点击鼠标右键时弹出快捷菜单</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.AnimationAtStart<font face="宋体">　　　　是否在播放前先播放动画</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowControls<font face="宋体">　　　　　　是否显示控件工具栏</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowAudioControls<font face="宋体">　　　　是否显示声音控制按钮</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowDisplay<font face="宋体">　　　　　　　是否显示数据文件的相关信息</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowGotoBar<font face="宋体">　　　　　　　是否显示</font>Goto<font face="宋体">栏</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowPositionControls<font face="宋体">　　是否显示位置调节按钮</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowStatusBar<font face="宋体">　　　　　　是否显示状态栏</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.ShowTracker<font face="宋体">　　　　　　　是否显示进度条</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.FastForward<font face="宋体">　　　　　　　快进</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.FastReverse<font face="宋体">　　　　　　　快退</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.Ctlcontrols.Rate<font face="宋体">　　　　　　　　　　快进／快退速率</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.AllowChangeDisplaySize<font face="宋体">　是否允许自由设置播放图象大小</font></font><font size="2">&#160;&#160;<br />
axWindowsMediaPlayer1.DisplaySize<font face="宋体">　　　　　　　设置播放图象大小</font></font><font size="2">&#160;&#160;<br />
<font face="宋体">　　　　</font>1-MpDefaultSize<font face="宋体">　　　　　　　　　原始大小</font></font><font size="2">&#160;&#160;<br />
<font face="宋体">　　　　</font>2-MpHalfSize<font face="宋体">　　　　　　　　　　</font>&#160;<font face="宋体">原始大小的一半</font></font><font size="2">&#160;&#160;<br />
<font face="宋体">　　　　</font>3-MpDoubleSize<font face="宋体">　　　　　　　　　</font>&#160;<font face="宋体">原始大小的两倍</font></font><font size="2">&#160;&#160;<br />
<font face="宋体">　　　　</font>4-MpFullScreen<font face="宋体">　　　　　　　　　</font>&#160;<font face="宋体">全屏</font></font><font size="2">&#160;&#160;<br />
<font face="宋体">　　　　</font>5-MpOneSixteenthScreen<font face="宋体">　　　　　</font>&#160;<font face="宋体">屏幕大小的</font></font><font size="2">1/16&#160;&#160;<br />
<font face="宋体">　　　　</font>6-MpOneFourthScreen<font face="宋体">　　　　　　　屏幕大小的</font></font><font size="2">1/4&#160;&#160;<br />
<font face="宋体">　　　　</font>7-MpOneHalfScreen<font face="宋体">　　　　　　　　屏幕大小的</font></font><font size="2">1/2&#160;&#160;<br />
axWindowsMediaPlayer1.ClickToPlay<font face="宋体">　　　　　　　是否允许单击播放窗口启动</font>Media Player&#160;&#160;</font></p>
</div>
<p class="postText" style="background-image: initial; background-repeat: initial; background-attachment: initial; background-color: white; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; background-position: 0% 50%; "><font size="2"><font face="宋体">在视频播放之后</font>,<font face="宋体">可以通过如下方式读取源视频的宽度和高度</font>,<font face="宋体">然后设置其还原为原始的大小</font></font><font size="2">.<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private void ResizeOriginal()<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int intWidth = axWindowsMediaPlayer1.currentMedia.imageSourceWidth;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int intHeight = axWindowsMediaPlayer1.currentMedia.imageSourceHeight;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; axWindowsMediaPlayer1.Width = intWidth + 2;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; axWindowsMediaPlayer1.Height = intHeight + 2;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</font></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">打开媒体文件并播放:</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dim filePath As String<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; With Me.OpenFileDialog1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .Title = "</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">打开语音文件"<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .CheckPathExists = True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .CheckFileExists = True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .Multiselect = False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .Filter = "mp3文件(*.mp3)|*.mp3|所有文件(*.*)|*.*"<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; If .ShowDialog = DialogResult.Cancel Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Exit Sub<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; filePath = .FileName<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End With<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Me.Text = "PC复读机-文件&#160;" &amp; filePath<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AxWindowsMediaPlayer1.URL = filePath<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Try<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Me.AxWindowsMediaPlayer1.Ctlcontrols.play()<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Catch ex As Exception<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MsgBox("对不起，不能播放此格式语音文件", MsgBoxStyle.OKOnly, "PC复读机")<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Exit Sub<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; End Try</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">注意:</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.URL&#160;</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">中URL是表示要播放的文件名,取消了原来的Name属性.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.Ctlcontrols.play()</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">播放,同样还有Pause,Stop等其他属性.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.settings.balance</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">表示媒体播放的声道设置,0表示均衡,-1和1表示左右声道.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.currentMedia.duration&#160;</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">表示要播放的文件的时间长度.可用它获取文件长度.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.Ctlcontrols.currentPosition</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">表示正在播放的文件的当前播放位置,可用这个属性来对媒体文件进行前进后退等设置.如</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.Ctlcontrols.currentPosition+1&#160;</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">表示前进1个时间单位.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">AxWindowsMediaPlayer1.settings.rate</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">播放速率,一般乘以16后再显示kbps单位.</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">注意:在上面程序中,如果在后面加上一个：</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">msgbox(AxWindowsMediaPlayer1.currentMedia.duration.ToString )</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">则显示结果很可能为0，因此，这时候很可能获取不到文件的播放时间长度，容易出错。所以在利用的时候可以加一个timer控件：</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EndPoint = AxWindowsMediaPlayer1.currentMedia.duration<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; If EndPoint = 0 Then Exit Sub '</span><span style="font-size: 9pt; color: #333333; line-height: 150%; ">可能因为媒体文件的打开需要一定时间，这里等待媒体文件的打开</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; msgbox(AxWindowsMediaPlayer1.currentMedia.duration.ToString )</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">End Sub</span></p>
<p class="postText" align="left" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; "><span style="font-size: 9pt; color: #333333; line-height: 150%; ">此时msgbox便会显示文件播放长度。</span></p>
<span style="font-size: 9pt; color: #333333; line-height: 150%; ">
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">2. Ctlcontrols属性</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">Ctlcontrols属性是AxWindowsMediaPlayer的一个重要属性，&#160;此控件中有许多常用成员。</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">(1)&#160;方法play</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于播放多媒体文件，其格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.play()</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：&#160;AxWindowsMediaPlayer1.Ctlcontrols.play()&#160;&#160;&#8216;此处缺省窗体名是Me</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">(2)&#160;方法pause</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于暂停正在播放的多媒体文件，其格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.pause()</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：&#160;AxWindowsMediaPlayer1.Ctlcontrols.pause()</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">(3)&#160;方法stop</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于停止正在播放的多媒体文件，其格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.stop()</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：&#160;AxWindowsMediaPlayer1.Ctlcontrols.stop()</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">(4)&#160;方法fastforward</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于将正在播放的多媒体文件快进，其格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.fastforward()</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：&#160;AxWindowsMediaPlayer1.Ctlcontrols.forward()</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">(5)&#160;方法fastreverse</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.fastreverse()</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：&#160;AxWindowsMediaPlayer1.Ctlcontrols.fastreverse()</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">6.&#160;属性CurrentPosition</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于获取多媒体文件当前的播放进度，其值是数值类型，使用格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.Ctlcontrols.currentPosition</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">d1 =AxWindowsMediaPlayer1.Ctlcontrols.currentPosition</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">其中d1&#160;是一个整型变量。</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">7.&#160;属性Duration</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">用于获取当前多媒体文件的播放的总时间，其值为数值类型，其使用格式为：</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">窗体名.控件名.currentMedia.duration</p>
<p class="postText" style="text-indent: 42.65pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">如：d2 =AxWindowsMediaPlayer1.currentMedia.duration</p>
<p class="postText" style="text-indent: 18pt; margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; font-size: 1em; line-height: 200%; ">其中d2是一个整型变量。</p>
</span></span>
<img src ="http://www.cnblogs.com/msnadair/aggbug/1209325.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43012/" target="_blank">[新闻]最富有科技公司：中移动310亿美元居首</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>【转】RS-232/RS-485/RS-422 接口简介与编程 </title><link>http://www.cnblogs.com/msnadair/archive/2008/05/12/1193079.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Mon, 12 May 2008 01:42:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2008/05/12/1193079.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/1193079.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2008/05/12/1193079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/1193079.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/1193079.html</trackback:ping><description><![CDATA[<h3 class="post-title"><a title="【转】RS-232/RS-485/RS-422 接口简介与编程" href="http://www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html">【转】RS-232/RS-485/RS-422 接口简介与编程</a> </h3>
<div class="post-body">
<div>
<table>
    <tbody>
        <tr>
            <td>
            <div style="clear: both"></div>
            <span>最近在调试两款<a id="vad_2" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,2,fxEvent);" title="百强巡展10-080428@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,2)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=6292&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.100autoshow.com/line_display.asp%3Fprono%3D986&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=267481&amp;k=%u4EA7%u54C1" target="_blank" name="2">产品</a>时，问题都是出在了串口通信上。今天加班好不容易跟着把其中一款产品的串口接收数据的错误给调好了！</span><br />
            <br />
            <span>回宿舍特地查了下<a id="vad_4" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,4,fxEvent);" title="草根网&nbsp;-&nbsp;IT资讯精读@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,4)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=4747&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.20ju.com&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=798919&amp;k=%u8D44%u6599" target="_blank" name="4">资料</a>，发现这篇文章对RS-232/RS-485/RS-422 的介绍还可以拿来一看。</span><br />
            <br />
            <blockquote>
            <p><br />
            <br />
            <strong>一、什么是RS-232 接口？</strong><br />
            <br />
            (1) RS-232 的历史和作用<br />
            <br />
            <span><span><span>在串行通讯时，要求通讯双方都采用一个<a id="vad_7" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,7,fxEvent);" title="北极中文网?免费视频教程@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,7)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=4643&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.bjchw.com&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=873469&amp;k=%u6807%u51C6" target="_blank" name="7">标准</a><span>接口，使不同的设备可以方便地连接起来进行通讯。RS-232-C接口（又称EIA RS-232-C）是目前最常用的一种串行通讯接口。（&#8220;RS-232-C&#8221;中的&#8220;-C&#8221;只不过<a id="vad_8" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,8,fxEvent);" title="百强县市汽车巡展04@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,8)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=6097&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.100autoshow.com/line_display.asp%3Fprono%3D1009&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=352538&amp;k=%u8868%u793A" target="_blank" name="8">表示</a>RS-232的</span></span><a id="vad_1" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,1,fxEvent);" title="最大的Subversion中文论坛@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,1)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=2995&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.iUseSVN.com/bbs&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=277611&amp;k=%u7248%u672C" target="_blank" name="1">版本</a><span><span>，所以与&#8220;RS-232&#8221;简称是一样的）它是在1970 年由美国电子工业</span><a id="vad_6" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,6,fxEvent);" title="徐州原子吉他艺术中心@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,6)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=3249&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.xzjtw.com&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=860193&amp;k=%u534F%u4F1A" target="_blank" name="6">协会</a><span>（EIA）联合贝尔系统、调制解调器厂家及计算机终端生产厂家共同制定的用于串行通讯的标准。它的全名是"数据终端设备（DTE）和数据通讯设备（DCE）之间串行二进制数据交换接口</span></span></span><a id="vad_0" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,0,fxEvent);" title="上海威迅教育软件工程师培训@Vogate.com" style="font-size: 1em; cursor: hand; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,0)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=6055&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.aoshi-edu.com&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=327606&amp;k=%u6280%u672F" target="_blank" name="0">技术</a><span><span><span>标准"该标准规定采用一个25 个脚的DB-25 连接器，对连接器的每个引脚的信号内容加以规定，还对各种信号的电平加以规定。后来IBM的PC 机将RS-232 简化成了DB-9 连接器，从而成为事实标准。而工业</span><a id="vad_5" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,5,fxEvent);" title="上海良诺阀门有限公司-水力控制阀@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,5)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=5856&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.lnvalve.com/client/pro_more1.asp%3Fpage%3D1%26bigid%3D40&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=963944&amp;k=%u63A7%u5236" target="_blank" name="5">控制</a>的RS-232 口一般只</span><a id="vad_3" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,3,fxEvent);" title="百强巡展08-080428@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,3)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=6289&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.100autoshow.com/line_display.asp%3Fprono%3D986&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=53391&amp;k=%u4F7F%u7528" target="_blank" name="3">使用</a>RXD、TXD、GND 三条线。</span></span><br />
            <br />
            (2)RS-232 接口的电气特性<br />
            <br />
            在RS-232-C 中任何一条信号线的电压均为负逻辑关系。即：逻辑"1"为-3 到-15V；逻辑"0"为+3 到+15V 。RS-232-C 最常用的9 条引线的信号内容如下所示<br />
            <br />
            DB-9 1 2 3 4 5 6 7 8 9<br />
            <br />
            DB-25 8 3 2 20 7 6 4 5 22<br />
            <br />
            定义DCD RXD TXD DTR GND DSR RTS CTS RI<br />
            <br />
            <span>(3) RS-232 接口的<a id="vad_9" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,9,fxEvent);" title="中国水资讯网.水论坛@Vogate.com" style="font-size: 1em; cursor: pointer; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,9)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=3590&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.cjk3d.net/news&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=164682&amp;k=%u7269%u7406" target="_blank" name="9">物理</a>结构</span><br />
            <br />
            <span>RS-232-C 接口连接器一般使用型号为DB-9 插头座,通常插头在DCE端,插座在DTE端.</span><br />
            <br />
            <span><span>PC 机的RS-232 口为9 芯针插座。而波士RS-232/RS-485转换器的RS-232 为DB-9 孔插头。一些设备与PC 机连接的RS-232 接口,因为不使用对方的传送控制信号,只需三条接口线,即"发送数据TXD"、"接收数据RXD"和"信号地GND"。RS-232 传输线采用屏蔽双绞线。</span></span><br />
            <br />
            （4）RS-232 传输电缆长度<br />
            <br />
            <span><span><span><span>由RS-232C标准规定在码元畸变小于4%的情况下，传输电缆长度应为50 英尺，其实这个4%的码元畸变是很保守的，在实际应用中，约有99%的用户是按码元畸变10-20%的范围工作的，所以实际使用中最大距离会远超过50英尺，美国DEC公司曾规定允许码元畸变为10%而得出下面实验结果。其中1 号电缆为屏蔽电缆，型号为DECP.NO.9107723 内有三对双绞线，每对由22# AWG </span><a id="vad_10" onmouseover="this.style.borderBottom='2px #996633 solid';var fxEvent=arguments[0];kwmouseover(this,10,fxEvent);" title="中国红娘-真实严肃的婚恋交友平台@Vogate.com" style="font-size: 1em; cursor: hand; color: #996633; border-bottom: #996633 1px dotted; text-decoration: underline" onmouseout="this.style.borderBottom='1px #996633 dotted'; kwmouseout(this,10)" href="http://action.vogate.com/c/c.php?r=http%3A//www.google.cn/search%3Fhl%3Dzh-CN%26q%3DRS485%25E8%25BD%25ACRS232%26btnG%3DGoogle+%25E6%2590%259C%25E7%25B4%25A2%26meta%3D%26aq%3Df&amp;aid=5373&amp;sid=6235007045037672&amp;click=1&amp;url=http%3A//www.hongniang.com&amp;v=0&amp;s=http%3A//www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html&amp;rn=917927&amp;k=%u7EC4%u6210" target="_blank" name="10">组成</a>，其外覆以屏蔽网。2 号电缆为不带屏蔽的电缆。型号为DECP.NO.9105856-04是22#AWG 的四芯电缆。</span></span></span><br />
            <br />
            DEC 公司的实验结果<br />
            <br />
            波特率bps 1号电缆传输距离（米） 2号电缆传输距离（米）<br />
            <br />
            110 1500 900<br />
            <br />
            300 1500 900<br />
            <br />
            1200 900 900<br />
            <br />
            2400 300 150<br />
            <br />
            4800 300 75<br />
            <br />
            9600 75 75<br />
            <br />
            <span>经过许多年来RS-232 器件以及通信技术的改进，RS-232 的通信距离已经大大增加。波士电子的RS-232 增强器可以将普通的RS-232 口的通信距离直接延长到1000米。</span><br />
            <br />
            <strong>二、什么是RS-485 接口？</strong><br />
            <br />
            （1）RS-485 的电气特性：<br />
            <br />
            <span>发送端：逻辑"1"以两线间的电压差为+（2 至6） V 表示；逻辑"0"以两线间的电压差为-（2 至6）V 表示。接收端：A比B高200mV以上即认为是逻辑"1",A 比B 低200mV 以上即认为是逻辑"0"。</span><br />
            <br />
            （2）RS-485(或 RS-422)的接线：<br />
            <br />
            <span>RS-485(或 RS-422)通信建议一定要接地，因为RS-485(或 RS-422)通信要求通信双方的地电位差小于1V。即：半双工通信接3根线（+A、-B、地），全双工通信接5根线（+发、-发、+收、-收、地）。为了安全起见，建议通信机器的外壳接大地。RS-485(或 RS-422)光隔转换器的所有外接电源的&#8220;地&#8221;必须全部连在一起但不要与计算机外壳地相连，因为电源&#8220;地&#8221;同时也是RS-485或 RS-422的信号&#8220;地&#8221;。当通信距离超过100米时建议最好使用光电隔离的通信接口转换器。</span><br />
            <br />
            （3）RS-485 的数据最高传输速率为10Mbps。但是由于RS-485 常常要与PC 机的RS-232口通信，所以实际上一般最高115.2Kbps。又由于太高的速率会使RS-485 传输距离减小，所以往往为9600bps 左右或以下。<br />
            <br />
            （4）RS-485 接口是采用平衡驱动器和差分接收器的组合，抗噪声干扰性好。<br />
            <br />
            <span><span>（5）RS-485接口的最大传输距离标准值为1200米（9600bps时），实际上可达3000米，RS-485 接口在总线上是允许连接多达128个收发器、即RS-485 具有多机通信能力,这样用户可以利用单一的RS-485 接口方便地建立起设备网络。因RS-485 接口具有良好的抗噪声干扰性，长的传输距离和多站能力等上述优点就使其成为首选的串行接口。因为RS485 接口组成的半双工网络，一般只需二根信号线，所以RS485 接口均采用屏蔽双绞线传输。RS-485 的国际标准并没有规定RS485 的接口连接器标准、所以采用接线端子或者DB-9、DB-25 等连接器都可以。波士RS-485 接口是事实工业标准。</span></span><br />
            <br />
            （6）采用RS485 接口时，传输电缆的长度如何考虑？<br />
            <br />
            <span>在使用RS485 接口时，对于特定的传输线经，从发生器到负载其数据信号传输所允许的最大电缆长度是数据信号速率的函数，这个长度数据主要是受信号失真及噪声等影响所限制。最大电缆长度与信号速率的关系曲线是使用24AWG 铜芯双绞电话电缆（线径为0.51mm），线间旁路电容为52.5PF/M，终端负载电阻为100 欧时所得出。（引自GB11014-89附录A）。当数据信号速率降低到90Kbit/S 以下时，假定最大允许的信号损失为6dBV 时， 则电缆长度被限制在1200M。实际上，在实用时是完全可以取得比它大的电缆长度。当使用不同线径的电缆。则取得的最大电缆长度是不相同的。例如：当数据信号速率为600Kbit/S时，采用24AWG 电缆，最大电缆长度是200m，若采用19AWG 电缆（线径为0.91mm）则电缆长度将可以大于200m； 若采用28AWG 电缆（线径为0.32mm）则电缆长度只能小于200m。RS-485的远距离通信建议采用屏蔽电缆，并且将屏蔽层作为地线。</span><br />
            <br />
            <strong>三、什么是RS-422 接口？</strong><br />
            <br />
            RS-422 的电气性能与RS-485完全一样。主要的区别在于：<br />
            <br />
            RS-422 有4 根信号线：两根发送（Y、Z）、两根接收（A、B）。由于RS-422 的收与发是分开的所以可以同时收和发（全双工）。RS-485 有2 根信号线：发送和接收都是A 和B。由于RS-485 的收与发是共用两根线所以不能够同时收和发（半双工）。能否将RS-422 的Y-A 短接作为RS-485 的A、将RS-422 的Z-B 短接作为RS-485 的B呢？回答：不一定。条件是RS-422 必须是能够支持多机通信的。波士电子的所有接口转换器的RS-422 口都能够支持全双工多机通信，所以可以这样简单转换为RS-485。<br />
            <br />
            <strong>四、RS-485 比RS-232接口相比有何特点？</strong><br />
            <br />
            <span>由于RS-232 接口标准出现较早，难免有不足之处，主要有以下四点：</span><br />
            <br />
            （1） <strong>接口的信号电平值较高，易损坏接口电路的芯片</strong><span>，又因为与TTL 电平不兼容故需使用电平转换电路方能与TTL 电路连接。 </span><span style="color: #009900">//这点我们有&#8220;惨痛&#8221;的教训，带电拔插操作，使得芯片被烧毁，结果串口收发数据就会出现问题</span><br />
            <br />
            （2） 传输速率较低，在异步传输时，波特率为20Kbps。现在由于采用新的UART 芯片16C550 等，波特率达到115.2Kbps。<br />
            <br />
            <span>（3） 接口使用一根信号线和一根信号返回线而构成共地的传输形式， 这种共地传输容易产生共模干扰，所以抗噪声干扰性弱。</span><br />
            <br />
            <span>（4） 传输距离有限，最大传输距离标准值为50 米，实际上也只能用在15米左右。</span><br />
            <br />
            （5） RS-232 只允许一对一通信，而RS-485 接口在总线上是允许连接多达128个收发器。<br />
            <br />
            <strong>五、串口通信功能的实现</strong><br />
            <br />
            <span><span>利用VC++实现串口通信的方法有多种，我们采取直接调用Window API中的一系列标准的串口通信函数，直接用这些标准函数来完成Windows下面的串口通信编程[11]。利用WindowsAPI函数控制利用API函数实现对RS232串口通信的访问，在实现控制通信中，我们必定要调动3个函数来实现对串口的控制:</span></span><br />
            <br />
            CreatFile()函数实现串口初始化并打开串口;<br />
            ReadFile()函数接收串口传递过来的二进制流并返回数据到接收缓冲区中；<br />
            WriteFile()把应用程序发出的指令送到发送缓冲区以供串口接收<br />
            <br />
            （1） 打开串口<br />
            <br />
            以下程序用于以同步方式打开串口COM1;<br />
            <br />
            HANDLE hCom;<br />
            <br />
            DWORD dwErrorHcomm=CreateFile(&#8220;COM1&#8221;,GENERIC_READGENERIC_WRITE<br />
            <br />
            ,0, NULL,OPEN_EXISTING, 0, NULL);<br />
            <br />
            if (hComm==(HANDLE)0Xffff)<br />
            <br />
            {<br />
            <br />
            dwError=GetLastError();<br />
            <br />
            MessageBox(dwError);<br />
            <br />
            }<br />
            <br />
            （2） 配置串口<br />
            <br />
            <span>配置串口是通过改变设备控制块DCB(Device Control Block)的成员变量值来实现的，程序实现如下:</span><br />
            <br />
            DCB dcb<br />
            <br />
            dcb.BaudRate=9600;//波特率为9600bps<br />
            <br />
            dcb.ByteSize=8;//数据位8位<br />
            <br />
            dcb.Parity=EVENPARTTY;//有校验<br />
            <br />
            dcb.StopBits=ONESTOPRTT; //一个停止位<br />
            <br />
            SetCommState(hCom，&amp;dcb);<br />
            <br />
            （3） 数据读写<br />
            <br />
            对串口进行读写与对文件进行读写所用的函数相同，具体为可采用查询、同步、异步或事件驱动等方法对串口进行读写所用函数如下所示:<br />
            <br />
            bReadStatus=ReadFile(hCom,buffer,length,&amp;length &amp;amp;amp;amp;amp;m_lpOverlapped);<br />
            <br />
            if(!bReadStatus)<br />
            <br />
            {<br />
            <br />
            if(GetLastError()=ERROR_IO_PENDING)<br />
            <br />
            {<br />
            <br />
            WaitForSingleObject(m_lpOverlapped,hEvent,1000);<br />
            <br />
            return((char)length);<br />
            <br />
            }<br />
            <br />
            return 0;<br />
            <br />
            }<br />
            <br />
            //写入函数程序为:<br />
            <br />
            bWriteStatus=WriteFile(hCom,buffer,length,&amp;length,&amp;m_lpOverlapped)<br />
            <br />
            if(!bWriteStatus)<br />
            <br />
            {<br />
            <br />
            if(GetLastError()=ERROR_IO_PENDING)<br />
            <br />
            {<br />
            <br />
            WaitForSingleObject(m_lpOverlapped, hEvent,1000);<br />
            <br />
            return((char)length);<br />
            <br />
            }<br />
            <br />
            return 0;<br />
            <br />
            }<br />
            <br />
            （4） 程序的编制<br />
            <br />
            <span>用VC++进行程序的编制首先要对串口进行初始化，设定端口，通信速率和校验方式，并在使用前打开串口，程序部分如下:</span><br />
            <br />
            {<br />
            <br />
            Cdialog::OnInitDialog();//TODO: Add extra initialization here<br />
            <br />
            m_comm.SetCommPort(1);//选择串口1<br />
            <br />
            if(! m_comm.GetPortOpen())<br />
            <br />
            m_comm.SetPortOpen(TRUE);//打开串口1<br />
            <br />
            m_comm.SetSettings(&#8220;9600,n,8,1&#8221;); //设置串口参数<br />
            <br />
            m_comm.SetRThreshold(1);<br />
            <br />
            m_comm.SetInputMode(1);//设置二进制模式<br />
            <br />
            return TRUE;<br />
            <br />
            }<br />
            <br />
            除了串口的位置和基本串口参数(数据传输速率9600bps，1位开始位，8位数据位，1位停止位，一位奇偶校验)设置外，为了实现实时数据采集功能，接受数据的读写要尽可能的快速，则设置RTHreshold=1即接收缓冲区收到一个字节产生OnComm事件InputLen=1每次读取一个字节。如果PC上位机在一定时间内不能将数据处理完，接收缓冲区会滞留数据，数据会产生丢失现象，我们必须对接受缓冲区进行适当的设置。我们利用API函数实现串口通信的方法，实现了罗经及发射机对上位机串行通信的功能。</p>
            <p><br />
            转自:<font face="Verdana">http://www.qiuxianli.cn/programming/2007/09/rs-232rs-485rs-422.html</font><br />
            </p>
            </blockquote></td>
        </tr>
    </tbody>
</table>
</div>
</div>
<img src ="http://www.cnblogs.com/msnadair/aggbug/1193079.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43010/" target="_blank">[新闻]华盛顿抛弃微软Office 选择Google Apps</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>替换文本文件中的回车符,打开DXF文件</title><link>http://www.cnblogs.com/msnadair/archive/2008/05/05/1183755.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Mon, 05 May 2008 09:15:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2008/05/05/1183755.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/1183755.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2008/05/05/1183755.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/1183755.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/1183755.html</trackback:ping><description><![CDATA[<p>今天一网友突然叫我帮他打开一DXF文件,用CAD打开.他告诉我他用CAD读取时,发现提示文件可能损坏.<br />
所以就丢给我看了.我先是用记事本打开DXF文件,发现里面根本没有"行"的痕迹.看起来只有一行的文本.<br />
我想也许我把那DXF文件搞行标准的DXF格式就可以用CAD读出来了.<br />
<br />
说来也怪,我以为这是某人(或某公司)写DXF文件的结果(是不是这样,俺也不清楚),所以我就想在GOOGLE中搜索一下此种格式的公司名.我COPY了DXF文件中的前面几个字:<font face="Verdana">999Version 1.0,&nbsp;XXX Technology.</font><br />
巧就巧在这里,我发现只有999显示在GOOGLE的输入栏中. 所以我确定在999与VERSION中有一特殊符号. 所以我就决定读出那特定符号.方法是得用FileStream一个字节一个字节地读.方法如下:<br />
<font face="Verdana">Dim afile As FileStream</font><br />
<font face="Verdana">Dim ibyte(0) As Byte<br />
<font face="Verdana">Dim i As Byte</font><br />
<font face="Verdana">&nbsp;Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; afile = New FileStream("c:\SAMPLE.txt", FileMode.Open)<br />
&nbsp;End Sub<br />
</p>
<p><font face="Verdana">Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; afile.Seek(i, SeekOrigin.Begin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; afile.Read(ibyte, 0, 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.RichTextBox1.Text &amp;=ibyte(0) &amp; vbcrlf<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font face="Verdana">Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Finally<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Me.RichTextBox1.Refresh()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End Try<br />
</font><font face="Verdana">&nbsp;&nbsp;&nbsp; End Sub<br />
我不断地点击Button1,RichTextBox1中显示的是57,57,57,13,86<br />
我查一下ASCALL表,发现57是数字9,86是字符"V",那么13就是"999"与"V"之间的"隐藏"符号,在ASCALL表中13就是回车符(CR),只有回车没有换行(LF)才会没有显示"行"的痕迹. 所以下一步就是用回车换行替换回车,但我在文本文件中好像无法完成此种替换. <br />
唉... 那个催命鬼网友,催个不停呀!<br />
自己写一个程序来完成替换工作吧!<br />
于是就有了下面的一段程序:<br />
<font face="Verdana">Dim afile As FileStream<br />
&nbsp;&nbsp;&nbsp; Dim astream As StreamReader<br />
&nbsp;&nbsp;&nbsp; Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; afile = New FileStream("c:\SAMPLE.txt", FileMode.Open)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; astream = New StreamReader(afile)<br />
&nbsp;&nbsp;&nbsp; End Sub<br />
&nbsp;&nbsp;&nbsp; Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim s As String<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s = astream.ReadToEnd()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Finally<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; astream.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s.Replace(vbCr, vbCrLf)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.RichTextBox1.Text = s<br />
&nbsp;&nbsp;&nbsp; End Sub<br />
<br />
把程序界面中的RichTextBox1中的所有文本COPY到原先的DXF文本文件,并替换它.再保存.<br />
用CAD打开,一副CAD图就显现出来了. <br />
我网友高兴,我也高兴.</font></font></p>
</font></font>
<img src ="http://www.cnblogs.com/msnadair/aggbug/1183755.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43009/" target="_blank">[新闻]微软：WGA验证每小时黑屏是善意提醒</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>将特定格式的TXT数据文件写入EXCEL</title><link>http://www.cnblogs.com/msnadair/archive/2008/04/24/1168674.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Thu, 24 Apr 2008 01:31:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2008/04/24/1168674.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/1168674.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2008/04/24/1168674.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/1168674.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/1168674.html</trackback:ping><description><![CDATA[<p><font face="Verdana">自己写的一个将特定格式的TXT数据文件中的数据写入EXCEL中的列中<br />
<br />
Imports Excel<br />
Imports System<br />
Imports System.Reflection ' For Missing.Value and BindingFlags<br />
Imports System.Runtime.InteropServices ' For COMException<br />
Imports System.IO<br />
Imports System.Collections<br />
Imports System.Threading<br />
Public Class frmFileToExcel<br />
&nbsp;&nbsp;&nbsp; Inherits System.Windows.Forms.Form</font></p>
<p><font face="Verdana">#Region " Windows Form Designer generated code "</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; Public Sub New()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyBase.New()</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'This call is required by the Windows Form Designer.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitializeComponent()</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Add any initialization after the InitializeComponent() call</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; End Sub</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; 'Form overrides dispose to clean up the component list.<br />
&nbsp;&nbsp;&nbsp; Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If disposing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not (components Is Nothing) Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; components.Dispose()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyBase.Dispose(disposing)<br />
&nbsp;&nbsp;&nbsp; End Sub</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; 'Required by the Windows Form Designer<br />
&nbsp;&nbsp;&nbsp; Private components As System.ComponentModel.IContainer</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; 'NOTE: The following procedure is required by the Windows Form Designer<br />
&nbsp;&nbsp;&nbsp; 'It can be modified using the Windows Form Designer.&nbsp; <br />
&nbsp;&nbsp;&nbsp; 'Do not modify it using the code editor.<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents Label1 As System.Windows.Forms.Label<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents Button1 As System.Windows.Forms.Button<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents Button2 As System.Windows.Forms.Button<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents txtPath As System.Windows.Forms.TextBox<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog<br />
&nbsp;&nbsp;&nbsp; Friend WithEvents lblprompt As System.Windows.Forms.Label<br />
&nbsp;&nbsp;&nbsp; &lt;System.Diagnostics.DebuggerStepThrough()&gt; Private Sub InitializeComponent()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1 = New System.Windows.Forms.ComboBox<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1 = New System.Windows.Forms.Label<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath = New System.Windows.Forms.TextBox<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1 = New System.Windows.Forms.Button<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2 = New System.Windows.Forms.Button<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1 = New System.Windows.Forms.ProgressBar<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt = New System.Windows.Forms.Label<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.SuspendLayout()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ComboBox1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1.Items.AddRange(New Object() {"Pull&amp;Peel", "BookBend Stress", "Abrasion Stress", "Pen Stress", "Page Turning Stress"})<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1.Location = New System.Drawing.Point(144, 16)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1.Name = "ComboBox1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1.Size = New System.Drawing.Size(360, 21)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ComboBox1.TabIndex = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Label1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.Location = New System.Drawing.Point(16, 16)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.Name = "Label1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.Size = New System.Drawing.Size(112, 24)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.TabIndex = 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Label1.Text = "Machine:"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'txtPath<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Location = New System.Drawing.Point(144, 79)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Name = "txtPath"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Size = New System.Drawing.Size(360, 26)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.TabIndex = 2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Text = ""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Button1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.Location = New System.Drawing.Point(8, 72)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.Name = "Button1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.Size = New System.Drawing.Size(120, 40)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.TabIndex = 3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button1.Text = "Browse..."<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Button2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.Location = New System.Drawing.Point(184, 128)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.Name = "Button2"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.Size = New System.Drawing.Size(160, 48)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.TabIndex = 4<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Button2.Text = "Translate"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ProgressBar1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Dock = System.Windows.Forms.DockStyle.Bottom<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Location = New System.Drawing.Point(0, 183)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Name = "ProgressBar1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Size = New System.Drawing.Size(536, 15)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.TabIndex = 5<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'lblprompt<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.ForeColor = System.Drawing.Color.Red<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Location = New System.Drawing.Point(112, 183)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Name = "lblprompt"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Size = New System.Drawing.Size(352, 16)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.TabIndex = 6<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Text = "reading from txt file..."<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'frmFileToExcel<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ClientSize = New System.Drawing.Size(536, 198)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.lblprompt)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.Button2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.Button1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.txtPath)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.Label1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.ComboBox1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Controls.Add(Me.ProgressBar1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.MaximizeBox = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.MinimizeBox = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Name = "frmFileToExcel"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Text = "Translator(Only For MCT's Machine)"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ResumeLayout(False)</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; End Sub</font></p>
<p><font face="Verdana">#End Region<br />
&nbsp;&nbsp;&nbsp; Dim strPath As String</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; Private FileInput As FileStream<br />
&nbsp;&nbsp;&nbsp; Private BinaryInput As BinaryReader<br />
&nbsp;&nbsp;&nbsp; Dim Index As Integer<br />
&nbsp;&nbsp;&nbsp; Dim myExcelArray(0) As Array '需要写入EXCEL的数组的数组<br />
&nbsp;&nbsp;&nbsp; Dim myYArray(65000, 0) As Single '将.TXT文件中的数据读入此数组.<br />
&nbsp;&nbsp;&nbsp; Dim collumns(255) As String '对应于EXCEL中的列<br />
&nbsp;&nbsp;&nbsp; Dim myYDataArray(0, 0) As Single '将myYArray(65000, 0)中的实际数据转入此数组. 以便写入EXCEL中的数据是实际读出来的数据<br />
&nbsp;&nbsp;&nbsp; Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.OpenFileDialog1.Filter = "txt files (*.txt)|*.txt"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.OpenFileDialog1.ShowDialog()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strPath = Me.OpenFileDialog1.FileName<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtPath.Text = strPath<br />
&nbsp;&nbsp;&nbsp; End Sub<br />
&nbsp;&nbsp;&nbsp; Private Function ReadFile() As Boolean<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblprompt.Visible = True<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Refresh()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Visible = True<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Maximum = 100<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Minimum = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Value = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (FileInput Is Nothing) = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (BinaryInput Is Nothing) = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryInput = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If FileInput Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput = New FileStream(strPath, FileMode.Open, FileAccess.Read)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If BinaryInput Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryInput = New BinaryReader(FileInput)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As IOException<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show("Open File: " &amp; strPath &amp; " Failed!", "Open File Failed", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryInput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblprompt.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer<br />
L:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Me.ComboBox1.SelectedIndex = 0 Or Me.ComboBox1.SelectedIndex = 1 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim cycPos As Long<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cycPos = 65001 * Index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput.Seek((i + cycpos) * 50, SeekOrigin.Begin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryInput.ReadInt32()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myYArray(i, 0) = BinaryInput.ReadSingle()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loop<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim cycPos As Long<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cycPos = 65001 * Index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput.Seek((i + cycPos) * 20, SeekOrigin.Begin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myYArray(i, 0) = BinaryInput.ReadSingle()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loop<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim myYDataArray(i - 1, 0) '取出实际有用数据<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Array.Copy(myYArray, 0, myYDataArray, 0, i)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReDim Preserve myExcelArray(Index)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myExcelArray(Index) = myYDataArray.Clone '将读出来的数据数组存入用来保存写入EXCEL中的数组的数组<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Array.Clear(myYArray, 0, myYArray.Length)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Array.Clear(myYDataArray, 0, myYDataArray.Length)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If i &gt; 65000 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GoTo L<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Value = 30<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileInput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryInput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblprompt.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show(ex.Message)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Finally<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblprompt.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return True<br />
&nbsp;&nbsp;&nbsp; End Function<br />
&nbsp;&nbsp;&nbsp; Private Sub ToExcel()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '定义相关参数<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim m_objExcel As Application<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim m_objBook As Workbook<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim m_objSheet As _Worksheet</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel = CreateObject("Excel.Application")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook = m_objExcel.Workbooks.Add<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objSheet = m_objBook.Worksheets(1)</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim m_objRange As Range<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer</font></p>
<font face="Verdana">
<p><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Value = 50<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 0 To myExcelArray.Length - 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange = m_objSheet.Range(collumns(i))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange = m_objRange.Resize(myExcelArray(i).Length, 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange.Value = myExcelArray(i) '写入EXCEL中<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Value = 90<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook.SaveAs(strPath.Substring(0, strPath.Length - 4) &amp; ".xls")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '销毁相关对像. 不然在任务管理器中会出来EXCEL.EXE进程.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objRange = Nothing '此点容易忽略.此处不赋值NULL,EXCEL.EXE进程将无法杀死<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objSheet = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objBook = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel.Quit()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objExcel = Nothing</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GC.Collect()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GC.WaitForPendingFinalizers()</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.ProgressBar1.Value = 100</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txtPath.Text = ""<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strPath = ""<br />
&nbsp;&nbsp;&nbsp; End Sub<br />
&nbsp;&nbsp;&nbsp; Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If strPath = "" Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show("Please select a txt file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Button2.Enabled = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If ReadFile() = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Button2.Enabled = True<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.lblprompt.Visible = False<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ToExcel()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Button2.Enabled = True<br />
&nbsp;&nbsp;&nbsp; End Sub</p>
<p>&nbsp;&nbsp;&nbsp; Private Sub frmFileToExcel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim j As Integer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim bArray() As String = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim aArray() As String = {"A", "B", "C", "D", "E", "F", "G", "H"}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 0 To 25<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collumns(i) = bArray(i) &amp; "1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 1 To 8<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For j = 1 To 26<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collumns(25 + j + 26 * (i - 1)) = aArray(i - 1) &amp; bArray(j - 1) &amp; 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 1 To 22<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collumns(233 + i) = "I" &amp; bArray(i - 1) &amp; "1"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp; End Sub<br />
End Class<br />
<br />
<br />
<em><span style="color: red">附:写特定TXT格式数据的写入函数:<br />
</span></em><em><span style="color: red">Private Sub SaveDataFile()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Dir.Exists(Application.StartupPath &amp; "\DataFile") = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dir.CreateDirectory(Application.StartupPath &amp; "\DataFile")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If FileOutput Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileOutput = New FileStream(Application.StartupPath &amp; "\DataFile\" &amp; ItemStr &amp; ".txt", FileMode.Create, FileAccess.Write)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If BinaryOutput Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryOutput = New BinaryWriter(FileOutput)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer</span></em></p>
<p><em><span style="color: red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 0 To ylist.Count - 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileOutput.Seek(i * 20, SeekOrigin.Begin)<br />
</span></em><em><span style="color: red">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryOutput.Write(Convert.ToSingle(ylist(i)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex1 As FormatException<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox(ex1.Message)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex2 As IOException<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox(ex2.Message)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'MsgBox(ex.Message)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Finally<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileOutput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryOutput.Close()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (FileOutput Is Nothing) = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileOutput = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (BinaryOutput Is Nothing) = False Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryOutput = Nothing<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try</span></em></p>
<p><em><span style="color: red">&nbsp;&nbsp;&nbsp; End Sub</span></em></p>
<p><br />
<span style="color: #cc99ff">此代码为边学边试, 写出来的.&nbsp; 在学的过程中,我一直有个问题想问:<br />
<span style="color: #800000">如何能将一个一维数组直接写入EXCEL中的某一列中.为何非要用到二维数组来进行. <br />
</span>不明.&nbsp;如有知道的朋友,请告之. <br />
谢谢!<br />
</span></font>&nbsp;</p>
<img src ="http://www.cnblogs.com/msnadair/aggbug/1168674.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43008/" target="_blank">[新闻]研究表明上网可以提高记忆力</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>笑话</title><link>http://www.cnblogs.com/msnadair/archive/2008/01/11/1034877.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Fri, 11 Jan 2008 02:55:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2008/01/11/1034877.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/1034877.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2008/01/11/1034877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/1034877.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/1034877.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、吃自助最高境界：扶墙进，扶墙出。 &nbsp; <br />
　　2、结婚必备条件：有车有房，父母双亡。 &nbsp; <br />
　　3、没有钱，没有权，再不对你好点，你能跟我？ &nbsp; <br />
　　4、拿份报纸上厕所，俺是读书人。 &nbsp; <br />
　　5、上Google上百度一下。 &nbsp; <br />
　　6、女人一定要对自己好一点。一旦累死了，就会有别的女人花你的钱，住你的房，睡你的老公，打你的娃！ &nbsp; <br />
　　7、你的丑和你的脸没有关系&#8230;&#8230; &nbsp; <br />
　　8、长个包子样，就别怨狗跟着。 &nbsp; <br />
　　9、争吵的时候，男人和女人的区别就像步枪和机关枪的区别。 &nbsp; <br />
　　10、爷爷都是从孙子走过来的&#8230;&#8230; &nbsp; <br />
　　11、老天，你让夏天和冬天同房了吧？生出这种鬼天气！ &nbsp; <br />
　　12、鸟大了什么林子都有！ &nbsp; <br />
　　13、听说女人如衣服，兄弟如手足。回想起来，咱这尊千手观音竟然裸奔了20多年！ &nbsp; <br />
　　14、不怕神一样的对手，就怕猪一样的队友。 &nbsp; <br />
　　15、夏天就是不好，穷的时候我连西北风都没得喝&#8230;&#8230; &nbsp; <br />
　　16、随你大小便！ &nbsp; <br />
　　17、怀才就像怀孕，时间久了才能让人看出来。 &nbsp; <br />
　　18、没什么事就不要找我，有事了更不要找我。 &nbsp; <br />
　　19、你以为我会眼睁睁地看着你去送死？我会闭上眼睛的。 &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; 20、锻炼肌肉，防止挨揍！ &nbsp; <br />
　　21、天使之所以会飞，是因为她们把自己看得很轻&#8230;&#8230; &nbsp; <br />
　　22、我想早恋，可是已经晚了&#8230;&#8230; &nbsp; <br />
　　23、拥抱真是个奇怪的东西，明明靠的那么近，却看不见彼此的脸。 &nbsp; <br />
　　24、揍你个性生活不能自理！ &nbsp; <br />
　　25、当你穿上爱情的婚纱，我也披上了和尚的袈裟&#8230;&#8230; &nbsp; <br />
　　26、其实我是一个天才，可惜天妒英才！ &nbsp; <br />
　　27、请你以后不要在我面前说英文了，OK？ &nbsp; <br />
　　28、思想有多远，你就给我滚多远！ &nbsp; <br />
　　29、男人的谎言可以骗女人一夜，女人的谎言可以骗男人一生！ &nbsp; <br />
　　30、好久没有人把牛皮吹的这么清新脱俗了！ &nbsp; <br />
　　31、老板，钱对你来说真的就那么重要吗？讲了三个多小时了一分钱都不降？ &nbsp; <br />
　　32、起那么早干嘛？夜总会还没开门呢！ &nbsp; <br />
　　33、一觉醒来，天都黑了。 &nbsp; <br />
　　34、我要是做了人事部经理，第一件事就是提拔自己做老总。 &nbsp; <br />
　　35、我每天除了吃饭的时间全在减肥，你还说我没有毅力？ &nbsp; <br />
　　36、水能载舟，亦能煮粥。 &nbsp; <br />
　　37、买了电脑不上宽带，就好比酒肉都准备好了却在吃饭前当了和尚&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;38、只要你舍得死，我就舍得埋！ &nbsp; <br />
　　39、人又不聪明，还敢学人家秃顶？ &nbsp; <br />
　　40、有一个很古老的传说——能在XX校园里看到美女的人会长生不老&#8230;&#8230; &nbsp; <br />
　　41、如果连你也不理我，我就变成狗不理了&#8230;&#8230; &nbsp; <br />
　　42、生，容易；活，容易；生活，不容易。 &nbsp; <br />
　　43、打死你我也不会说。 &nbsp; <br />
　　44、钱可以解决的问题都不是问题。 &nbsp; <br />
　　45、念了十几年书，想起来还是幼儿园比较好混！ &nbsp; <br />
　　46、连广告也信，读书读傻了吧？ &nbsp; <br />
　　47、戒烟容易，戒你太难！ &nbsp; <br />
　　48、不吃饱哪有力气减肥啊？ &nbsp; <br />
　　49、睡眠是一门艺术——谁也不能阻挡我追求艺术的脚步。 &nbsp; <br />
　　50、奈何桥上的老婆婆都卖上百事可乐了，你叫我怎么忘记你？ &nbsp; <br />
　　51、早起的鸟儿有虫吃，早起的虫虫被鸟吃。 &nbsp; <br />
　　52、如果我做了皇帝，一定封你当太子。 &nbsp; <br />
　　53、只要锄头舞的好，哪有墙角挖不倒？ &nbsp; <br />
　　54、天哪，我的衣服又瘦了！&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;55、我在女友手机里的名字是&#8220;他&#8221;，分手后，我就变成了&#8220;它&#8221;。 &nbsp; <br />
　　56、避孕的效果：不成功，便成人。 &nbsp; <br />
　　57、我和你不一样，因为我是人。 &nbsp; <br />
　　58、问君能有几多愁，恰似一群太监上青楼。 &nbsp; <br />
　　59、我真想亲口管你爷爷叫声：&#8220;爹！&#8221; &nbsp; <br />
　　60、我喝水只喝纯净水，牛奶只喝纯牛奶，所以我很单纯&#8230;&#8230; <br />
<img src ="http://www.cnblogs.com/msnadair/aggbug/1034877.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43007/" target="_blank">[新闻]为什么叫Windows 7？</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>映射Y轴</title><link>http://www.cnblogs.com/msnadair/archive/2007/12/11/990989.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Tue, 11 Dec 2007 08:48:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2007/12/11/990989.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/990989.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2007/12/11/990989.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/990989.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/990989.html</trackback:ping><description><![CDATA[<font face="Courier New">&nbsp; Dim m As New Matrix(1.0F, 0.0F, 0.0F, -1.0F, 0, 0)<br />
&nbsp;&nbsp;e.Graphics.Transform() = m</font>
<img src ="http://www.cnblogs.com/msnadair/aggbug/990989.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43003/" target="_blank">[新闻]Open Source Camp 北京 2008技术交流盛会</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>VB.NET中获取串口列表</title><link>http://www.cnblogs.com/msnadair/archive/2007/11/14/958990.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Wed, 14 Nov 2007 04:15:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2007/11/14/958990.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/958990.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2007/11/14/958990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/958990.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/958990.html</trackback:ping><description><![CDATA[Imports Microsoft.Win32 <br />
<br />
Private Sub GetComList()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim keycom As RegistryKey = Registry.LocalMachine.OpenSubKey("Hardware""DeviceMap""SerialComm")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim str As String<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not keycom Is Nothing Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim sSubKeys() As String = keycom.GetValueNames()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmbItem.clear()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each str In sSubKeys<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim s As String = keycom.GetValue(str).ToString.Trim<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.cmbPLC.Items.Add(s)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmbitem.add(s)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
End Sub
<img src ="http://www.cnblogs.com/msnadair/aggbug/958990.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43002/" target="_blank">[新闻]关于 Silverlight 2 Control Tookit 的最新消息</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>VB.NET中判断一个数组中是否有重值</title><link>http://www.cnblogs.com/msnadair/archive/2007/11/14/958986.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Wed, 14 Nov 2007 04:12:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2007/11/14/958986.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/958986.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2007/11/14/958986.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/958986.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/958986.html</trackback:ping><description><![CDATA[&nbsp;Private Function IsDup(ByVal s() As String) As Boolean<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim str As String<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each str In s '遍历整个数组<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Array.IndexOf(s, str) &lt;&gt; Array.LastIndexOf(s, str) Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return True<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return False<br />
&nbsp;End Function<br />
<br />
在其中加一小小代码,亦可以得出重复的元素和其序号.当然也可以得出一个去掉了重复元素的新数组<br />
<br />
<img src ="http://www.cnblogs.com/msnadair/aggbug/958986.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43002/" target="_blank">[新闻]关于 Silverlight 2 Control Tookit 的最新消息</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>如何做好一个女人和做好一个男人</title><link>http://www.cnblogs.com/msnadair/archive/2007/09/28/909463.html</link><dc:creator>Adair</dc:creator><author>Adair</author><pubDate>Fri, 28 Sep 2007 07:55:00 GMT</pubDate><guid>http://www.cnblogs.com/msnadair/archive/2007/09/28/909463.html</guid><wfw:comment>http://www.cnblogs.com/msnadair/comments/909463.html</wfw:comment><comments>http://www.cnblogs.com/msnadair/archive/2007/09/28/909463.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/msnadair/comments/commentRss/909463.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/msnadair/services/trackbacks/909463.html</trackback:ping><description><![CDATA[&nbsp;
<p style="text-align: center" align="center"><strong><span style="font-size: 13.5pt; color: red; line-height: 140%">一、女人篇：如何做一个好女人</span></strong></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人应该有一个温柔的胸怀，能让身心俱疲的男人在你的温柔里如沐春雨。女人温柔的胸怀是男人暖暖的家。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人应该是善解人意、通情达理。在男人需要理解和帮助的时候，以自己柔弱的肩膀撑起男人疲惫的脊梁。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人应该是理家的一把好手。她一定能做得一手好菜。最好还能为他织一件幸福的毛衣。让外出的男人时时想着家，家里有自己惦记的浓浓温情。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人应该为男人留一方自己的天空。尊重他即是尊重自己。有时候，做朋友比作妻子更重要。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人应该为晚归的男人留一盏温馨灯。它能加快男人回家的步履，驱走男人心中夜归的寒意。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人不仅知道女人的礼仪。更应该知道男人的领带是他品味的象征。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人有理由让自己的男人每天都精神饱满。不求每天光艳亮丽，也要每天朴素而整洁。那是女人自己的另一张脸。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　好女人在男人失意的时候，不应该说：</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">&#8220;</span><span style="font-size: 10.5pt; line-height: 140%">你看你多没用，看人家如何如何。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">&#8221;</span><span style="font-size: 10.5pt; line-height: 140%">如果这样，你以前所有的好都打了折扣。好女人应该知道在他失意的时候说什么，要知道你是他潜力的源泉。而当他飞黄腾达的时候，你要学会享受。过份的节俭是你的愚蠢。你要做一个时尚的女人。但不能奢侈过度，你花的是他的心血钱。没有一个男人不喜欢自己老婆光艳亮丽的。以后的日子里，就算他有钱有这样的贱心恐怕也没那样的贱胆。因为他知道你在他的心中是无可替代的</span><span style="font-size: 10.5pt; line-height: 140%; font-family: 'Times New Roman'">.</span><span style="font-size: 10.5pt; line-height: 140%">　不能常常说男人的缺点，那样会使他很反感</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">——</span><span style="font-size: 10.5pt; line-height: 140%">我那么差，你还缠着我干嘛？除非你真的很想离开他，否则不要这样去伤他的自尊心。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">懂得就不该伤害，可能该去安抚而不是指出</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要对小事情斤斤计较，连他迟一点点回你的电话都大发雷霆，他会觉得你不懂得体谅他人，不通情达理，没法跟你生活一辈子。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">善解人意，谅解可能会比计较来的好些</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要对男人逼供，每个人都可以有自己的秘密，他不想说的就让他沉默吧。有些事情说出来，只会大家都很受伤。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">对，我老爱问些什么，结果反而不开心，改的了就好了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　爱情不是游戏，爱情很脆弱，不要去考验你的他，其实，没有多少男人是可以禁得起真正的考验的。本来风平浪静，一旦你使用一些小机谋去考验他，反而可能激起千层浪，一发不可收拾。例如常常以分手相要挟，例如派个美女好友进行色诱进行考验，这只会让他讨厌你。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">这我可干不出了，色诱太威胁了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">.)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要利用自己的吵闹功力，厉害的女人只会让男人避而远之。温柔和撒娇才是法宝，可怜兮兮需要保护的女孩最讨男人喜欢。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">温柔哦</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">...</span><span style="font-size: 10.5pt; line-height: 140%">我不太会啊</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">但可以试试</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">!</span><span style="font-size: 10.5pt; line-height: 140%">会很恶心被鄙视哦</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">!)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要企图捆住男人，时时查他的行踪，翻查他私人的东西。男人会认为失去了自由，没有男人心甘情愿为了一个女人放弃自由。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我给你自由，只有不要迷失自我就可以</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要耍小聪明，他比你聪明，他只会在心里嘲笑你。傻傻的女孩会让男人有优越感，他们会觉得这样的女孩很可爱。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我是真的挺聪明的，怎么办</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">呵呵</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要显得很坚强。适当地用眼泪，但不能滥用。微微抽泣，或者转身默默掉泪，或含泪而强颜欢笑，都会令男人心生爱怜之心。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">眼泪哦</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">!</span><span style="font-size: 10.5pt; line-height: 140%">我总是流不完</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">...</span><span style="font-size: 10.5pt; line-height: 140%">该如何是好呢</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">?)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">不要过度地撒娇，适度就好，否则就变得毫不讲理。而且时机要恰当，不要在他心烦意乱的时候还不识趣的乱说话。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我不会</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">沉默是金，但可能我自己说的太少了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　一点点醋劲会让他觉得你在乎他，但不要无缘无故的疑神疑鬼。要信任他，爱情总是建立在信任基础之上的。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我有时会吃醋那</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">可是我尽力克制自己了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">...)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要过于频繁的吵架，即使是小的吵架，凡事都是积少成多的。偶尔的小吵架，不是要你去责备他，而是要去显得委屈和悲伤，让他更懂得爱怜你。吵架要给自己留后路，不要把事情做绝，不要把话说绝。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">不吵了不吵了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">...</span><span style="font-size: 10.5pt; line-height: 140%">我再不吵架了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要只在他的生活中扮演一种角色，要懂得看时机行事，时而如母亲般呵护，时而像女儿般依偎，时而像偶像一般崇拜，时而像老师一样成熟。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">呵呵，我知道</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要粘着他，对他若即若离，让他牵挂你，然后他才会珍惜你的温柔妩媚。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">他会吗</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">?</span><span style="font-size: 10.5pt; line-height: 140%">恩</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不能对别的男人也像对他一样。要让他知道，你的所有一切，只为了他才这样。在你身边，让他觉得他是特别的，他就会不离开你。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我很毅气的，朋友也很重要啊</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">看来要不一样也麻烦，我尽力</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不能穿着太暴露和花哨，只会降低你在他心中的地位。一个男人，如果他对你真心，都希望你是个能出得厅堂的大方得体的女人，他把你带出去他会有面子。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">哦</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">我觉得还可以啦</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">..</span><span style="font-size: 10.5pt; line-height: 140%">我就爱穿了那</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要因为熟悉，不重视自己的打扮，即使在家里也不要邋邋遢遢。高雅美丽的女人永远令人舒服和心动，还要透出一种含蓄的性感。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">这个我很注意的</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要整天板着脸，故装忧郁，有趣的女人令人愉快。谁都希望能开心快乐的生活，不要让男人觉得跟你在一起很无聊。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我忧郁才忧郁，从不故做忧郁，我不希望他给我带来忧郁</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　不要陷在爱情里出不来，爱情一开始靠激情，但要维持就要靠智慧，要用理智控制自己的行为，聪明的女人才能得到自己想要的幸福。往往女人在热恋是会变得很愚蠢，最后导致失去自己爱的人。男人如果远走高飞，如果你真的爱他，不要令寻新欢，这回让他真的离开你。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我明白我是谁</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">?)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　千万不要在爱情中丧失理智。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">永恒的聪明，可是也不能一辈子</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要朝三暮四，专一的女人男人才感动心要与之过一辈子。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">开始专一了，不变了</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要不在乎他的付出，他是爱你的，爱的方式可能不一样，但你一定要珍惜他对你的爱。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我在乎</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要拿别的男人与你的他做比较，尤其不要赞扬他人贬低他。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">永远是你最厉害</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要过分赞扬他的外貌，男人不希望以外貌赢得女人的爱。尤其是一个他想一辈子在一起的女人，如果只爱他的外表，他会感到不安全。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">虽然长的不错，但是喜欢被疼</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要对他坦白你的恋爱史，即使要说，也不要仔细描述，没有男人受得了你还非常怀念你以前的恋人。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">愿意忘记一切，从开始到现在</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要以为你不能理解的就是错误的，男人和女人是不同的。不要企图改变他，如果他事事真的都顺着你，那你还会喜欢他吗。</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">我不会，我会指出错误的</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　不要以为他不细心，不要随便乱说话，即使是小事也要仔细考虑</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">(</span><span style="font-size: 10.5pt; line-height: 140%">现在开始好了，相信自己</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">)</span></p>
<p style="text-align: center" align="center"><strong><span style="font-size: 13.5pt; color: red; line-height: 140%">二、男人篇：如果做一个好男人</span></strong></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">1</span><span style="font-size: 10.5pt; line-height: 140%">、有一个相爱的人是最好的。但是不要为了没有，就像个皇帝一样把身边的女子当成嫔妃来选，这是对你智商的侮辱。难道你没有判断力吗？</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">2</span><span style="font-size: 10.5pt; line-height: 140%">、打什么都别打女人。打了，你就什么理由都没有了。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">3</span><span style="font-size: 10.5pt; line-height: 140%">、伤什么都别伤女人的心。伤了一个女人的心，你身边可能会有</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">200</span><span style="font-size: 10.5pt; line-height: 140%">个女人恨你。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">4</span><span style="font-size: 10.5pt; line-height: 140%">、不要用女朋友的数量来显示你的魅力。你完全可以用事业和业绩来展示你的优秀。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">5</span><span style="font-size: 10.5pt; line-height: 140%">、再不漂亮的女人跟你说话时，也请你不要三心二意，敲桌子发短信转头看别的女人，你会因此失去很多风度。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">6</span><span style="font-size: 10.5pt; line-height: 140%">、喝点酒是可以的，但是不必逢喝必醉。没有女人喜欢一个整日醉醺醺的男人，尽管你说那是你的应酬，你躲不开。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">7</span><span style="font-size: 10.5pt; line-height: 140%">、学会帮女人做家务。一个回家就只是躺在沙发上等待老婆开饭的男人，会让婚姻生活淡的比白开水还无味。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">8</span><span style="font-size: 10.5pt; line-height: 140%">、陪你心爱的人逛街，微笑着对她逛街的耐力表示赞赏。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">9</span><span style="font-size: 10.5pt; line-height: 140%">、如果你爱一个人，请你温柔的呵护她；如果不爱，直说。女人都很傻的，从她爱上你的那一刻，便身心俱付。但是要小心这种无怨无悔，最后也可能由于你的自我满足却不愿意负责任毁掉你的人生。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">10</span><span style="font-size: 10.5pt; line-height: 140%">、帮你爱的人买礼物。你赚钱为了什么？况且一个真正爱你的人是不会乱花你的钱的。如果你很不幸遇见一个挥霍无度的女子，请她离开你，她不爱你，包括你的钱。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">11</span><span style="font-size: 10.5pt; line-height: 140%">、不要在任何女人说黄色段子。让别人将你看成一个没有修养的人实在是件得不偿失的事情。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">12</span><span style="font-size: 10.5pt; line-height: 140%">、可以下班后在外面逗留。但是你心里要想着，如果你爱的人也和你一样长久逗留在外面，你是什么感觉？</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">13</span><span style="font-size: 10.5pt; line-height: 140%">、不要真的以为得不到的才是最好的。得不到的东西，当你穷尽心思得到后，可能会更失望，还不如好好珍惜现在拥有的。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">14</span><span style="font-size: 10.5pt; line-height: 140%">、记住一个原则：女士优先。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">15</span><span style="font-size: 10.5pt; line-height: 140%">、你工作太忙，但是打个电话给你心爱的人，不会花掉你太多时间或者令你死掉。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">16</span><span style="font-size: 10.5pt; line-height: 140%">、女人是用来疼的。如果你没有把握让一个女人幸福，请你闭口说爱她。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">17</span><span style="font-size: 10.5pt; line-height: 140%">、女人化妆不碍你的事。即使对方化的浓妆让你睁不开眼，也要微笑着给你的建议，而不是有厌恶的表情。</span></p>
<p><span style="font-size: 10.5pt; line-height: 140%">　　</span><span style="font-size: 10.5pt; line-height: 140%; font-family: ˎ̥">18</span><span style="font-size: 10.5pt; line-height: 140%">、女人问你想吃什么，不要说随便。告诉他你喜欢吃她的做的某个菜，这样你不仅能吃的可口，还会得到很多温柔和笑容。</span></p>
<p><span style="font-size: 10.5pt; line-height