WPF and DirectX - Game Overlay - wpf

Greetings
I've read WPF utilizes DirectX so I'm wondering if it is possible to create a Game Overlay with WPF. I have tried with Winforms or WPF by itself and the transparent forms or windows always cause problems for streaming software thus I'm wondering is it possible to do the following:
Create a WPF application which shows a Window on the desktop with all the options needed for the overlay. Once all the options is filled in you can press Update and the Overlay is created in the game with all the information on it. The WPF app itself won't be visible on the stream. This means all the viewers will not have any trouble with it when the broadcaster changes settings.
More about the overlay
The overlay will be a scoreboard so it will need a set amount of info. For example:
So to sum up my question(s)
Can I make a WPF application which
dynamically creates a DirectX overlay
ingame?
Since it needs to work in DirectX9,
is this project possible to make by a
single dev (me) which has little to
no exp with DirectX?
If it is possible, where should I
start?
Thanks in advance for all your possible insights and replies!

What you want would be possible using D3DImage. It allows you to host any Direct3D content within WPF and also allows you to have overlay with transparency. Here is a simple example.

From your comment above, it sounds like your really trying to inject your overlay (at least from the user's perspective) into Starcraft II. You would almost have to host a copy of the directx buffer.
Also, besides WPF, you might want to look at XNA.

Related

Can I use the WP7 Panorama control outside of WP7?

I need a WPF control that acts like the Panorama control for Windows Phone 7, but I need it for a desktop application.
It will contain a series of panels (or Panorama Items) that the application will be able to slide through horizontally programmatically.
Also, the content inside the panels not currently displayed on the screen will need to be "lazy loaded". In other words, they should be referenced but not loaded or rendered.
Can I somehow adapt the WP7 Panorama control to do this? Or will I have to develop a custom control from scratch to behave similarly to it?
Thank you!
EDIT:
I could probably use a VirtualizingPanel to implement the lazyload behaviour.
MahApps.Metro while still not super mature does allow for the wp7 Panorama control. Demo of how to use a panorama here. I've played with it a little and while its not the most customizable thing out there it gets the job done. Pretty sweet. Also Sacha Barber (Codeproject Demigod) wrote up an article on making your own. Of which I haven't looked at yet but, the guy usually does awesome work. So I'd check that one out as well.
http://blogs.microsoft.co.il/blogs/arielbh/archive/2010/10/21/porting-windows-phone-7-s-panorama-control-to-silverlight-4.aspx gives some clues about how do to this.
It suggests using http://phone.codeplex.com/ as your base and then you can use http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=4b281bde-9b01-4890-b3d4-b3b45ca2c2e4 (Microsoft Surface Manipulations and Inertia Sample for Microsoft Silverlight) to run convert get it to respond to touch.
Seems none exist as far as I can see so far.
This blog has started an attempt at making it, so you could work from there to make your own. Be sure to also check out this page which details the creation of an individual panorama item too.

wpf WindowsFormHost

Hi Every Body
Am Working With WPF Application
I Needed To Use MS Reports In My Application So I Used WindowsFormsHost
But The Problem Is That The WindowsFormsHost Can'nt Handle Touch Events
How I Can Handle Touch Events In My Report In WindowsFormsHost
Please I Need Ur Help
Thanks
The question is as old as multi touch. As long as the control doesn't support it, you have to trick. Whether that's going to work depends on the control. The BING map control was successfully made to respond to touches. I think there's a touch enabled layer that takes touches and translates them to window messages. This can get a real mess.
Please keep in mind, that even if you can get such a solution to work, you won't get a touch optimized control. The control will probably have a bad, bad user experience...
If it's all about displaying data, I've described a possible alternative implementation on my post: for answer How to display a PDF document in a Microsoft Surface application?

Suggestions for replacing legacy VB6/Flash application with WPF/Blend application

We have a legacy application that utilizes VB6, the Flash ActiveX control, and Flash content to display animated movies to users. For plenty of reasons we're looking to migrate away from this. I'm hoping someone out there can answer a few questions about WPF so that we can make a determination about how best to move forward.
First, a little about our current architecture and needs. The Flash content is set up as separate SWF files, where each individual SWF represents a training module with animated content. We have hundreds of these modules. Users run this software in a disconnected fashion where their local machine may or may not have ALL of these SWF files. The current application gives the user the option of downloading the SWF modules as they're needed.
Here's how we're thinking about setting up a new solution using WPF and Blend. We've written a WPF host application that can dynamically show Blend content based on button presses or whatever. And we've created a few test modules in Blend as WPF custom controls. But there are three nagging questions:
Right now we have the custom controls within the main WPF solution, but we need to make these disconnected. I've read several things about using Application.LoadComponent but I don't know if that will work for our solution.
Each of the Blend custom controls contains one or more storyboards that control the animation. As soon as I add one of the custom controls to a container in the WPF app, ALL of the storyboards automatically start "playing". How can I programatically make it so that I start/stop certain storyboards as needed?
Let's say I want to change a text label in one of the custom controls. If we're dynamically loading the custom control, how would I access one of the text labels to make such a change?
Any tips would be greatly appreciated. Loving WPF so far and hoping we can make this work and say goodbye to Flash forever!!!
There is Manage Extensibility Framework, that is a standard approach for dynamic modules.
Anyway, I haven't used it, so I would answer the questions in other way:
1) No, LoadComponent is ised for xaml files, whereas custom control consist of code and xaml. I mean, the custom control that you can add using Add->New Item->Custom Control(WPF). So you should do something like this, with reflection and ContentControl:
Assembly asm = Assembly.LoadFile(#"C:\SomeLibrary.dll");
Type type = asm.GetType("SomeNamespace.SomeControl");
var control = Activator.CreateInstance(type) as Control;
this.myContentControl.Content = control;
2) It isn't fact. You can put the storyboards into Control.Resources and launch them manually.
((Storyboard)control.Resources["myStoryboard"]).Begin(control);
3)
control.FindName("anyname") as TextBlock;

