I need to use OpenGL in my WPF project. I'd prefer it to be as simple in installation as possible, but I'm beginning to lose hope.
I've tried SharpGL: it's pretty good and easy to use, but it has massive memory leaks and the app crashes after few seconds. Not very useful.
So now I am wondering: is there an alternative to this library? Actually I don't have to use OpenGL - I just need to present a 3D scene in any technology .. perhaps D3D or something else will be easier to manage in WPF...
What do you recommend?
Kind regards
Q.
Update: Yes, I'm working under Windows 7. And I'd really prefer smt. OpenGL based because I already know the technology.
Within WPF, I can easily say that using XNA will be the easiest way, which many people have done before. There's even an example project here: http://blogs.msdn.com/b/nicgrave/archive/2011/03/25/wpf-hosting-for-xna-game-studio-4-0.aspx
The Tao framework supports this: taoframework-2.1.0-setup.exe
Once you've installed it, right click on your Toolbar and select "Choose Items.." and add "SimpleOpenGlControl" from the .NET Framework Components list. If you can't find it in the list, hit browse and search for Tao.Platform.Windows.dll in your Tao Framework installation directory.
After that you can just drag the OpenGl control wherever you like, and use its Paint event to do your stuff in. (Not really sure how often that event fires though, last time I checked it fired once every 12 seconds or something so you may need to do some magic stuff to have it fire more often - say a thread to call Draw, or some other nifty stuff)
I have used successfuly OpenTK library (http://www.opentk.com/).
Works with WPF/Windows Forms.
Related
I am currently learning WPF framework; I have some past (not much though) experience with Winforms. One problem I've had in both is that the menubar does not look native. I've found a workaround in Winforms, but I haven't been able to find anything for WPF. I've not had this problem in other frameworks I've used, particularly Qt.
In many pics I've seen, it looks native enough in Windows 7, but not Windows 10. I included some pics.
How it currently looks:
How it should look:
Thanks in advance!
Edit
While I have not seen the possible duplicate link, I am aware of setting the foreground/background on WPF controls. That link doesn't really answer my question. I don't want to come up with my own style at this point; all I want to do is make controls look native.
If custom styling is the only way, that's fine, but if there is another way, that would be preferable.
Thanks!
I don't think there's a quick fix to get what you want. WPF renders using DirectX, allowing for much more flexibility in styling applications. A WPF app should render exactly the same way on any version of Windows - it will not automatically adopt a native look and feel (that was actually one of the main selling points of the technology in its early days).
While MS made the default styling somewhat close to Windows at the time of release (Vista, I think?), if you want WPF controls to have a particular look you're going to have to style them yourself.
I am not able to apply 3D effects on WPF's built-in WebBrowser, because it is just a thin wrapper around the native ActiveX-Webbrowser, which isn't based on WPF. I saw most of the places people suggested about one Link ,but I m not able to make it work in my application and it is having so many dlls which I don't want. Can anybody suggest me any other good alternative solution present then?
Maybe you forget to copy the needed awesomium.dll & AwesomiumProcess.exe with your executing assembly (which are not .Net assemblies).
I also have some difficulties to run with awesomium but it's not impossible.
I can recommand you the Troymium/TroymiumNet which is actively maintain by its developers.
I use it on Microsoft Surface to connect people to their facebook account.
I've never used it, but you could try Berkelium with berkelium-sharp.
So... I want to make a game, and I want to write it in C#. In the past, I've made a mario clone using C++ and OpenGL. I quite like OpenGL, but I don't know how well it's supported inside C#/WPF. Also, it might be beneficial to use an actual game library? I guess XNA is the game library for C#, so maybe I'll invest a bit of time learning that.
However, I want to use WPF form controls for my level editor... is there any way that I can embed an XNA (DirectX?) window inside a WPF app?
Specifically, I don't need any buttons or things inside the XNA/DirectX widget, just around it, so no mixing required...just need to get a graphics widget in my WPF form.
Nick Gravelyn explains how to do it on his blog.
Although, if it's just for an editor, you may find using WinForms is easier and better supported.
First of all, you should ask this on gamedev.stackexchange.com. But I've seen a tutorial embedding XNA.
You should check this question and this page. They are on Windows Forms, but they'll help.
Also check this and this articles.
Keep in mind one thing. XNA is meant to be used for the whole game, integration would be useful on making level editors like you say, but not for a full game.
WPF uses DirectX, and you can do direct "interop" here is a codeProject article on the subject. Here is an article i dug up where the author is using win-forms and WPF controls in an XNA project. Might be worth a look for you.
I'm using WINFORMS not WPF.
I just know basic c# .net gui programming. I donot want the traditional windows look. I want to have my own custom look (eg. gtalk, antivirus softwares, media players, google chrome).
Actually I'm inspired by google's PICASA software. Its awesome. I want to do something like that.How can I do that? If there is something I should learn please point me.
Also I may have to write my own custom controls (like modified tree view etc..) I guess. Please give some good learning resources.
This article describes how to draw custom windows. The author also shows how to draw non-rectangular windows.
If you could use WPF instead of Windows Forms, this is a good article about customizing window drawing:
http://www.codeguru.com/csharp/.net/net_wpf/article.php/c16379/
There is also a question with some good answers here on SO:
Creating custom forms in WPF?
Update:
I think that skinning and custom drawing is fun to do from a programmers perspective, but I also think that there is almost no benefit for the user.
The creators of the platform you are developing for might have put a lot of effort into the design of their windowing toolkits.
If you just want to change some visual aspects of your application you also should take into account that you might miss some important other aspects of UI design:
consistency
accessibility
aesthetics (if you are overdoing
effects, gradients, ...)
internationalization
...
As you are developing for Windows, you also lose the skinning ability of the OS itself. And I think that some of the skins that come with newer versions of Windows are pretty good.
You can try any of the following:
telerik
Syncfusion
(source: componentsource.co.jp)
Or other components.
They do make your UI pretty.
Edit: if you want to study how they do it, you can buy the source code-- along with documentation and understand from there.
There are some commercial control libraries available.
I can recommend the Krypton Suite. It consists of the free Krypton Toolkit (which contains a lot of skinnable controls) and other non-free controls (Navigator, Ribbon, Docking, Workspace). It has some built-in palettes and renderers that allow you to make your UI look like Office 2010, Office 2007, Office 2003, ...
You want to look for +winforms +skinning. I haven't tried these, but the first hits don't look bad. Most decent skinning tools will be paid for.
From what you said, you want to develop your own custom controls. You have some frameworks for this like Qt which can use Direct3D for hardware accelerated graphics. It also have a Visual Studio plugin. There is a free LGPL version and a commercial version of it.
I remembered about Qt because you mentioned Picasa and as far as I remember, I heard the Picasa UI has been written through Qt.
You can try using "SetWindowRgn(..)" to set an arbitrary region for your window. This may range from giving a rounded rectangle shape to giving a weird looking shape to the form!
Check this out: Link.
There is another option if you are working in Vista(aero enabled), ie you can check out DwmExtendFrameIntoClientArea(..) function here: link text
You can set the form's border style to 'none' and go on to create your custom form! You then might have to create custom buttons to carry out tasks like close, minimise, maximise etc. You might even need to write code for drag and drop events..
For the background, you might need to have a look at the gradient fills to give a great effect, otherwise you can use great looking pictures as Background..! But the latter option isnt good unless you have really good pic.
We are using Winforms using the Infragistic framework.
We are considering the move to WPF. The problem is that we have already several forms, dialogs etc in Winforms. We need common look and feel thus we need to migrate all to WPF.
Is there a migration tool to take Winforms and migrate to WPF? I know it is not possible to do it completely but is there something that will do some of the work?
Thanks
In my opnion, and depending on your architecture, a one on one translation is not really the right approach to go here: consider why you want to move to wpf, and evaluate whether you really want to commit to it. It's a powerful framework, but there's quite a steep learning curve and to be really worth it you need to take the time to look at the user experience and see how wpf can help. If you want to have the winforms look and feel, and just move to wpf because it's the next new thing, you're in for an unpleasant suprise.
Anayway, what we've done while migrating our winforms stuff is to make new screens in wpf, and keep hosting the old winforms screen using ElementHost and WindowsFormsHost. These work really well by the way - we haven't had any problems with them so far. We then migrated screen by screen to wpf. Looked like a Frankenstein in the mean time, but at least we had regular feedback and everything was functional.