Don't show "Are you sure" when closing

edited 12:19PM in FastReport .NET
Hello,

I store my reports in a database. This must be transparent to the user. However, when the designer is open and the user closes the window, a message asks for confirmation "Save changes to ...". How do I delete this confirmation?
Is there a complete example for storing reports in a database? The one described: https://www.fast-report.com/en/forum/index....67&hl=store is really limited and always refers to files.

Comments

  • edited October 2018
    just an idea, hide built-in menu/toolbar item and create your own custom function.
    using (FastReport.Report report = new FastReport.Report())
    {
        using (FastReport.Design.StandardDesigner.DesignerForm designer = new FastReport.Design.StandardDesigner.DesignerForm(false))
        {
            designer.Designer.Report = report;
    
            // Ribbon User Interface
            FastReport.DevComponents.DotNetBar.RibbonControl ribbon = designer.Controls[2] as FastReport.DevComponents.DotNetBar.RibbonControl;
            FastReport.DevComponents.DotNetBar.ButtonItem btnSave = ribbon.Items[0].SubItems[0].SubItems[0].SubItems[0].SubItems[2] as FastReport.DevComponents.DotNetBar.ButtonItem;
            btnSave.Visible = false;
    
            // Standard User Interface - Menubar
            designer.Designer.MainMenu.miFileSave.Visible = false;
            designer.Designer.MainMenu.miFileSaveAll.Visible = false;
            designer.Designer.MainMenu.miFileSaveAs.Visible = false;
    
            FastReport.DevComponents.DotNetBar.ButtonItem miCustom = new FastReport.DevComponents.DotNetBar.ButtonItem();
            miCustom.Text = "Custom Menu Item";
            miCustom.ButtonStyle = FastReport.DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
            miCustom.Click += delegate {
                Console.Beep();
            };
            designer.Designer.MainMenu.Items[0].SubItems.Insert(2, miCustom);
    
            // Standard User Interface - Toolbar
            FastReport.Utils.Config.DesignerSettings.DesignerLoaded += delegate
            {
                FastReport.DevComponents.DotNetBar.Bar toolbar = designer.Designer.Controls[10].Controls[0] as FastReport.DevComponents.DotNetBar.Bar;
                (toolbar.Items[2] as FastReport.DevComponents.DotNetBar.ButtonItem).Visible = false;
                (toolbar.Items[3] as FastReport.DevComponents.DotNetBar.ButtonItem).Visible = false;
                FastReport.DevComponents.DotNetBar.ButtonItem buttonCustom = new FastReport.DevComponents.DotNetBar.ButtonItem();
                buttonCustom.Text = "Custom Button";
                buttonCustom.Image = FastReport.Utils.Res.GetImage(2);
                buttonCustom.Tooltip = "Custom Button";
                buttonCustom.Click += delegate {
                    Console.Beep();
                };
                toolbar.Items.Insert(2, buttonCustom);
            };
    
            // Show designer
            designer.ShowInTaskbar = true;
            designer.ShowDialog();
        }
    }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.