Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
5.00/5 (5 votes)
See more:
Hello,

I was developing a GUI for a software on WinXP platform but recently shifted to Win7.
Running it on win7 resulted in scaling of the form/usercontrol but not the graphics drawn. Now, this is creating problem.


Situation : :~
GUI Form has a panel with a grid drawn (Graphics) on it.
A UserControl is added to that panel. Usercontrol has a "Label" and there is some text written on that label.


Problem : :((
The original User Control looks like this in VS IDE.
image1: http://img821.imageshack.us/i/45653419.jpg[^]

Running it on WindXP showed the control as required:
image2 : http://img6.imageshack.us/img6/9275/bb3m.jpg[^]

Executing it on Win7 resulted in the following 2 situations.
case1 : [AutoScaleMode = Font]
It gets scaled and goes out of the specified size of 4x2 grid blocks
As scaling is nonuniform in hight and width, the UserControl rectangle becomes out of ratio.
image3: http://img146.imageshack.us/i/bb1px.jpg/[^]

case2: [AutoScaleMode = None]
UserControl dont get scaled up, text still gets bigger and thus not completely visible.
image4: http://img301.imageshack.us/i/bb2w.jpg/[^]

On runtime the AutoScaleFactor was (1,1) on all cases


Help Required: :confused:
How to make the font size same as during the design in VS-IDE. (image1)
There is no problem, if the software becomes of fixed size and fixed font size.
Or some other way around to make everything looks appropriately scaled (keeping the original size ratio).
Do i need to scale the grid in background as well ?


Thanks already.
Posted
Updated 12-Jan-17 5:56am
Comments
Abhishrek 27-Oct-10 10:43am    
Hello People ... anyone have any idea ?
Jason C Daniels 17-Jan-11 0:52am    
Check to make sure that the same font is being used in both WinXP and Win7. If it isn't then coerce the same font, and point size to be used. Also make sure you're running at the same DPI for your desktop too. (Between XP and 7)
Abhishrek 17-Jan-11 3:22am    
Thanks Jason.
The problem was long ago, I couldn't wait much, so i [AutoScaleMode = None] and fixed the font size manually in constructor it worked fine (if someone if not going to use it in considerably changed DPI monitor, which is not likely).

Thanks anyway.
Marco Bertschi 1-Feb-13 15:47pm    
Can you post it as solution so people can see that it has been solved?
Suvabrata Roy 18-Apr-17 11:59am    
Image links are broken...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900