FileSystem.SPC(Int16) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
搭配 Print or PrintLine 功能來定位輸出。
public:
static Microsoft::VisualBasic::SpcInfo SPC(short Count);
public static Microsoft.VisualBasic.SpcInfo SPC(short Count);
static member SPC : int16 -> Microsoft.VisualBasic.SpcInfo
Public Function SPC (Count As Short) As SpcInfo
參數
- Count
- Int16
必須的。 顯示或列印下一個表達式前,需插入的空格數。
傳回
搭配 Print or PrintLine 功能來定位輸出。
範例
此範例使用 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.
備註
若 Count 小於輸出線寬,下一個列印位置緊接著列印的空格數。 若Count 大於輸出線寬, SPC 則使用以下公式計算下一次列印位置:
currentprintposition(+(Count``Mod``width))
例如,如果目前列印位置是 24,輸出線寬是 80,且你指定 SPC(90),下一次列印會從位置 34(目前列印位置 + 剩餘的 90/80 開始)。 如果目前列印位置與輸出線寬的差小Count於(或寬CountMod度),函SPC式會跳到下一行的起點,並產生等於 Count -(寬 - 度 currentprintposition)的空格。
備註
確保你的表格欄位夠寬,能容納寬大的字母。