Is the Vista/Win7 aero effect included in WPF? - c#

Can I use that effect on my controls just like the BlurEffect? If it's not available, is there a way to "acquire" it? Perhaps via the Reflector?

Which "Aero" effect are you referring to?
You can extend the glass effects into your client area in a WPF application via DwmExtendFrameIntoClientArea.
If you're just after the blurring, you could use BlurBitmapEffect from WPF directly.

No, it is not included.
Yet, there is a Glass Effect in plain WPF that works fine on XP too. It is not the exact duplicate of Aero Glass, but looks nice.

Related

Inheriting default ComboBox to change border color or disable it

I'm working in a WinForms project.
I have a dark theme activated in Windows and this is a default combobox when it's focused:
And this is when it has no focus:
An horrible and insane white border appears when the control lost focus, I want to avoid that without disabling XP Styles in the project.
I know that maybe the only way is inheriting the control to make my own, the problem is I don't know what I need to do with the control, maybe changing a setstyle property or I don't know.
I think you're trying to solve a problem that isn't in the scope of your application. Isn't this just an issue with the theme in question you are using?
Windows has many themes. The major themes still supported are Classic (pre-XP), Luna (XP), Aero (Vista/Win7), and Modern (Windows 8). All of these can be customized to create an infinite number of possible scenarios.
Most Windows Forms controls are based on Win32 controls which are drawn by the OS according to these system themes.
So you have to understand that on the machine you're testing on what you're seeing is going to vary a lot from what users of the application will see on different versions of Windows with different user preferences.
The simple fact is that if you use WinForms base controls you really should surrender control of the appearance to the OS as much as possible.
It's also widely accepted to create your own application theme that the user can't change or that they have to pick from a predetermined set of themes you have created. Examples of this include Google Chrome, iTunes, Winamp, etc. It is typically an awful lot of work to do this with simple Win32 controls unless you use something like WPF which makes it easier.
The important thing is that you can't really pick and choose which parts of your application to theme. If you want it to look consistent you either take responsibility for the entire theme yourself or follow the Windows standards of using system resource colors such as ControlText, ActiveBorder, AppWorkspace, etc.

How to change ListView background image layout?

I've tried to find a way to change the layout of the background image on the ListView control.
I've searched around but haven't got any straight answer.
I can see that there is a ListView property BackgroundImageLayout which is supposed to do the job. But when i change it nothing really happens beside that the BackgroundImageLayoutChanged event is triggered.
How it is possible to change the BackgroundImageLayout on the ListView control? Is there any possible workaround to achive my goal?
PS.: I know about 3rd party controls that 'fix' this problem, but I'm looking for a solution that would do the task without any additional components.
ListView is a native Windows control. Yes, it does support a background image, the LVM_SETBKIMAGE message takes care of it. It however doesn't support the boilerplate Winforms BackgroundImage support, notable lacking is BackgroundImageLayout, the property that Winforms implements for the Control class and implements when the ControlStyles.UserPaint is turned on. It is not for native Windows controls, they paint themselves.
The guy that wrote the Winforms wrapper class for ListView did the next best thing, he added a new property to the ListView class called BackgroundImageTile. A layout option that the native Windows control does implement. Which leaves you with just the two layout options that the native control supports. Tile or don't tile.
That same guy did some pretty heroic things to make the Winforms wrapper class behave reasonably. The code is filled with hacks to work around the native control's quirks. Awesome work. His life would have been a lot easier if the Windows team guy would have the luxury to make the Winforms guy's life easier. But it doesn't work that way, ListView has been around a lot longer than Winforms. And wasn't designed that well from the getgo, Microsoft had pretty significant growing pains around that time.
Fast forward and change the rules so you don't depend on legacy code: WPF, Silverlight, WinRT.
According to the MSDN, 'ListView.BackgroundImageLayout Property':
"The API supports the .NET Framework infrastructure and is not
intended to be used directly from your code."
and
This property has no effect on the layout of the background image of the ListView control, therefore it is not shown in the designer or by IntelliSense.
Use the BackgroundImage property to set the background image. See msdn for more info:
That is unless you have something fancy you are trying to do with it?
EDIT: As per a previous thread HERE: the short answer is that you can't. =(
If you desparately want it, try creating a blank image that is the dimensions of your ListView. Add to this image YOUR image and add at it a position that is in the middle. There may be something similar in nature to this in under Bitmaps or Images.

