FileSystem.SPC(Int16) 方法

定義

搭配 PrintPrintLine 函式使用,以定位輸出。

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

必要。 在顯示或列印清單中的下一個運算式之前所要插入的空格數。

傳回

搭配 PrintPrintLine 函式使用,以定位輸出。

範例

此範例會使用 函 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 - (寬度 - 目前的列印位置) 。

注意

請確定表格式欄寬到足以允許寬字母。

適用於

另請參閱