I have a strange problem. I have designed a windows form application in c# and .net framework 3.5. In the runtime, the form and its controls are fine in all the computers except my laptop, where the controls are not in the correct positions.
If I design the form from scratch on my laptop with correct positioning it will result in an invalid shape for other computers.
My efforts:
If I run the windows in Safe Mode the form size and control positions
are correct.
I have uninstalled the Video Driver and used default windows version but the problem still persists.
I used different frameworks like 2.0 and 4.0, and different Visual Studios versions and they all have the same problems.
Actually all the .net framework product from all the companies indicate the same issue.
My computer Settings:
Laptop 1557 Studio DELL
Graphic ATI Radeon HD 4500
When the text size is artificially increased to 125% text and controls that are rather closely placed will wrap around the form and push everything down/over. If this is something you intend to support, you'll simply have to redesign your form to handle the different enlargement levels you care to support and test those enlarged text modes in your app until you're satisfied with their appearance. It's not something you can strictly control, since increased text size is an accessibility feature.
I assume it is due to a screen resolution differences. I believe that the actual location of the controls is identical in both cases, in one the screen is "larger" and therefor your controls appear in a different position on the screen.
try Designing forms to work on different resolutions and aspect ratios on Windows CE
Another thing you can (and should) do is work with WPF, which is the new way to build user interfaces for windows.
I've found a workaround just now.
In the display settings of Windows 7 I have changed the Text size from 125% to 100%. Everything is smaller but in accurate positions and sizes.
Still wondering how it works!!
Related
I'm using Avalonia UI to create an application that is available for both Windows as well as macOS, and have come across the issue that, when using a macOS device that has a Retina display, the entire application is scaled up quite massively, estimated about two times. This means that my application, which, in its smallest form is about the size of the Windows Explorer default, actually falls outside of the screen on these Retina displays, which, of course, is not ideal.
Is there a solution?
i am working on visual studio 2010.
i created my master form windows state is Maximized
my system resolution is 1366X768 ,,in one button click i am calling 5 forms together into my master form.. but in my system everything getting correct..
but i installed the same application in my client system,,that system resolution is 1024X768
but here my alignment is not getting proper..now my image is getting like this:
so how i can fit my windows form application in all resolution,,if any one know please help me to find out
You basically have two options:
1) Follow Microsoft's instruction on implementing auotscaling for Windows forms applications. (See http://msdn.microsoft.com/en-us/library/ms229605(v=vs.110).aspx)
2) Write your own code to scale the form based on resolution.
============================
Other factors to keep in mind.
If you app is translatable that can affect scaling
A user changing the Windows default font size can have the same affect.
Hope this helps.
I have a .Net application that was originally created in Visual Studio Professional 2005, using the .Net 2.0 framework.
Recently, I have opened the project in Visual C# Express 2010, made some minor changes, and built it using .Net framework 4.0.
Everything works like a charm except for one quite annoying part. When I am running the application on a HP EliteBook 8740w, with a 1920x1200 screen, a group of GUI controls get shuffled around, so that they land on top of eachother. This error does not show up when running on my Windows 7 64 bit workstation with external display of 1900x1080 resolution. Neither does it show when running on a Windows XP laptop with 1024x768 resolution.
I have tried to connect a 1600x1200 external display to the EliteBook, but the error shows up there also.
The controls that get messed up are a set of comboboxes, numericUpAndDowns, and labels, laid out in a table layout container, that in turn is placed on a tab page in a tab page control.
I have tried creating a new tab page control and table layout container from scratch, and then moving the comboboxes etc into the new table layout container, but the error prevails.
I would really appreciate some help in this matter, because I don't know what else to try. I am starting to suspect that there is something wrong with the graphics on the EliteBook, but, then again, everything else renders nicely on its screen.
Thanks,
Fredrik Israelsson
--- Edit ---
Thank you for your quick answers. Before I had a chance to look at them, I think I solved the problem by myself. Stumbled upon a thread about why Visual Studio automatically changes sizes of controls although one has set anchor and dock properties to None. One of the answers mentioned the AutoScaleMode property. I changed AutoScaleMode from Font to None on my main application Window, and no the GUI renders nicely on all my computers.
Thanks again!
/Fredrik Israelsson
I suspect that this is because the two machines have different DPI settings. This is always a pain with Windows Forms.
Here are a few links that might help.
http://msdn.microsoft.com/en-us/library/ms229605.aspx
http://www.sellsbrothers.com/writing/winformsAutoScaling.htm
It could be related to Hardware Acceleration. Is your application a WinForms or a WPF one?
I have faced really odd behaviors when using VS2010 on Win7 64 bit only because it was trying to use Hardware Acceleration when I built the app.
Improving Performance by Changing the Visual Experience
You might have a problem with Hardware Acceleration in VS2010. I had an issue with rendering applications built using WPF because of this.
Give it a try: http://blogs.msdn.com/b/zainnab/archive/2010/06/22/improving-performance-by-changing-the-visual-experience-vstipenv0017.aspx
And if that doesn't fix your issue, go to your video card settings (nvidia or amd catalyst) and do a "reset settings" on the computer where the app doesn't correctly paint itself. Then try again.
Is there any easy way to run an application created in C# on Visual Studio 2005 on any different PC, regardless of its screen resolution?
Screen resolution?
Windows Forms in .NET 2.0 has some mechanisms for dealing with different DPI and it has a better layout system than in .NET 1.1. In general, use layout panels like FlowLayoutPanel, TableLayoutPanel, etc instead of fixing your controls at X/Y coordinates and you'll have a much easier time dealing with different window sizes.
If you can use WPF which I don't recall being applicable to Visual Studio 2005, then you have much more options for resolution independence. The DPI issue goes away and WPF has features such as ViewBox that lets you scale an entire window or control uniformly.
how to give size of a control in window mobile app dynamically,because i have developed one application,when i used to run that application on different emulator's ,the size of that control's in that application differ's for different emulator.so could u plz help me that how we can handle such issue in windows mobile application in which iam using visual studio 2008 and windows mobile6 classical emulator
Your question is a bit ambiguous, but I'll take a stab at it.
Apparent control size (how big it looks to your eye) if affected byt a few things. The obvious are things like Dock and Achor properties, which are well documented online and are the same as for the desktop. What is less obvious is scaling. Some PDAs have a 240x320 display, while others may have 480x640 yet with the same physical dimension screen.
The platform can attempt to have your single Form code work for both by doing "pixel doubling" which essentially just doubles all of your size values. This tends to end up with graininess and I think it was turned off by default starting with WinMo 6.
To adjust this behavior, you can adjust your Form's AutoScaleMode property.