public void SetupRenderer(int x, int y, int width, int height) { _windowX = x; _windowY = y; _windowWidth = width; _windowHeight = height; // Initialize DirectX devices. NativeMethods.Init(_windowWidth, _windowHeight); var funcPtr = NativeMethods.GetProcAddress(NativeMethods.GetModuleHandle("user32"), "DwmGetDxSharedSurface"); GetDxSharedSurface = Marshal.GetDelegateForFunctionPointer <DGetDxSharedSurface>(funcPtr); _dxImage.Dispatcher.Invoke(() => _dxImage.RequestRender()); }
private void Host_Loaded(object sender, RoutedEventArgs e) { //Cant setup until Grid is loaded and part of the WPF window. d3dImage.WindowOwner = (new System.Windows.Interop.WindowInteropHelper(HostWindow)).Handle; this.SizeChanged += Img_SizeChanged; d3dImage.OnRender = DoRender; d3dImage.RequestRender(); }