Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
GDI+ is slow.
System.Windows.Media is faster.

I wanna use System.Windows.Media Namespace in Windows Forms, not in WPF.
Does it make difference in performance in compare to WPF?
I think it is no matter where to use and makes no difference.
What is right?
Posted

1 solution

This is totally pointless to try to use System.Windows.Media in System.Windows.Forms. There are two fundamentally different UI libraries inside System.Windows: System.Windows.Forms and WPF (the rest of System.Windows).

Forms uses Windows API, including windows messages, Windows controls based on Windows HWND and GDI.

WPF does not use anything of that (messages are using in a thing layer of the topmost window where raw user input events are handled, all other UI elements are totally unrelated to Windows OS and don't use Windows messaging mechanism). It is pretty much detached from most aspects of Windows API and is based on DirectX.

These two approaches are very different and are not used together. More exactly, not at the level of media or graphic. There are two interop facilities: hosting a WPF control by a Forms control, and a Forms control by a WPF UI element. I'm not discussing this kind of interop in detail, because it's irrelevant to your question.

Indirectly, the way I just mentioned above, you can use WPF media in Windows forms, but then your question is reduced to the performance comparison between WPF and Forms. Generally, WPF performance is better, but it depends on what and how you are doing things, many factors. Why won't you compare the performance yourself? Only, there is no need to use WPF in Forms, as it would be easier just to create a WPF UI. But, just in case, this is the link for hosting a WPF composite control in Windows Forms: http://msdn.microsoft.com/en-us/library/ms742215%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900