FastReport .NET 如何调用(Invalidate)(重新渲染)进行预览?

问题描述 投票:0回答:1

我有FastReport社区

代码:

using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;

namespace FastReport
{
  public class ReportScript
  {

    
    
      private void Text2_Click(object sender, EventArgs e)
      {
        var obj = sender as TextObject;
        if (obj != null)
        {
          // Change the font size of the TextObject
          obj.Font = new Font(obj.Font.FontFamily, 15);
          

        }
      
      }

  } 
 
}

在预览中:当我单击 text2 时,没有任何变化。但如果我单击然后滚动或调整大小,所有内容都会改变。

如何调用此元素的重新渲染?

c# .net fastreport
1个回答
0
投票

您可以使用

Invalidate()
手动请求重画,如下所示:

private void Text2_Click(object sender, EventArgs e)
{
    var obj = sender as TextObject;
    if (obj != null)
    {
        obj.Font = new Font(obj.Font.FontFamily, 15);

        obj.Invalidate();
    }
}

如果您想了解更多有关其工作原理的信息,您可以访问此答案

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.