Forms are resizing when opening a form wit LighteningChart

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

RobotGuy
Posts: 1
Joined: Thu May 31, 2018 11:50 pm

Forms are resizing when opening a form wit LighteningChart

Post by RobotGuy » Fri Jun 01, 2018 12:06 am

Hello, I am testing out the trial version of the software for our .net winforms application. I was able to successfully add a LighteningChart to a test form today while at my work PC. I have come home to continue working on the project using my home laptop. It is a surfacebook with a much higher resolution. When I open the form with the Lightening chart on it the application will suddenly shrink all the forms, or at times shrink all the controls on the other forms while leaving the size the same. I did not have any form resizing issues on the work PC.

I tried removing the LighteningChart and re-adding it to the form to see if this autoscaleing behavior would go away, but it did not.

I am attaching screenshots showing the form sizes changing when the test form with LighteningChart is opened.

Is there a setting that needs to be set in order to stop this behavior from happening?

Cheers,

Matt
Attachments
_shrunken_forms.jpg
_shrunken_forms.jpg (95.37 KiB) Viewed 3215 times
_RegularSize.jpg
_RegularSize.jpg (111.12 KiB) Viewed 3215 times

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: Forms are resizing when opening a form wit LighteningCha

Post by ArctionKestutis » Fri Jun 01, 2018 9:33 am

Hello,

When having any mystic problem with the chart, ensure you have a working error/exception handler (subscribe to _chart.ChartError event) in your application which brings those errors visible for the user and tells the reason.

In this case most likely you will get warning about DPI awareness (and your monitor Scale/zoom factor is >100%). When the LightningChart is created it loads some WPF libraries and because of this the DPI awareness of the application is automatically changed to the WPF default of system aware, and the DIP-PX factor is changed to that defined by windows settings.

The longer answer is given here.
In short, you need to create application manifest file and set <dpiAware>true</dpiAware>.
You can add a manifest to your C# application by following these steps:
a. Right-click on your project in the Solution Explorer.
b. Select "Add New Item" from the context menu.
c. Choose "Application Manifest File" from the list of options in the dialog box that appears.
d. Next open ‘app.manifest’ file, search for ‘dpiAware’ string, uncomment relevant part and set DPI-awareness in a way you want.

Hope this helps.
All the best.