Designer and Export in VS 2015/2017 in High DPI doesn't work

2 posts, 1 answers
  1. Tim
    Tim avatar
    2 posts
    Member since:
    Oct 2014

    Posted 31 Mar 2017 Link to this post

    I've upgraded multiple machines and installed multiple version of Visual Studio and Telerik Controls to no avail.  The designer is almost completely useless to use. I can't size anything correctly and all controls are very small.  Then when running my application, if I use the GridViewSpreadExport/Renderer, the entire application goes into "TinyFont" mode and nothing is scaled properly.

    I've attempted all fixes I can think of, but there is no code that I'm writing that should cause any of this.  I've attached images.  Any help is appreciated.

    Tim
    -- Below is the code that causes issues with scaling after spreadsheet export:

     private void rbExcel_Click(object sender, EventArgs e)
            {
              
                this.progressBar.Visible = true;
                if (File.Exists(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx"))
                {
                    File.Delete(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx");
                }

                var spreadExporter = new GridViewSpreadExport(this.rgvWorkEfforts);
                var exportRenderer = new SpreadExportRenderer();
                spreadExporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.ExportAsHidden;
                spreadExporter.AsyncExportProgressChanged += spreadExporter_AsyncExportProgressChanged;
                spreadExporter.AsyncExportCompleted += spreadExporter_AsyncExportCompleted;
                spreadExporter.RunExportAsync(BusinessLogic.MyDocFolder + "MyTimeExport.xlsx", exportRenderer);

            }
  2. Answer
    Ralitsa
    Admin
    Ralitsa avatar
    190 posts

    Posted 03 Apr 2017 Link to this post

    Hello Tim,

    Thank you for writing us. 

    The export providers(GridViewPdfExport, GridViewSpreadExport or GridViewSpreadStreamExport) utilize Document Processing libraries (DPL). These libraries can change the DPI awareness of the application at runtime because the are referencing assemblies which are used in WPF.

    If your WinForms application is not a DPI-aware, the application may become DPI-aware at run time (when the DPL functionality is used). If you intend to use your application on machines where the DPI scaling is larger than 100% you should explicitly set the application to be DPI-unaware:
    private void radButton1_Click(object sender, EventArgs e)
    {
        SetProcessDpiAwareness(_Process_DPI_Awareness.Process_DPI_Unaware);
      
        GridViewPdfExport exporter = new GridViewPdfExport(this.radGridView1)
        {
            HiddenColumnOption = HiddenOption.DoNotExport,
            HiddenRowOption = HiddenOption.DoNotExport,
            ShowHeaderAndFooter = true,
            SummariesExportOption = SummariesOption.ExportAll,
            ExportVisualSettings = true,
            FitToPageWidth = true,
        };
        exporter.RunExport(@"..\..\GridViewPdfExport.pdf", new PdfExportRenderer());
    }
      
    [DllImport("shcore.dll")]
    static extern int SetProcessDpiAwareness(_Process_DPI_Awareness value);
      
    enum _Process_DPI_Awareness
    {
        Process_DPI_Unaware = 0,
        Process_System_DPI_Aware = 1,
        Process_Per_Monitor_DPI_Aware = 2
    }

    More information how to make a DPI-aware application can be found on the following links: WinForms Scaling at Large DPI Settings–Is It Even Possible?

    In regards to your issue at design time, it is recommended to edit the designer file under 96 DPI (100 %). More information about Microsoft`s guidelines can be found here: 
    I hope this information was useful. Should you have further questions please do not hesitate to write back.

    Regards,
    Ralitsa
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top