Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有办法将 Multiline-TextBoxt 中的文本行/行限制为 .Net 中的 200?我试图设置框中允许的行数。
$userTextBox.Lines.Length = ?
这样的事情可能吗?
如果没有内置方法,那么您可以尝试使用事件处理程序自行限制它,如果当前按下的键是 Enter 键 (13),则忽略按键:
$textbox_KeyDown={ if($_.KeyValue -eq 13 -and $textbox.Lines.Count -ge 200) { $_.SuppressKeyPress=$true } }