c# how to make a Windows 7 aero winform (blured glass)?

how to make somthing like this
Windows Forms Glass Effect, Make ImageBox transparent
I use VS 2010
If all you are looking for is the standard glass effect (which includes the blur), check out this article:
http://www.codeproject.com/KB/vista/AeroGlassForms.aspx
Basically, all you're doing is extending the window's frame (which already has the glass effect) into the client area. You have to call the DWM API that come with Windows Vista or later using a couple of P/invoke methods because this is not built into the .NET Framework.
EDIT: If you're looking for more control over the blur effect, you might look into more specifically the DwmEnableBlurBehindWindow function from the DWM API, although I have not used this myself.
Take a look at this:
http://msdn.microsoft.com/en-us/library/aa969512(VS.85).aspx
The MARGINS array is similar to margins on an HTML page. The first example on MSDN gives the margins for the glass effect 25 pixels in height on the bottom of the window.
This MS tutorial is fairly easy to understand and uses C#.

How can I achieve Aero's glass effect cross platform?

Duplicate:
Is it possible to achieve the “Aero Glass” look on XP?
If I use Winforms and I write a win32 application with it, I can see the Aero glass effects in Vista but not in XP.
How could I achieve the same look across different platforms? I am using WPF.
As a side question, did Microsoft write the Aero glass effects using WPF? If so, shouldn't the glass effect be the default WPF look on the other platforms?
What "Aero effect" are you referring to? If you're talking about the window glass, then I'm afraid you're out of luck, as the glass effect is made possible only through Vista's Desktop Window Manager.
If you're simply looking for window transparency, rounded corners, etc., then this is certainly possible in XP. Check out this article for more information.
Ok, so most of the DWM stuff is handled by a DLL called dwmapi.dll, it is all in C++ COM because that is how Microsoft writes it's APIs, you may have noticed that to call the methods in the API you have to use some unmarshalled boolean types etc, this is because it has to reach unmanaged code, some of the operations that need to take place are too dangerous for .NET to watch over without interfering, you may also notice that all the return types aren't actually returns you put in Vars as "out" types so the code can modify them in memory and then that information can be read back into your managed .NET code. As far as a way to get similar effects in Windows XP, the only way I can think of is using Windows Blinds and then making a translucent WPF form with a gradient background (with a glass like effect) it would be quite easy to do, but the window will look out of place in Vista and XP and I don't think that it is such a good idea.
Hope this helps :P
Simon

C# + Custom graphics on controls?

I was just wondering if there are ways of creating my own custom winforms controls?
I've been plundering with Visual Studio 2008 now trying to do some c# apps. And the GUI end up looking terrible because of the standard winforms limitations.
And I noticed that I can add images to buttons for example, but ther's no hover effect. Or, the hover effect makes the whole button area gray. I don't want any of that, I just want to either create my own graphics for the controls or find some free (opensource perhaps) controls that already exist.
Any light on any of this, anyone? :)
You can write complete Winforms controls from scratch, doing all the painting and input processing yourself - you just create a class derived from 'Control' and get on with it.
There's a fair bit to making a first-class control which integrates nicely with the VS designer, so people tend to derive their custom control from an existing control which has most of the behaviour they want.
Here would be a good place to start: http://msdn.microsoft.com/en-us/library/6hws6h2t.aspx
I'm puzzled, you are doing WinForms development, yet in comments say you have done many months of WPF development, but WPF is not good enough because it is not cross platform.
How is WinForm more cross platform, and have you seen how ugly WinForms looks under mono on a Mac as it's draw via X11.
If you want style and cross platform, go for Flex or Silverlight, as your already know WPF I'd go the Silverlight route.
It's cross platform, and has all the beauty of WPF, but at the cost of reduced functionality out of the box.
First - may be more pragmatic to look at WPF, or hosting some WPF elements inside winforms (which is supported - like so). Other than that - you can do all your own painting if you want; but it is a lot of work.
Any reason why you don't use WPF? You have much more more UI control if you went down the route.
If you must go with WinForms then there are many commercial solutions like DevExpress. If you really want you own look and feel it'll be alot of work.
Yes. You can create your own controls. It is called a User Control. Just select Add->and User Control.
WPF is a good alternative if you want your windows form to look fancy.

Categories