Windows Forms form doesn't look native - vb.net

I've added a Windows Forms form to a VB.net application, and I'm showing it with the usual:
Dim form As New FormInsCapiLettore()
form.ShowDialog()
The problem is that the form, when shown, has an incredibly ugly "windows 95" style. Basically the system theme (Windows 10 in my case) does not get applied. The result is in the screenshot below:
As you can see, not only does it look ugly and non-native, but the layout also screws up: notice the TextBox spilling outside the "input" GroupBox and the "Fine" Button not filling the vertical space.
Notice that the form looks absolutely fine in the Visual Studio designer, with the native look! But when launched, the form has no theme and looks like the screenshot.
Any clues? Additional info:
Running Windows 10 x64
Visual Studio 2015
Application compiled against .NET 4.0

You need to call Application.EnableVisualStyles().

Related

VB.net + WUA Change image via code

Im Creating a WUA (Windows universal App) in Visual Basic and Visual Studio 2015.
I have an image on screen and all I want to do is change said image when a button is clicked.
This simple process seems to have changed since VB 2010, with the use of picture boxes.
Thanks :)

VS 2010 Windows Form App - One Form has a different visual style - why?

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.

RelativePanel arrangement in UserControl crashes the parent page's Visual Studio designer in my UWP app

When I try to use a RelativePanel container within a UserControl, which is then subsequently used in another/parent page within a DataTemplate for a GridView or ListView it crashes the Visual Studio designer for that page. At run-time, it still works, but without being able to see the result within the Visual Studio designer, I am having to go back to using StackPanel controls instead, which works.
Note that I am using x:Bind within my UserConrol and that the crash in the Visual Studio designer only happens when I try to arrange the child controls with the RelativePanel using something like the RelativePanel.Below property.
The exception thrown in the designer is like:
I am using xRelatedMovieImg in the UserControl as follows:
RelativePanel.Below="xRelatedMovieImg"
So has anyone else seen this issue and if so he is there a fix or work around?
Was experiencing the same issue. Found that using Binding worked in my case. So yours might be
RelativePanel.Below="{Binding ElementName=xRelatedMovieImg}"
From what I've experienced, the Designer can be very fragile and crash for the weirdest things. Usually it helps by doing a rebuild of the project (Ctrl+Shift+B).
Also, if you're only changing the design and not debugging you can get faster launches by using "Start without debugging" (Ctrl+F5) from the Debug menu in Visual Studio. That way you don't have to wait for the debugger to get everything set up.

Visual Studio 2013 form control alignment issue on Windows 8

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"

Executable Buttons Not Displaying

I created a VB.Net application with a target .NET Framework of 4.5. The application runs fine on my computer (or any system with Visual Studio installed). But when I try to run the exe generated from the build, the application loads, but the buttons are not displaying. There is an outline where the button is, and you can actually click the button to perform the action just fine. I assume this has something to do with a reference problem, but I really don't know for sure. They are just standard Windows form buttons. No images attached.
So I figured out the solution, but not necessarily the problem. The button had a BackColor property set to Black which is the same color as the form. For some reason, on certain machines this caused the button and the form to blend together. Changing the button BackColor to something different (such as Control grey) worked just fine.