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.
Related
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
I'm switching from Windows Forms to WPF, but WPF's GUI is really ugly. It looks like Windows 95 or something like that.
Example:
Left is a new WPF project
Right is a new Windows Forms project
Both only have a button and textbox added to the project, no other changes.
As you can see, WPF doesn't have the "native Windows GUI". I know that I can use themes, but I just want the native Windows GUI. Isn't there any setting to do this without themes? I've found this but I didn't change anything in the project except for the button and the textbox and it still doesn't look native.
See this workaround. there's some button styles there to make the buttons look more similar to the native ones. Other than that, see here the official statement from Microsoft that this difference is actually by design. They made intentional changes to the themes to make them more lightweight by removing gradients and such.
I am developing a Windows Form Application in Visual Studio 2008 (C#)
And I want to add Style to the items.
I have been investigating a few ideas about it but I have not found an example about how to do it. Is it really possible?
My app looks like:
But I really want to add more style in buttons, textboxs and other items I have:
My boss insists on using Visual Studio 2008.
To do this without purchasing anything else, you could create your own custom button and text box controls, either from scratch or as controls derived from the existing windows forms controls and then overriding OnPaint etc. Take a look at what's been done here:
http://dotnetrix.co.uk/button.htm
You could also investigate third party options.
Or, use WPF if that's a possibility as others have said. I'd push for WPF! If there's an existing WinForms Code base you can always host WPF Elements in WinForms. See:
Walkthrough: Hosting a Windows Presentation Foundation Control in Windows Forms
IF you wana to use Winforms than you have to buy this one for example:
http://devcomponents.com/
You have to bind the new assemblies in your application that is not a lot of work!
But better way do that with WPF
http://wpftutorial.net/DataGrid.html
I have an WinForms application and started to convert it into WPF. To have less work, my idea was to let the old dialog windows be WinForms. In the VS2010-designer the dialogs looks normal (with .NET 3.5/4.0 controls) but if I run my program all WinForms controls change into an old style and it looks like .NET 2.0 (I think you know what I mean, that grey bevel style for all controls...)
What happens there? Any ways to fix that?
You have to call System.Windows.Forms.Application.EnableVisualStyles() to enable the system style for Windows Forms.
The WinForms project template contain that call by default; the WPF template is missing it as WPF controls do not need it.
how do i make sure that the application iam developing will look the same on other windows-systems?
iam developing now on a windows7, with .net 3.5 framework .. (VS 2008)
as an example, i have a toolbar, that i changed its rendermode to system, it looks ok on my windows7, but when i run the application on windows xp, it is different, even the onmouseover backcolor is different. ..
is there a way to make the application looks like on every windows system (talking abt xp, vista and windows 7 only), lets say like exporting the settings of all the controls with the application !? or any trick to make sure it will be always the same ?
thankss in advance
Unless you render the window yourself you're going to always have slight differences between OS'es, they all have different ways of rendering your primitive controls like text boxes, panels, etc.
Also under windows the background color of a window/control is actually (by default) tied into the theme set in windows.
So allowing people to use their own themes is a plus. You really shouldn't force a style on people unless you're theming your own application.
You would have to you get a grab on all of the colours, fonts, transperancy, etc. and use them to override every controls' Paint event/method so that they may use your values.
The only way I see fit would be by writing yourself custom controls while handling these controls appearance throught the Paint() method so that the control may use what you give it. The pain!...
As SLaks commented, you shouldn't care about such details and let the defaut user preferences take over on the native OS, because some surprises may be encountered over time as if Windows doesn't find the font, for instance, it will replace it with its default, which could lead to horrible results. That is just one example. Need others?