Why my WinForms appear all congested in [Design] mode VS2015 - c#

I am developing my app on two different PCs, both having Windows 10 and Visual Studio 2015 installed using the same installers. When I open some of my WinForms in lab PC, the controls included in the WinForms appear all congested together (and even overlapping each other) making it impossible for me to modify the visuals. This happens only in "design mode". When i run the app, all forms appear correctly. Kindly see the difference in attached pic
This happens only for a few of the forms, not all. But despite comparing each and every form property (including "AutoScaleMode" which is set to "Font" for each form), i couldn't locate the cause. The other PC is showing all the forms 100% correctly in design mode.
What could be the possible reason/solution?
EDIT: Solution discussed here also has no effect in my case, whereas other posters said that their issue was resolved by changing the DPI-awareness of their PC.

This happens when your application is not responsive to different sizes of the display! you need to set the Anchor and Dock properties in winform.
Make it responsive but the best solution is to develop the application on WPF.
Thanks

Related

WPF controls in user input form visually corrupted

I have a a desktop application (C# Net 4.5) that contains a number of wpf input forms for user input. I have recently experienced corruption on the screen with some of the wpf controls as illustrated:
Buttons, comboboxes, radio buttons and checkboxes are all affected (a checkbox disappears when mouse hovers over it - see missing 'Deductible expense' checkbox in illustration)
The result is the same when running from within VisualStudio19 or running the separate .exe application.
Has anyone else experienced this behaviour and can suggest a fix?
I received an answer to this from a Microsoft Q&A:
Microsoft Q&A
Disabling a sound driver called Nahimic (through System Configuration to prevent it re-loading after a shutdown) fixed the distortion issue. Quite why a sound driver should affect visual rendering of the UI is beyond me, but the fix worked.
Thanks for providing the Microsoft link.
I did not have Nahimic installed, but I do have Sonic Studio.
Once I shut Sonic Studio down, the WPF distortions seem to have disappeared.

winform and control size is changed by itself

i'm developing c# winform application, and having some sizing issues.
working env. :
developing on macbook, using vmware running windows 7, with visual studio.
also using infragistics winform controls.
the problem is that every time i'm opening the project, the size of the main form is changing, also the size of several controls in it is being changed.
so, i need to resize everything manually, before publishing the project.
this is very annoying, and i can't figure out what is causing this.
did someone here having the same issue, is there anything i can do to stop this?
thanks.
I have seen similar issues when windows default font size is changed in Control Panel Display settings. It probably has something to do with the Form's AutoScaleMode.
Is it changing by a lot or a little? Is it one pixel or is it a huge difference?
There were some known issues with UltraToolbarsManager in certain styles where opening the form in the designer changed the size of the form each time, but it was a very small change and it was consistent - meaning that the form would always get a little bigger or a little smaller each time.
These issues are all fixed in the latest version as far as I know.

Visual Studio display glitching out

I'm having a persistent problem with my VS2010. After working for a while, the display will start to glitch out. The code all shows as black-on-black (I use a dark background because it's easier on the eyes, but even when I switched to the default, it just makes the text white-on-white instead.) All tooltip hovers appear in the upper-left corner of the screen instead of where they're supposed to. If you select text, the code that gets selected is nowhere near where you clicked the mouse. (Not that you can read the text anyhow since it's the same color as the background.) And none of the dockable panels will appear or if they do they're all glitched out as well. The only solution seems to be closing the program and restarting it. I've been using this copy of VS2010 for years without issue, and my other projects don't seem to have any problems. This one is C#, uses a lot of Windows Forms (not WPF), has some customized Controls, but otherwise isn't all that unusual. I have the following extensions:
CodeMaid
CSharpIntellisensePresenter
InheritanceMargin
ProductivityPowerTools
Tunnel Vision Labs Output Window Services
WatermarkTextBox Control
Some of these are recently installed so they may be the culprits. Has anyone had any display problems with any of these extensions? I can live without most of them, but I'm not sure if it'll make a difference. There's no easy way to test it either, as the glitch only shows up every couple of hours or so.

C# Web Form button size change when running from different OS

I can not figure out why my web form buttons change size when I run the web form from Windows 7 vs. Windows Server 2003. I have set the positioning and size on page load for all objects. Here is an example of a couple of the objects I am using.
Label1.Style.Add("Position", "fixed");
Label1.Style.Add("TOP", "20px");
Label1.Style.Add("Left", "50px");
btnQuery.Style.Add("Position", "fixed");
btnQuery.Style.Add("TOP", "370px");
btnQuery.Style.Add("Left", "198px");
The buttons have the same 3 entries. When I run this from my local Windows 7 PC, everything looks great. However, when I publish this to my Server 2003 site, the buttons are about 5 times longer and cover each other up. My label, textbox, and listbox are all fine as well. It is just the buttons. Is it because I am developing on Windows 7? Also, I am doing this in Visual Studio 2010, Framework 4.
They are changing because you are giving the size in pixels. If users have different screen resolutions, then it will change how large the buttons are in relation to the screen. Use relative sizing to fix this. This is not OS dependent, may just seem like it.
You're only setting the top/left position of the button, but not the size... If not specified, then web browsers are free to make buttons look however they want.
Assuming that this Style.Add method actually translates to CSS, try adding:
btnQuery.Style.Add("height", "120px");
btnQuery.Style.Add("width", "300px");
Then tweak those so its the size you want.
Generally, I'd advise against using fixed positioning at all, but that is a different story.

WPF form displaying as winform

Sorry this is probably a really silly question but I am developing a WPF form on a Windows 7 machine with VS2010 yet when running the application the form still looks like a standard WinForms window.
I am assuming that it requires an extra component installed on the system to be displayed as shown in the designer?
PS: To be more specific what I am referring to is basically the outline and border.
No, what you are experiencing is totally normal. Unless you have altered the default style of your controls, your application will be drawn using windows default look and feel.
That border is just for design purposes. But you could add your own Border to recreate it during runtime.

Categories