PrintPreview Print Settings

5 posts, 1 answers
  1. Jose antonio
    Jose antonio avatar
    1 posts
    Member since:
    Sep 2013

    Posted 05 Jul 2014 Link to this post

    How I can change the values ​​of the Style Settings section programmatically?
  2. Answer
    Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 09 Jul 2014 Link to this post

    Hi Jose Antonio,

    Thank you for contacting us. 

    You need to set the CellBackColorCellFont, CellPadding, etc. properties of GridPrintStyle. Please take a look at the following code sample: 
    private void radButton1_Click(object sender, EventArgs e)
            {
                GridPrintStyle style = new GridPrintStyle();
                style.FitWidthMode = PrintFitWidthMode.FitPageWidth;
                style.PrintAllPages = true;
                style.PrintGrouping = true;
                style.PrintHeaderOnEachPage = true;
                style.PrintSummaries = true;
     
                style.CellBackColor = Color.Aquamarine;
                style.CellFont = new Font("Arial", 13, FontStyle.Regular);
                style.CellPadding = new Padding(0, 0, 10, 0);
                 
                style.GroupRowBackColor = Color.HotPink;
                style.GroupRowFont = new Font("Arial", 13, FontStyle.Italic);
                 
                style.HeaderCellBackColor = Color.GreenYellow;
                style.HeaderCellFont = new Font("Arial", 12, FontStyle.Bold);
     
                style.SummaryCellBackColor = Color.DarkSeaGreen;
                style.SummaryCellFont = new Font("Arial", 12, FontStyle.Bold);
     
                this.radGridView1.PrintStyle = style;
                this.radGridView1.PrintPreview();
            }

    Please refer to our help articles GridPrintStyle and Events and Customization which demonstrate how you can customize print style of RadGridView.

    I've also attached a sample demo application. 

    Should you have further questions, I would be glad to help. 

    Regards,
    Ralitsa
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 24 Dec 2015 Link to this post

    Hi 
    Is it possible to access print setting form via code ? I want to modify some items on that form like it's font and right to left option but I do not know how to do that. I am looking forward to hearing from you.

  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Dec 2015 Link to this post

    Hello Aref,

    To introduce modifications to the dialog itself, you have to inherit from GridViewPrintSettingsDialog and in the inheritor to introduce the desired modifications. Then, create a factory which implements the IPrintSettingsDialogFactory interface and pass your dialog instance in the CreateDialog method. Finally, set an instance of your factory to the PrintSettingsDialogFactory property of RadGridView. Here is a sample:
    class MyPrintSettingsDiagloFactory : IPrintSettingsDialogFactory
    {
        public Form CreateDialog(RadPrintDocument document)
        {
            return new MyGridViewPrintSettingsDialog(document);
        }
    }
     
    class MyGridViewPrintSettingsDialog : GridViewPrintSettingsDialog
    {
        public MyGridViewPrintSettingsDialog(RadPrintDocument document)
            : base(document)
        {
        }
        protected override void LoadSettings()
        {
            base.LoadSettings();
     
            this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
        }
    }

    radGridView1.PrintSettingsDialogFactory = new MyPrintSettingsDiagloFactory();

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 25 Dec 2015 in reply to Stefan Link to this post

    Dear Stefan 
    Thanks for your useful information. It helped a lot.
    Sincerely yours
    Aref
Back to Top
UI for WinForms is Visual Studio 2017 Ready