image and textboxs look weird in c# - c#

when I compile the program sometimes it looks like the top image and sometimes like the one on the bottom and I have no clue why
the text on the right is a simple textbox and picture on the left is a metroTile from metroFramework I'm using visual studio 2013, and the project is Windows form application
EDIT: i have a base form that every form inherit from it and this appears normal on all other windows, only on this windows which the main window it looks like this

Related

Form controls selection problem/bug on Visual Studio 2019

I experience a strange bug on Visual Studio 2019, and I want to know if you can reproduce it too on your project.
Usually, if you click on the form and then start dragging the mouse, you will see a selection dashed rectangle that shows which controls on the form will be selected. The problem I see is that if my Form is pretty large, for example 1900x995, then when I click and drag with the mouse on the right bottom area of the form, the selection rectangle is cut in the middle.
See this picture for better understanding:
https://i.ibb.co/xzZLfsD/VS219-Form1-Selection-Bug.jpg
If my calculations are right, then it looks like the selection rectangle is cut at about 1570x846 (if the Left-Top of the Form is 0x0).
To reproduce it, open a new project of type:
C# Windows Forms App (.NET Framework) A project for creating an application with a Windows Forms (WinForms) user interface.
Important note: It's not happening if I choose C# "Windows Forms App (a project template for creating a .NET Windows Forms (WinForms) App)".
Set the Form size to 1900x995, then click any point on the bottom-right area of the form, and start dragging with the mouse to the bottom right corner of the form.
Do you see the selection dashed rectangle cut out in the middle?
Please let me know, I want to know if it's happening only on my installation, or is it a bug in the Visual Studio 2019 itself.
If you have other version of Visual Studio, for example VS-2017, or VS-2020, please check it also. Maybe this problem occurs in other versions too and not only in 2019 version.
Thanks.

Form in a C# application not using the default style

I'm having a strange issue where a form in a C# application isn't using the normal system style. I want it to look the same as any normal Windows application, the same way it looks in the designer:
The form in the designer
But when I actually run the program, it looks like this instead:
The form when the program is run
I know that the title bar is supposed to be a different style, that's fine, but the style of the buttons and checkboxes, etc is different to how it's supposed to be. Can someone help?
Thanks

Windows Forms app looks different from Visual Studio designer view [duplicate]

This question already has answers here:
How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?
(6 answers)
Closed 4 years ago.
I am trying to create a Windows Forms app using Visual Studio 2017. The app should be run on a 1024x768 touchscreen eventually, that is why I am trying to make all forms in size 1024x768 and without a form border. The problem is that when I launch the app the buttons seem to shift slightly and this makes them fall partially off the screen. The text also seems to be displayed in reduced quality and/or another size. You can look at the images below as an illustration of what I mean.
This is what the form looks like in the designer view in Visual Studio. The text is clear, everything fits the screen and all text fits in the buttons
Designer view of the form:
This second picture shows the form when I actually launch the app. The text quality is reduced, the 'Add From' text does not fit inside the button anymore and the bottom two buttons are partially off the form.
View of the form when app is launched :
My form is set to AutoScaleMode: Font, AutoSize: False.
Are these form parameters wrong or is it something in my Visual Studio settings? I have no clue what I could do to fix this.
Thanks in advance.
The resolution differences looks like a DPI issue. Windows Forms doesn't scale well to a DPI other than 100%. Check your monitor settings.
In Windows 10, this is labelled "Change the size of text, apps, and other items" in Display Settings.

MDI Child Form is scaling to the wrong size

I have an old C# winforms project I have support for several years now. In this project there is a main form that is an mdiparent and each other form is a child that fits inside the blank area of the parent. This has never been a problem.
Now I am trying to make modifications to this app again, but I do have a newer version of Visual Studio (2015) than I used to. So there is only ONE child form in this app that is giving me trouble. If I revert all my code, open the project, build, that form will appear/scale correctly. If I revert all my code, open the project, open the UI of the form, build, it will shrink the child to a smaller area inside the parent. It only happens on this ONE form, the rest work fine.
I have tried messing with all forms of autosizing, scaling, window size settings, etc but I think its something in VS that is causing just that one form to auto scale incorrectly and I'm not sure what it is. If I look at the auto generated code and compare it to the other forms it will set AutoScaleBaseSize to (6,15) but other forms are at (5,13). If I do like I mentioned above and revert the code but do NOT open the form, the autogenerated code for that form is (5,13) like the other forms.
What is happening in Visual Studio to change this AutoScaleBaseSize property and how can I find the culprit?

C# Winform Control Dimensions Strange Out Of Editor?

I've run into this weird sizing issue for my windows form application when run. Now in the designer the program looks like This1 (can't upload more then 2 links so look in comments). However when I run it from visual studio it looks like This (notice how all the controls are closer together, the picture box is automatically wider and taller & the picturebox in tileset subform is larger).
When built and run outside of Visual Studio from the bin\debug folder, it looks perfectly fine (as it would in Visual Studio like This). However I recently changed the build folder to one with a shorter path and when I now run from there the entire form looks much larger and the picturebox is again scaled in this2 (can't upload more then 2 links so look in comments).
take a look at this similar question.
Did you try to set the dpi awareness in the manifest as in the question above?
Also be sure, you run both (visual studio) and the .exe from
bin/debug as the same user (ex. run as Administrator).
And if it's not to late, consider a change to wpf, it responds much better to the different screens and different resolutions - at least in my opinion and experience.

Categories

Resources