Пример #1
0
 /// <summary>
 /// Creates a render target that draws to a Windows Graphics Device Interface (GDI) device context.
 /// </summary>
 /// <remarks>
 /// Before you can render with a DC render target, you must use the render target's {{BindDC}} method to associate it with a GDI DC.  Do this for each different DC and whenever there is a change in the size of the area you want to draw to.To enable the DC render target to work with GDI, set the render target's DXGI format to <see cref="SharpDX.DXGI.Format.B8G8R8A8_UNorm"/> and alpha mode to <see cref="SharpDX.Direct2D1.AlphaMode.Premultiplied"/> or D2D1_ALPHA_MODE_IGNORE.Your application should create render targets once and hold on to them for the life of the application or until the render target's  {{EndDraw}} method returns the {{D2DERR_RECREATE_TARGET}} error. When you receive this error, recreate the render target (and any resources it created).
 /// </remarks>
 /// <param name="factory">an instance of <see cref = "SharpDX.Direct2D1.Factory" /></param>
 /// <param name="properties">The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering.  To enable the device context (DC) render target to work with GDI, set the DXGI format to <see cref="SharpDX.DXGI.Format.B8G8R8A8_UNorm"/> and the alpha mode to <see cref="SharpDX.Direct2D1.AlphaMode.Premultiplied"/> or D2D1_ALPHA_MODE_IGNORE. For more information about pixel formats, see  {{Supported Pixel  Formats and Alpha Modes}}.</param>
 public DeviceContextRenderTarget(Factory factory, RenderTargetProperties properties)
     : base(IntPtr.Zero)
 {
     factory.CreateDCRenderTarget(ref properties, this);
 }