This is a migrated thread and some comments may be shown as answers.

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

1 Answer 139 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 31 Mar 2017, 08:20 PM
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);

        }

1 Answer, 1 is accepted

Sort by
0
Accepted
Ralitsa
Telerik team
answered on 03 Apr 2017, 09:31 AM
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.
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Share this question
or