Windows CE Form bug - c#

I'm developing WinForm applications to Windows CE device. I have got a bug, on the top of the form(all form) have a 20 px height and full width zone, with topmost behaviour and Control color background, with cursor. On Visual Studio design mode can't see it just only on the device. Question is how to disappear it?
Thanks a lot

I'm willing to be that what you have there is a MainMenu with no MenuItems in it. It will show up as a blank strip across the top of the Form and cover any UI elements, but it won't show up in the designer.

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.

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.

Maximize Entire Window Visual C#

I have an application designed in visual C# that is about a quarter of a normal computer screen. The reason its that small is because its easier to work with in Visual Studio. However, I would prefer if when I run it, it maximizes to the full screen. I tried this in my Main_Load:
this.WindowState = FormWindowState.Maximized;
This causes the window itself to maximize, but the application itself is still quarter of the screen. Is there a way to maximize the application itself, and not just the window?
I am guessing you have not docked or anchored any of the controls, meaning they will not move when the window is resized.
Have a look at docking here: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.dock(v=vs.110).aspx
And have a look at anchoring controls here: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor(v=vs.110).aspx
Both pages should help you understand how to make controls resize with the window.
Either you change the size of your application window in the visual studio designer so it fits your personal screen (bad idea), or you make your application aware of window size and window size changes and actively scale parts of the GUI programmatically (better).
If WinForms, as others have stated, you need to Anchor and/or Dock your controls so they know how to resize in relation to the Form when the Form size changes. These will work for simple layouts.
For more complicated needs, however, check out the TableLayoutPanel and/or the FlowLayoutPanel.
A robust User Interface is probably going to be using all of these elements in one way or another...

How does Visual Studio 2012 draw its window border?

How can I achieve the same alpha border effect that can be seen in the new Visual Studio 2012 main window using windows forms? Its window seems to glow.
So I am not sure if it is the best method, but if you use Spy++ (32-bit) and you look in the windows, you can see that beneath Visual Studio's main window, you can see 4 "VisualStudioGlowWindow" objects.
I hooked the messages in Spy++, and as you could imagine, the 4 windows represent the 4 glowing borders around the form. Further inspection shows that these 4 "glow windows" implement the WS_EX_LAYERED Extended window style, so the glow itself isn't done in WPF (as far as I can tell.)!
Hopefully this clears some stuff up.
AFAIK you can do it with WPF using a mix of this chrome and a custom WPF border. Not sure if on WinForms you can, given it's limited styling options (compared with WPF). Anyway they are using WPF.
Unless you want to handle drawing the entire form yourself you cannot. Because Visual Studio 2010 and Visual Studio 2012 are written on top of WPF and used Windows not Forms.
Visual Studio 2012 draw its window border using native Win32 functions. It is not related to the WPF or WindowsForms -- you can do it with both.
The glow is rendered on a transparent window on top of the main window. The main window calls the DWM API to set the glass area to 0. This way you can draw over the original border and the system buttons. This is the correct way to do this.
You can look at code of WPF Shell (http://archive.msdn.microsoft.com/WPFShell) to see how the calls to DWM are made in order to remove the glass. The fact that its written to be compatible with WPF doesnt matter, because all you need is a handle (IntPtr) to the window.
If you have a WindowsForms codebase, don't migrate to WPF. WPF has not been improved in the latest .NET framework release and there are no roadmaps to improvements or new features as its team has been integrated into Windows 8 team.

VS2010: ToolStripContainer with Washed Out StatusStrip on Bottom (Win7, Winform)

I have a Windows Form designed with Visual Studio 2010.
It has a ToolStripContainer with a StatusStrip control placed on the bottom.
From the Visual Studio IDE's Designer, the control looks fine:
When I run the application, the StatusStrip object on the bottom becomes transparent/opaque, and is very hard to read. This project is only about 2 weeks old, and I have not done anything to monkey with the transparency or opacity of any of the controls.
What could be causing this? How would I debug it?
EDIT:
So, I did a search on my Current Project on the control's name (statusStrip1). Unfortunately, there is very little information. I also ran a search on the ToolStripContainer, but it had roughly the same information - nothing that should cause the display to be transparent. The StatusStrip search result is shown below:
You won't believe this.
I stopped this problem by setting the WinForm's TransparencyKey to Fushsia (it was set on Transparent).

Categories

Resources