在 Winform C# 应用程序上,我在表单上显示一个文本框。
该文本框将显示一行,仅一行。
我想展示并使用水平滚动条。
我将属性“滚动条”设置为水平:滚动条不显示。
我将 WordWrap 添加为 false :ScrollBar 不显示。
我将 MultiLine 添加为 true (即使一 ligne ):ScrollBar 不显示。
我显示的行比控件“大”一升,所以我真的需要一个滚动条:(
这是定义:
this.TxtBox_ApercuFichier.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TxtBox_ApercuFichier.Location = new System.Drawing.Point(11, 30);
this.TxtBox_ApercuFichier.Multiline = true;
this.TxtBox_ApercuFichier.Name = "TxtBox_ApercuFichier";
this.TxtBox_ApercuFichier.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
this.TxtBox_ApercuFichier.Size = new System.Drawing.Size(702, 21);
this.TxtBox_ApercuFichier.TabIndex = 12;
即使将 wordwrap 设置为 false,结果也是相同的。
(我的文本框位于组框中)。
有什么想法吗?
多谢 :)
Regards,
您需要执行以下操作才能在 Windows 窗体文本框中显示水平滚动条:
this.TxtBox_ApercuFichier.Multiline = true;
this.TxtBox_ApercuFichier.WordWrap = false;
this.TxtBox_ApercuFichier.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
然后,您可以调整文本框的大小以呈现一行的外观。你需要有Multiline
启用,否则文本框的高度将设置为文本高度(我似乎找不到一种简单的方法来覆盖它),因此您无法看到滚动条。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)