/// <summary> /// This method creates the render target and all associated D2D and DWrite resources /// </summary> void CreateDeviceResources() { // Only calls if resources have not been initialize before if (renderTarget == null) { // Create the render target SizeU size = new SizeU((uint)host.ActualWidth, (uint)host.ActualHeight); RenderTargetProperties props = new RenderTargetProperties(); HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(host.Handle, size, PresentOptions.None); renderTarget = d2dFactory.CreateHwndRenderTarget(props, hwndProps); // Create the black brush for text blackBrush = renderTarget.CreateSolidColorBrush(new ColorF(0, 0, 0, 1)); inlineImage = new ImageInlineObject(renderTarget, wicFactory, "TextInlineImage.img1.jpg"); TextRange textRange = new TextRange(14, 1); textLayout.SetInlineObject(inlineImage, textRange); } }
/// <summary> /// This method creates the render target and all associated D2D and DWrite resources /// </summary> void CreateDeviceResources() { // Only calls if resources have not been initialize before if (renderTarget == null) { // Create the render target SizeU size = new SizeU((uint)host.ActualWidth, (uint)host.ActualHeight); RenderTargetProperties props = new RenderTargetProperties(); HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(host.Handle, size, PresentOptions.None); renderTarget = d2dFactory.CreateHwndRenderTarget(props, hwndProps); // Create the black brush for text blackBrush = renderTarget.CreateSolidColorBrush(new ColorF(0 ,0, 0, 1)); inlineImage = new ImageInlineObject(renderTarget, wicFactory, "TextInlineImage.img1.jpg"); TextRange textRange = new TextRange(14, 1); textLayout.SetInlineObject(inlineImage, textRange); } }