Easiest way to create interactive simulated desktop app in Silverlight?

I'm creating a training lab for a desktop application.
Basically it'll be a series of screenshots with hotspots, when the user clicks in the right spot it advances to the next screenshot. There will also be some simple text input, so a textbox will need be overlaid over some of the screenshots. The logic is simply if the user enters the right thing they get to move to the next screen.
Adobe Captivate or good old timeline-based Flash is great for creating stuff like this. But this project has to be Silverlight. I considered using Captivate along with a swf to silverlight converter, but I believe those converters only support animations not logic.
The question is: what is the easiest way to create this type of thing in Silverlight? Can Expression Blend do it? Other alternatives? Ideally little programming is required.
Blend is great for this, you may also want to try using Sketchflow to prototype it quickly http://www.microsoft.com/expression/products/SketchFlow_OverView.aspx
Using Expression Blend's behaviours and storyboards makes it easy to create an application with no code in no time.

Is there a WPF equaivalent to System.Windows.Forms.Screen?

I'm trying to create a WPF window that will encompass the entire Desktop working area. In WinForms I'd do this by getting the Union of all the bounds in System.Windows.Forms.Screen.AllScreens.
Is there an equivalent type or other mechanism to get the bounds of the entire desktop in WPF or do I need to use the WinForms type?
Try SystemParameters.VirtualScreen* (Top, Left, Height, and Width) properties. http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.virtualscreenheight(v=VS.100).aspx
Don't use winforms api because it doesn't take into account the fact that WPF's measurement units are not pixels. I came across this issue just recently because I'm losing my vision and have my monitor set to a higher dpi. The codebase I was working on used the Winforms Settings and the UI was larger than my screen.
If you're going to use the winforms api. Look at this blog post on calculating the DPI factor.
I have successfully used WpfScreenHelper 0.3.0.0, currently on Github or Nuget,
https://github.com/micdenny/WpfScreenHelper
It does what the .NET framework should have done so many years ago.
I needed to check if some coordinates exist on any screen in WPF, as in these:
Very germane: Determine if an open WPF window is visible on any monitor
Forms-only and inadequate WPF suggestions: Determining if a form is completely off screen
Just use WinForms. I do not think there is a direct WPF equivalent.
You could try SystemParameters.VirtualScreenWidth and associated parameters. That might not provide as good as a result as continuing with the WinForms API.
The only downside I can see with the WinForms type is an extra dependency and the larger working set related to that.

Resources