07-20-2011 05:03 AM - edited 07-20-2011 05:04 AM
Hello everyone,
how can I maximize a panel maintaining the correct aspect ratio?
Thanks
07-20-2011 05:10 AM - edited 07-20-2011 05:12 AM
you might combine GetPanelAttribute (, ATTR_HEIGHT, ) and GetPanelAttribute (, ATTR_WIDTH, ); with SetPanelSize (, , );
07-20-2011 05:17 AM
Hi,
this can't be done automatically, since when you enable panel sdjust on rescaling and maximize it it will scale each dimension independent from the other. That is, a panel developed for a 4:3 resolution will appear stretched if maximized on a 16:9 screen.
If you have only a few controls on the panel you could disable automatic rescaling and add an horizontal and vertical hidden splitter attaching all controls to them. When you want to maximize the panel you will need to calculate the necessary adjustment on each dimension and move the splitters accordingly with OperateSplitter so that they resize the controls. Next you can maximize the panel.
In case you have a lot of controls attaching all them to the splitters can be a hassle; in this case you can enable resolution adjustment, change panel sizes calculating the maximum dimensions that respect aspect ratio, next disable resolution adjustment and finally maximize the panel.
07-20-2011 07:45 AM
Thanks a lot guys !!!
07-21-2011 02:54 AM
Hi to all!
Roberto always gives excellent solutions. Let me share with you an additional document concerning a similar issue. I hope it could help in future:
How to Programmatically Maximize or Minimize your CVI Panel
Have a great day!
Best regards
07-21-2011 03:05 AM
Let's hope nobody is using DOS compatibility windows anymore...