I created a Windows application in VS 2013 on W7. It's running great and no issue but recently I bought a new W8 laptop and tried to run the application on W8. All my controls are misaligned and some overlap. AutoScaleMode is set to Font for each form.
Examples:
It's not Windows 8 that's the problem, but a higher DPI setting.
The best option would be to switch over to WPF, but the problem can be mitigated with some care. You might consider a TableLayoutPanel for this application (it looks table-ish to me).
If you can't/won't use a layout panel, set the AutoScaleMode property of your form (and other containers, like Panels) to Font. If that doesn't work, try Dpi. See the MSDN page on that enum for more information.
Further StackOverflow reading (or "works cited"): "Creating a DPI-Aware Application" and "How to control the font DPI in a .NET WinForms app"
Related
I am building my first "real" VB Window Forms Application (I'm a "traditional programmer") and my application has perhaps half a dozen forms.
On execution all of these forms have the Windows 10 visual style (eg: grey on white max/min/close buttons at top right)... except for 1 form, which seems to be rendering in Win XP style (eg: Blue and red button style).
I have checked that "Enable XP Visual Styles" is UNClicked in the Project Properties, but this one form stubbornly refused to change.
I have a number of my forms that also appear in "XP style" in the VS Designer, but execute fine.
I suspect I may have enabled/disabled the "XP Visual Styles" option a couple of times, and perhaps initially created some forms when this was in different states... although I have no idea if this would have been the cause.
I really want this one form to be like all the others...
any ideas please? I am using VB in VS2010 (a bit old, but what I have to hand)
As I am quite new to VB so tell me what I can provide to help..
Many thanks,
David's comment has solved my immediate issue:
The single form appearing differently is indeed using Show() whereas the others are all ShowDialog(). There is no reason for me doing this, so I have changed it.
I have a windows form in my vb.net application which has recently started resizing itself dependant on the computers screen resolution.
I would like the form to be a fixed width and height - how can i make it do this and not resize itself?
You may try to change the property AutoScaleMode.
The default is FONT (the correct to most different systems DPI), but you may try other options there.
UPDATE
I saw now you may set the PROPERTIES of a file in the DESKTOP to "Deactivate Dimmension in High-DPI Settings" (it´s translated from Portuguese, my system). Click in the desktop application´s properties (its icon) and go to COMPATIBILITY TAB.
It´s not a .NET solution but if Windows had put it there, is because it´s possible the only way to set it.
I am new in VB application and can't figure out what's wrong with my app. There is a form which has a couple of labels and text fields. When I run the app on my and few other folks's machines it displays fine with proper alignment and font. However, for some people application form UI is broken unaligned text and buttons. Any one have any idea what's wrong with my application?
Okay, After some research, we found that the display settings for those users were set to 125% and because of that there were UI issues. I changed the display settings back to 100% and Booom it works just fine. Thank you all for you help.
This problem can occur for a number of reasons.
In my experience, however, it is commonly caused by setting the Font on controls, only to discover that certain users do not have that font installed on their machines. As a result, Windows forms selects a font for you that it believes is a close approximation--usually with horrifying results. Widths don't match, and controls end up horribly aligned.
Make sure you are not using a font that is not built into the OS. If you are designing the application in Windows 7, for example, and shipping to multiple platforms (Windows 2000, Windows XP (the horror!), and Windows 8), you may find that font availability is drastically different on these various platforms.
Though not aesthetically pleasing, stick with the lowest common denominator in these cases. If you can, use Segoe UI, which should be present on all these platforms (except XP) and which Microsoft now recommends.
I am updating a Visual Basic Windows Forms application that was written for Windows XP.
What form property do I set to tell a windows form to accept the default Windows 8 / 10 flat theme? Is it a global setting per application or a per-form setting?
The main form and some child forms of my application look fine with modification.
However, some of my child forms still have Windows XP/7's textured look:
I read some posts that point to "EnableVisualStyles = true". However that question was asking how to get the Windows XP styles, rather than Win 95/95 styles. I need some clarification on what the setting should be for newer Win 8 / 10 theme.
MDI Child forms are a special type of form that is not considered a TopLevel form, and windows themes only affect TopLevel forms.
Microsoft has been deprecating the use of Multiple Document Interfaces (MDI didn't even get written into WPF) in favor of Tabbed interfaces.
I recently upgraded my system to Windows 7 Professional. Furthermore, I recently upgraded from VB6 to VB.NET and I've been working with forms and control under the new interface. Controls such as text boxes and tab controls are washed out and very difficult to see.
In my attempt to remedy the situation, I personalized my display by unchecking the box under "Windows Color" entitled "Enable transparency" and adjusting the Color Intensity slider all the way to the right. But no matter what I try to do, I still get washed-out form colors.
Is there a setting for adjusting the default form colors? What am I missing?
It seems to me that you have a couple of choices, all of which you probably won't like.
Change your Textbox BorderStyle from Fixed3D to FixedSingle, this will give you a more pronounced border around the textboxes (no such property on comboboxes though). This will also make your textboxes look a lot more 'flat', which you may not want.
Change either the background of your form or the background of your controls, thereby providing a better contrast between the two. Even slight variations on the same color would help.
Purchase (or make your own) custom controls that have built-in style changing abilities. I use the Telerik controls sometimes. They have the ability to let you change the UI Element's styles, including all kinds of colors and different borders and such. The issue with this option is a lot of these custom controls are overly expensive, although you can find decent ones for fairly cheap sometimes (I found a control set once that was pretty nice for $19).
Whatever you decide to do, you have to remember that your form will look different to users that are using different operating systems than what you're developing on. You noticed a big change when you went from (I'm assuming) Windows XP to Windows 7 right? You have to remember to test your application on all operating systems that your application will be expected to run on. You could design it beautifully on Windows 7 and it may look horrible on XP. You may be able to ignore OSs that are older than XP, but for the time being almost 50% of users still use XP (last I checked).
BTW, there is no setting for adjusting the default form colors... this just happens to be how forms look on Windows 7. I found it an adjustment when I went from XP to Win7, but you get used to it. I very rarely make the background of my controls the same color as the background of my form just because of this... oh, and don't go changing your display, you want to see what your users are going to see - otherwise you'll end up with something that only looks good on your computer. :)