packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/Direct2D/TextInlineImage/Window1.xaml.cs
/// <summary>
/// This method creates the render target and all associated D2D and DWrite resources
/// </summary>
This method creates the render target and all associated D2D and DWrite resources
This method creates the render target and all associated D2D and DWrite resources
void CreateDeviceResources()
        {
            if (renderTarget == null)
            {
                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);
                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);
            }
        }
void CreateDeviceResources ( ) { if ( renderTarget == null ) { 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 ) ; blackBrush = renderTarget . CreateSolidColorBrush ( new ColorF ( 0 , 0 , 0 , 1 ) ) ; inlineImage = new ImageInlineObject ( renderTarget , wicFactory , " " ) ; TextRange textRange = new TextRange ( 14 , 1 ) ; textLayout . SetInlineObject ( inlineImage , textRange ) ; } }
This method creates the render target and all associated D2D and DWrite resources
This method creates the render target and all associated D2D and DWrite resources
// Only calls if resources have not been initialize before // Create the render target // Create the black brush for text