Original Post
Hi, I'm currently switching my project from WindowForms to WFP, but I'm having problems with rendering into an WPF Image Control.
This is what I do to get the Handle of the Image Control, but instead the scene is rendered across the whole window, not just the specified Image area
[source lang="csharp"]static void InitializeTileEditor()
{
WaterScene scene = new WaterScene();
window = new MainWindow();
window.Show();
HwndSource source = (HwndSource)HwndSource.FromVisual(window.image_Viewport);
//IntPtr viewportHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
VEngine.Initialize(window, source.Handle, 1280, 720, 60, true);
VEngine.Run(scene);
}[/source]
I tried two ways of acquiering the handle, but both had the same result.
Any Ideas how I get the exact handle of the Image Control?
Edit: The handle will be used in the 3D Intialization of SlimDX to create the factory
[source lang="csharp"]factory.SetWindowAssociation(viewportHandle,
WindowAssociationFlags.IgnoreAll |
WindowAssociationFlags.IgnoreAltEnter);[/source]
This is what I do to get the Handle of the Image Control, but instead the scene is rendered across the whole window, not just the specified Image area
[source lang="csharp"]static void InitializeTileEditor()
{
WaterScene scene = new WaterScene();
window = new MainWindow();
window.Show();
HwndSource source = (HwndSource)HwndSource.FromVisual(window.image_Viewport);
//IntPtr viewportHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
VEngine.Initialize(window, source.Handle, 1280, 720, 60, true);
VEngine.Run(scene);
}[/source]
I tried two ways of acquiering the handle, but both had the same result.
Any Ideas how I get the exact handle of the Image Control?
Edit: The handle will be used in the 3D Intialization of SlimDX to create the factory
[source lang="csharp"]factory.SetWindowAssociation(viewportHandle,
WindowAssociationFlags.IgnoreAll |
WindowAssociationFlags.IgnoreAltEnter);[/source]