configuring environmentsettings in code

edited August 2017 in FastReport .NET
Hi,

I currently try to configure the EnvironmentSettings in my code before I open the ReportDesigner, unfortunately it does not work as intendend.

1.) I only have to configure it once on startup and the settings will be applied whenever I open the designer. Is this correct?
            var settings = new EnvironmentSettings();
            settings.ReportSettings.ShowProgress = true;
            settings.ReportSettings.ShowPerformance = true;
            settings.DesignerSettings.DefaultFont= new Font("Segoe UI", 10);
            settings.PreviewSettings.ShowInTaskbar = true;
            settings.CustomSaveDialog += SettingsOnCustomSaveDialog;
            settings.CustomSaveReport += SettingsOnCustomSaveReport;

ShowInTaskbar doesn't work, the designer is not shown there and when minimized it still won't appear there.

Edit: I called settings.PreviewSettings.ShowInTaskbar = true; instead of settings.DesignerSettings.ShowInTaskbar = true; so this works now, so only the question below is relevant any longer.

2.) I have my own report format which contains the fastreport report. I load the data from database and open the designer from memory. When the designer gets closed I don't want it to ask me if i want to save the data instead I wan't it to pass the new report back to my program so I can handle the rest.

I hope you can help me thanks in advance.

Comments

  • edited August 2017
    Karlo wrote: »
    ...


    I solved the problem:
        ...
        {
            ...
            Config.DesignerSettings.DesignerLoaded += DesignerSettings_DesignerLoaded;
            Config.DesignerSettings.DesignerClosed += DesignerSettings_DesignerClosed;
            Report.ReportData.Design(false);
        }
    
    
        private void DesignerSettings_DesignerClosed(object sender, EventArgs e) {
            Config.DesignerSettings.DesignerLoaded -= DesignerSettings_DesignerLoaded;
            Config.DesignerSettings.DesignerClosed -= DesignerSettings_DesignerClosed;
        }
    
    
        private void DesignerSettings_DesignerLoaded(object sender, EventArgs e) {
            Report.ReportData.Designer.AskSave = false;
        }
    

Leave a Comment