FileSystem.SPC 方法
搭配 Print 或 PrintLine 函式使用,以定位輸出。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Function SPC ( _
Count As Short _
) As SpcInfo
'用途
Dim Count As Short
Dim returnValue As SpcInfo
returnValue = FileSystem.SPC(Count)
public static SpcInfo SPC (
short Count
)
public:
static SpcInfo SPC (
short Count
)
public static SpcInfo SPC (
short Count
)
public static function SPC (
Count : short
) : SpcInfo
參數
- Count
必要項。在顯示或列印清單中的下一個運算式之前所要插入的空格數。
傳回值
搭配 Print 或 PrintLine 函式使用,以定位輸出。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 SPC 函式。
如果 Count 小於輸出行的寬度,則下一個列印位置會緊接在列印的空格數之後。如果 Count 大於輸出行的寬度,則 SPC 會使用以下公式計算下一個列印位置:
currentprintposition(+(CountModwidth))
例如,如果目前的列印位置是 24,輸出行寬度是 80,且您指定 SPC(90),則下一次列印將從位置 34 開始 (目前列印位置 + 90/80 的餘數)。如果目前的列印位置及輸出行的寬度兩者之間的差異小於 Count (或 CountModwidth),則 SPC 函式會跳到下一行的開頭,並產生等於 Count – (width – currentprintposition) 的空格數。
注意事項 |
---|
請確定您表格式資料行的寬度足以容納寬字母。 |
範例
此範例使用 SPC 函式將輸出定位於檔案中及 [輸出] 視窗內。
' The SPC function can be used with the Print function.
FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
Print(1, "10 spaces between here", SPC(10), "and here.")
FileClose(1) ' Close file.
平台
Windows 98、 Windows 2000 SP4、 Windows Millennium Edition、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
請參閱
參考
FileSystem 類別
FileSystem 成員
Microsoft.VisualBasic 命名空間
其他資源
SPC 函式
Mod 運算子 (Visual Basic)
Print、PrintLine 函式
Space 函式 (Visual Basic)
TAB 函式
FileWidth 函式