当其中一个单词包装时,我如何使文本框调整到一起。我正在使用边框,我需要文本框是相同的大小,因此边框正确排列。我使用活动报告7,并有一个子报告,其中包含几个文本框控件对齐水平彼此。就像这样。
[Textbox1 ][Textbox2 ][Textbox3 ][Textbox4 ]当textbox1 word包装时,我的结局是这样的
[Textbox1....][Textbox2 ][Textbox3 ][Textbox4 ]
[..2nd line. ] 我尝试过在format事件中设置textbox大小,但这不起作用。因为文本框还没有调整大小。
Private Sub Detail1_Format(sender As Object, e As EventArgs) Handles Detail1.Format
'Resize all the texboxes so when the description WordWraps all the other texbox borders line up correctly.
TextBox1.Height = TextBox1.Height
TextBox2.Height = TextBox1.Height
TextBox3.Height = TextBox1.Height
TextBox4.Height = TextBox1.Height
TextBox5.Height = TextBox1.Height
TextBox6.Height = TextBox1.Height
End Sub发布于 2014-07-14 08:53:39
如果使用"Format“事件根据第一个文本框的高度设置其他文本框的高度,则不会得到正确的结果。我建议您使用"BeforePrint“事件来设置高度。
public void Detail_BeforePrint()
{
this.TextBox2.Height = this.TextBox1.Height;
this.TextBox3.Height = this.TextBox1.Height;
}希望这能有所帮助。
发布于 2016-08-12 17:55:28
Sankalp是正确的,您应该使用BeforePrint事件,因为高度尚未在格式事件中确定。
如果你知道TextBox1的高度总是最大的话,他的答案很好。但是,如果您不知道最大文本框的高度,则只需将所有内容设置为详细信息的高度即可。
public void Detail_BeforePrint()
{
this.TextBox1.Height = Detail.Height;
this.TextBox2.Height = Detail.Height;
this.TextBox3.Height = Detail.Height;
}使用此方法,您将不再需要返回重构高度。
https://stackoverflow.com/questions/24679590
复制相似问题