11-12-2008 09:03 AM
Is there any way to maintain the aspect ratio when using the resolution adjustment setting? We noticed that due to our application size (1024x768) under smaller resolutions it looks either stretched or squished together. Or is there any other way we can do this instead of using SetSystemAttribute command to set resolution adjustment to 100%.
11-14-2008 03:14 PM
Hello Karkala,
Could you perhaps post a pair of before and after screenshots? I tried to recreate what you were seeing, and did not notice anything that appeared overly stretched or squished. Also, are you mainly noting this issue in your text, or with other controls on the UI?
thanks,
NickB
National Instruments
11-17-2008 09:16 AM
Did you see this thread? I know it is not strictly tied to resolution adjustment settings, but may be of help.
Do you only see the squishing or stretching when you go to aspect ratios that are not 4:3? (If so, then 1600x1200 or 800x600 should work, but 1280x1024 and any of the many widescreen ratios do not)
--Ian
11-17-2008 09:28 AM
1280by1024.bmp is original with resolution adjustement. This is the resolution(1280x1024) I had my computer set to and compiled in.
1280by1024_2.bmp is after I added the resolution adjustment. The text labels on the bottom seem to have increased in size. Do I need to set a particular resolution as native so it doesn't apply any adjustment when using that resolution. Because I dont' see why the 2 screens are different when the program has been compiled in the same resolution.
800by600.bmp is with resolution adjustment and my monitor resolution changed to 800x600. Notice that the text and stuff seems to look ok, but the top of the screen is being hidden under the menubar. We also have another mini laptop which has max resolution of 1024 by 600. which does the same thing to the top of the screen. I can try to get some screen shots of this and post them later today.
11-18-2008 10:08 AM
Those screenshots do show some strange behavior. You need real NI help here.
In 1280by1024_2.bmp it looks like the NIDialog font (or similar) was mapped to a different size font. If that was on the same PC as the original (i.e. it had the same fonts installed so mapping from "NI fonts" to installed fonts should be the same) it really is unexpected to me.
The 800x600 shot brings up the whole question of expected behavior of the resolution adjustment attribute when aspect ratio changes either up OR down. I can't see any mention of it in the documentation. You might try turning off the resolution adjustment attribute, exiting CVI, resetting your screen resolution to 1024x768, loading the UIR in CVI, turning the resolution adjustment attribute on again, saving and then running at 800x600. Then it is a pure change of size (not aspect ratio) that you are testing. If that solves the band at the top we are sure it is aspect ratio related.
Hope this helps.
--Ian
11-20-2008 02:20 PM
Hello Karkala,
I'm sorry for the delay in my response. It turns out that some of the behavior you are seeing is indeed a bug. In particular, when you enable resolution adjustment, either the menu bar should adjust similar to the rest of the controls, or the panel area underneath the menu should not be considered when resizing. Either way, this has been reported for investigation with CAR ID 134165.
The only workaround I can think of would be to implement the sizing of your controls manually, with the assistance of the splitter controls. Attached below is a quick implementation of what this may look like for you. You could use splitter controls in conjunction with the SDK functions GetDesktopWindow and GetWindowRect, or GetMonitorInfo. The meat of the attached code can be seen below:
int main (int argc, char *argv[])
{
int panelWidth, panelHeight, splitterTop;
int error = 0;
double percentY, percentX;
HWND hwndDsktp;
RECT rcDsktp;
/* initialize and load resources */
nullChk (InitCVIRTE (0, argv, 0));
errChk (panelHandle = LoadPanel (0, "SplitterMenuBar.uir", PANEL));
/* note this may not produce desirable results with a multi-monitor setup */
hwndDsktp = GetDesktopWindow();
GetWindowRect(hwndDsktp, &rcDsktp);
/* Get necessary panel info */
GetPanelAttribute(panelHandle, ATTR_WIDTH, &panelWidth);
GetPanelAttribute(panelHandle, ATTR_HEIGHT, &panelHeight);
GetCtrlAttribute(panelHandle, PANEL_HEIGHTSPLITTER, ATTR_TOP,
&splitterTop);
/* Calculate the ratio the dimensions will need to shrink/grow */
percentX = (double)rcDsktp.right / OPTIMUMWIDTH;
percentY = (double)rcDsktp.bottom / OPTIMUMHEIGHT;
/* Shrink/Grow the panel */
SetPanelAttribute(panelHandle, ATTR_HEIGHT, (int)(percentY * panelHeight));
SetPanelAttribute(panelHandle, ATTR_WIDTH, (int)(percentX * panelWidth));
/* Change the position of the splitter's which have been linked to your controls */
OperateSplitter(panelHandle, PANEL_WIDTHSPLITTER, percentX * panelWidth);
OperateSplitter(panelHandle, PANEL_HEIGHTSPLITTER, (percentY - 1) * splitterTop);
/* display the panel and run the user interface */
errChk (DisplayPanel (panelHandle));
errChk (RunUserInterface ());
Error:
/* clean up */
DiscardPanel (panelHandle);
return 0;
}
For more information about these splitter controls, see the splitter example in the userint folder, and check out this help topic.
Also, with regards to the text changing simply by enabling resolution adjustment, I was unable to reproduce this. It is important to note that he resolution information is stored in the UIR file when it is saved, and not when it is built. What it looks like to me is that the UIR file may have been saved at 800x600 resolution? If this is not the case, could you let me know what font you are using so that I can try to reproduce again? Or, if you could supply a simple project I could look at, I would love to take a look at that as well.
Once again, I apologize for the inconvenience. Please let me know if I can be of any more assistance.
NickB
National Instruments