簡體   English   中英

PowerShell 中的 Out-GridView:如何更改窗口的初始大小?

[英]Out-GridView in PowerShell: How to change the initial size of the window?

我經常在 PowerShell 中使用有用的函數 Out-GridView。 有時我在 GridView 中只顯示很少的數據,但它每次都會在一個非常大的窗口中打開。 是否有可能更改 GridView 窗口的初始大小? 不應在 1920x1080 顯示器上幾乎全屏的窗口中顯示具有 3 列和 4 行的表格...

PowerShell 是一種腳本語言,而不是真正的 GUI 語言。 通過使用 Winforms 或 wpf,可以在 SAPIEN PowerShell Studio 等工具的幫助下創建 GUI。

簡而言之,恐怕你想要的是不可能的,因為它沒有參數

我遇到了同樣的問題,最終使用了這種自動調整大小的“解決方法”。

$null = [System.Reflection.Assembly]::LoadFile('C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.VisualBasic.dll')

$words = @"
    Line 1
    This is the line after line 1
    The third line contains the number 5.
"@

#if "words" is an array, change below to ($words | out-string)

[Microsoft.VisualBasic.Interaction]::MsgBox(($words),0, "Title")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM