Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio controls re-size for desktop DPI

I have a question related to the controls in Measurement Studio Ver:7.0.0.341.

I am using a graph control (AxCWUIControlsLib.AcCWGraph) and this works fine on other PC's and other languages; except those with a verying DPI. The default setting is 96. Anything larger and the graph control, and AxCENumEdit controls, enlarge to a point that the graph control is no longer within the scope of the form. This problem also manifests itself on widescreen notebooks (the screen drivers must use a different DPI setting). This problem makes our software un-usable for any customers with a different DPI setting or a widescreen notebook. I have been unable to fix the size of the controls.
(You change the DPI settings by opening 'Display' from control panel: Settings -> Advanced.)
I hope you can help.

Cheers
Rob Bartholomew.
0 Kudos
Message 1 of 2
(3,063 Views)
This is a general issue with using ActiveX controls in .NET forms. ActiveX controls persist their size in resolution-independent coordinates called twips. This causes the ActiveX controls to draw at the same size, regardless of device resolution. Using twips worked out OK for ActiveX controls because all of VB6 worked in twips. This doesn't work out OK in .NET because the .NET Form and other native controls use pixels. So, what is happening is that the ActiveX controls are scaling according to dpi, but the .NET controls are not.

The workaround that I recommend is to reverse the dpi scaling in the form constructor. It would look something like this:



Graphics graphics = this.CreateGraphics();
float scaleX = 96.0f / graphics.DpiX;
float scaleY = 96.0f / graphics.DpiY;

axCWGraph1.Scale(scaleX, scaleY);



This would not be an issue for your graph if you were to use one of the native .NET graphs instead of the ActiveX graph. I understand that you have a CWNumEdit control on the form as well and that there is no native .NET numeric edit control in Measurement Studio 7.0. A native .NET numeric control was added in Measurement Studio 7.1, along with equivalents of all of the other ActiveX controls (except the 3D graph).

Is there a specific reason that you are using the Measurement Studio ActiveX controls instead of the Measurement Studio .NET controls?
0 Kudos
Message 2 of 2
(3,041 Views)