packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/Direct2D/Paint2D/Paint2DForm.cs
/// <summary>
/// This method creates the render target and associated D2D and DWrite resources
/// </summary>
This method creates the render target and associated D2D and DWrite resources
This method creates the render target and associated D2D and DWrite resources
void CreateDeviceResources()
        {
            if (renderTarget == null)
            {
                SizeU size = new SizeU((uint)renderControl.ClientSize.Width, (uint)renderControl.ClientSize.Height);
                HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties(renderControl.Handle, size, PresentOptions.RetainContents);
                renderTarget = d2dFactory.CreateHwndRenderTarget(renderProps, hwndProps);
                brushes.Add(renderTarget.CreateSolidColorBrush(new ColorF(Color.Black.ToArgb())));
                currentBrushIndex = 0;
            }
        }
void CreateDeviceResources ( ) { if ( renderTarget == null ) { SizeU size = new SizeU ( ( uint ) renderControl . ClientSize . Width , ( uint ) renderControl . ClientSize . Height ) ; HwndRenderTargetProperties hwndProps = new HwndRenderTargetProperties ( renderControl . Handle , size , PresentOptions . RetainContents ) ; renderTarget = d2dFactory . CreateHwndRenderTarget ( renderProps , hwndProps ) ; brushes . Add ( renderTarget . CreateSolidColorBrush ( new ColorF ( Color . Black . ToArgb ( ) ) ) ) ; currentBrushIndex = 0 ; } }
This method creates the render target and associated D2D and DWrite resources
This method creates the render target and associated D2D and DWrite resources
// Only calls if resources have not been initialize before // Create the render target // Create an initial black brush