[英]Management automation host rectangle: bottom cannot be greater than or equal to top
我收到一條錯誤消息,說底部不能大於或等於頂部。
我正在使用此處記錄的Rectangle
構造函數: https : //docs.microsoft.com/en-us/dotnet/api/system.management.automation.host.rectangle.-ctor?view= Rectangle
System_Management_Automation_Host_Rectangle__ctor_System_Int32_System_Int32_System_Int32_System_Int32_ _
這是我的相關代碼部分;
Console.WriteLine("setting rectangles: " + sizex +", " +sizey);
int screenTop = sizey;
int screenBottom = 1;
int statusTop = 1;
int statusBottom = 0;
Console.WriteLine ("screen top bottom; "+screenTop + " > " + screenBottom );
Console.WriteLine ("status top bottom; "+statusTop + " > " + statusBottom );
// Rectangle(int left, int top, int right, int bottom);
System.Management.Automation.Host.Rectangle screenWindowRect = new Rectangle(0,screenTop,sizex,screenBottom);
System.Management.Automation.Host.Rectangle statusLineRect = new Rectangle(0,statusTop,sizex,statusBottom);
Console.WriteLine("rectangles set");
我在構造函數之前看到調試行,但從未看到“矩形設置”消息。
這是輸出;
setting rectangles: 241, 28
screen top bottom; 28 > 1
status top bottom; 1 > 0
Out-Less: "bottom" cannot be greater than or equal to "top".
我可以看到頂部大於底部,但我不斷收到錯誤消息; "bottom" cannot be greater than or equal to "top"
這是錯誤還是文檔錯誤,還是我遺漏了什么。
錯誤消息錯誤地陳述了實際的錯誤情況:
"bottom" cannot be greater than or equal to "top"
應該:
"bottom" cannot be less than "top"
換句話說: bottom
參數必須等於或大於top
參數- 類似地, right
必須等於或大於left
:
您可以在 PowerShell 本身中驗證這一點:
# OK: 1 -ge 1
# Arguments are: left, top, right, bottom
[System.Management.Automation.Host.Rectangle]::new(0, 1, 0, 1)
# OK: 2 -ge 1
[System.Management.Automation.Host.Rectangle]::new(0, 1, 0, 2)
# !! EXCEPTION: 0 -ge 1 is NOT true.
[System.Management.Automation.Host.Rectangle]::new(0, 1, 0, 0)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.