• <legend id='DssW8'><style id='DssW8'><dir id='DssW8'><q id='DssW8'></q></dir></style></legend>
  • <i id='DssW8'><tr id='DssW8'><dt id='DssW8'><q id='DssW8'><span id='DssW8'><b id='DssW8'><form id='DssW8'><ins id='DssW8'></ins><ul id='DssW8'></ul><sub id='DssW8'></sub></form><legend id='DssW8'></legend><bdo id='DssW8'><pre id='DssW8'><center id='DssW8'></center></pre></bdo></b><th id='DssW8'></th></span></q></dt></tr></i><div id='DssW8'><tfoot id='DssW8'></tfoot><dl id='DssW8'><fieldset id='DssW8'></fieldset></dl></div>

    <small id='DssW8'></small><noframes id='DssW8'>

    1. <tfoot id='DssW8'></tfoot>
          <bdo id='DssW8'></bdo><ul id='DssW8'></ul>

      1. 在 WPF 中运行时调整文本框的大小

        时间:2023-06-09
        <legend id='QHq1H'><style id='QHq1H'><dir id='QHq1H'><q id='QHq1H'></q></dir></style></legend>
        <tfoot id='QHq1H'></tfoot>

        <small id='QHq1H'></small><noframes id='QHq1H'>

              <tbody id='QHq1H'></tbody>
            • <bdo id='QHq1H'></bdo><ul id='QHq1H'></ul>
              <i id='QHq1H'><tr id='QHq1H'><dt id='QHq1H'><q id='QHq1H'><span id='QHq1H'><b id='QHq1H'><form id='QHq1H'><ins id='QHq1H'></ins><ul id='QHq1H'></ul><sub id='QHq1H'></sub></form><legend id='QHq1H'></legend><bdo id='QHq1H'><pre id='QHq1H'><center id='QHq1H'></center></pre></bdo></b><th id='QHq1H'></th></span></q></dt></tr></i><div id='QHq1H'><tfoot id='QHq1H'></tfoot><dl id='QHq1H'><fieldset id='QHq1H'></fieldset></dl></div>

                  本文介绍了在 WPF 中运行时调整文本框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我只是想知道如何让用户在运行时通过在 WPF 中拖动它的角来调整 TextBox 控件的大小.不太重要的是,调整所有控件的大小是否使用相同的技术?

                  Was just wondering how I would go about letting the user resize a TextBox control at runtime by dragging its corners in WPF. Less importantly, is the same technique used for the resizing of all controls?

                  谢谢你:)

                  推荐答案

                  您应该尝试将文本框的对齐方式设置为拉伸并将其放置在可以调整大小的容器中,例如带有 gridsplitters 的网格(或在可调整大小的窗口中).这比尝试创建自定义的可调整大小的文本框要容易得多,并且它会更好地与您的布局的其余部分配合使用.

                  You should try setting the textbox's alignments to stretch and placing it inside a container that you can resize, like a grid with gridsplitters (or in a resizeable window). It's much easier than trying to create a custom resizeable textbox, and it will work better with the rest of your layout.

                  下面是一个真实应用的示例:

                  Here's an example from a real app:

                  <Grid>...
                  <GridSplitter Grid.Row="1" Grid.ColumnSpan="2" ResizeDirection="Rows" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="4" BorderThickness="0,0,0,1" BorderBrush="Gray" Background="Transparent"/>
                  <TextBox Grid.Row="2" Grid.Column="0" Margin="6,6,6,6" Name="RequestTextBox" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Text="{Binding Request, Mode=TwoWay}"/>
                  <GridSplitter Grid.Row="2" Grid.ColumnSpan="2" ResizeDirection="Rows" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="4" BorderThickness="0,0,0,1" BorderBrush="Gray" Background="Transparent"/>
                  ...</Grid>
                  

                  这篇关于在 WPF 中运行时调整文本框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:C#:使用 TextBox.WordWrap 显示长 Base64 字符串的多行文本框 下一篇:Winform中的空密码字符

                  相关文章

                    <tfoot id='DeBNr'></tfoot>
                        <bdo id='DeBNr'></bdo><ul id='DeBNr'></ul>

                    1. <i id='DeBNr'><tr id='DeBNr'><dt id='DeBNr'><q id='DeBNr'><span id='DeBNr'><b id='DeBNr'><form id='DeBNr'><ins id='DeBNr'></ins><ul id='DeBNr'></ul><sub id='DeBNr'></sub></form><legend id='DeBNr'></legend><bdo id='DeBNr'><pre id='DeBNr'><center id='DeBNr'></center></pre></bdo></b><th id='DeBNr'></th></span></q></dt></tr></i><div id='DeBNr'><tfoot id='DeBNr'></tfoot><dl id='DeBNr'><fieldset id='DeBNr'></fieldset></dl></div>
                    2. <legend id='DeBNr'><style id='DeBNr'><dir id='DeBNr'><q id='DeBNr'></q></dir></style></legend>

                      <small id='DeBNr'></small><noframes id='DeBNr'>