c# – 当用户更改对话框的大小时,如何设置wpf文本框以自动调整大小?

c# – 当用户更改对话框的大小时,如何设置wpf文本框以自动调整大小?,第1张

概述当用户更改对话框大小时,如何设置wpf文本框以自动调整大小? <Window x:Class="MemoPad.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" B 当用户更改对话框的大小时,如何设置wpf文本框以自动调整大小?
<Window x:Class="MemoPad.Window1"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    Background="lightGray"     title="Window1" Height="350" WIDth="700" ><StackPanel OrIEntation="Vertical">    <Menu DockPanel.Dock ="Right">        <MenuItem header="Find" x:name="gMNuFind" />    </Menu>    <button Content=" Find "           margin="5,10,5,5"          x:name="gBuFind"           />    <TextBox margin="0,0"          HorizontalAlignment="left"          VerticalAlignment="top"           MinHeight="270" MinWIDth="690"                            x:name = "gTBxInfo"           textwrapPing="Wrap"          AcceptsReturn="True"          ScrollVIEwer.VerticalScrollbarVisibility="auto"           /></StackPanel>
解决方法 或者将StackPanel更改为GrID
<Window x:Class="WpfApplication1.MainWindow"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    Background="lightGray"     title="Window1" Height="350" WIDth="700" >    <GrID>        <GrID.RowDeFinitions>            <RowDeFinition Height="auto" />            <RowDeFinition Height="auto" />            <RowDeFinition Height="1*" />        </GrID.RowDeFinitions>        <Menu>            <MenuItem header="Find" x:name="gMNuFind" />        </Menu>        <button GrID.Row="1" Content=" Find "           margin="5,5"          x:name="gBuFind"           />        <TextBox GrID.Row="2" margin="0,0"          HorizontalAlignment="Stretch"          VerticalAlignment="Stretch"           MinHeight="270" MinWIDth="690"                            x:name = "gTBxInfo"           textwrapPing="Wrap"          AcceptsReturn="True"          ScrollVIEwer.VerticalScrollbarVisibility="auto"           />    </GrID></Window>
总结

以上是内存溢出为你收集整理的c# – 当用户更改对话框的大小时,如何设置wpf文本框以自动调整大小?全部内容,希望文章能够帮你解决c# – 当用户更改对话框的大小时,如何设置wpf文本框以自动调整大小?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/langs/1252108.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存