【问题标题】:Active Reports 7 Make texboxes resize togetherActivereports 7 使文本框一起调整大小
【发布时间】:2019-05-31 03:59:40
【问题描述】:

当其中一个自动换行时,如何使文本框一起调整大小。我正在使用边框,我需要将 texboxes 设置为相同的大小,以便边框正确排列。我正在使用 Active Reports 7 并有一个子报表,其中包含多个水平对齐的文本框控件。像这样。

[Textbox1    ][Textbox2    ][Textbox3    ][Textbox4    ]

当 textbox1 换行时,我会得到这样的结果

[Textbox1....][Textbox2    ][Textbox3     ][Textbox4    ]
[..2nd line. ]  

我尝试在格式事件中设置文本框大小,但这不起作用。因为 texboxes 还没有调整大小。

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

【问题讨论】:

    标签: report activereports


    【解决方案1】:

    如果您使用“格式”事件将其他文本框的高度设置为与第一个文本框高度一致,您将不会得到正确的结果。我建议您宁愿使用“BeforePrint”事件来设置高度。

    public void Detail_BeforePrint()
    {
        this.TextBox2.Height = this.TextBox1.Height;    
        this.TextBox3.Height = this.TextBox1.Height;
    }
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      Sankalp 是正确的,您应该使用 BeforePrint 事件,因为高度尚未在 Format 事件中确定。

      如果您知道 TextBox1 的高度始终是最大的,那么他的回答效果很好。但是,如果您不知道最大文本框的高度,那么您可以将所有内容设置为细节的高度。

      public void Detail_BeforePrint()
      {
          this.TextBox1.Height = Detail.Height;
          this.TextBox2.Height = Detail.Height;
          this.TextBox3.Height = Detail.Height;
      }
      

      使用此方法,您将永远不需要回来重构高度。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-07
        • 2016-09-27
        • 1970-01-01
        • 1970-01-01
        • 2011-11-02
        • 2019-08-28
        相关资源
        最近更新 更多