Hey Guys, I've searched around for this question but couldn't come up with anything.
The Problem:
If a user changes the Color Scheme on their Windows Desktop, it tweaks some functionality in my .net application.
Is there any way for me to FORCE my application to use the Windows Classic Theme, regardless of what the user's theme has been set as?
Thanks!
At startup set this property on the application object.
Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
If you are using Visual Studio: when you go to your application project's properties, you will find a checkbox Enable XP Visual Styles. If you disable that, no theming should be applied to your application. I assume this is equivalent to uncommenting the line of code that user nobugz mentioned.
I have done that using DevExpress (http://devexpress.com) controls, they have their own theming engine, and one of the included themes is the Windows Classic one. The themes even style the window borders, so it is a true complete look and feel control.
As to how to do it natively without a third party control, I do not know.
Specifically, look here for the theming engine in the DevExpress control suite: http://devexpress.com/Products/NET/Controls/WinForms/Skins/
Related
I am using Windows Template Studio to create an application with a modifiable theme. Is it possible to add new contents on the settings page? There are 3 themes available currently: light, dark and default. I would like to add another one for example blue. There is an ElementTheme property but I can't modify it since ElementTheme.cs is from metadata.
Windows Template Studio doesn't create an app, it creates the start of an app. What is generated is intended to be a starting point and should be modified as appropriate for your circumstances.
The generated settings page includes the ability to select light or dark theme. Feel free to support either, or neither of these as appropriate. Implementing custom themes should be done in the same way as an app created from a blank template. Just remove anything WTS puts there you don't need or want.
The official UWP docs have some guidance on creating custom themes.
There is also an app in the store to help you create custom themes for your app.
See also, this question about creating custom themes.
There are instructions on further extending the settings page at https://github.com/Microsoft/WindowsTemplateStudio/blob/dev/docs/pages/settings.md
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
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.
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?