I appreciate all your help, but I still have a problem with your solution Lordadmiral Drake.The line
var d2DDevice = new SharpDX.Direct2D1.Device(dxgiDevice2);
produces the error Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
I'm not sure why either.
Here is my code
[STAThread]
static void Main()
{
RenderForm form = new RenderForm("TEST APP");
Factory fact = new Factory();
Device dev = new Device(fact.Adapters[0]);
SwapChain chain = new SwapChain(fact, dev, new SwapChainDescription()
{
BufferCount = 1,
Flags = SwapChainFlags.AllowModeSwitch,
IsWindowed = true,
ModeDescription = new ModeDescription(800, 600, new Rational(1, 60), Format.B8G8R8A8_UNorm),
OutputHandle = form.Handle,
SampleDescription = new SampleDescription(1, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
});
Texture2D backbuffer = Texture2D.FromSwapChain<Texture2D>(chain, 0);
RenderTargetView rtv = new RenderTargetView(dev, backbuffer);
SharpDX.Direct3D11.DeviceContext context = dev.ImmediateContext;
Surface surf = chain.GetBackBuffer<Surface>(0);
Factory2 fact2 = new Factory2(FactoryType.SingleThreaded, DebugLevel.Information);
// Query for the adapter and more advanced DXGI objects.
var dxgiDevice2 = dev.QueryInterface<SharpDX.DXGI.Device>();
// Get the default Direct2D device and create a context.
var d2DDevice = new SharpDX.Direct2D1.Device(dxgiDevice2);
var _d2DContext = new SharpDX.Direct2D1.DeviceContext(d2DDevice, DeviceContextOptions.None);
_d2DContext.PrimitiveBlend = PrimitiveBlend.SourceOver;
var properties = new BitmapProperties1(new PixelFormat(Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied),
96, 96, BitmapOptions.Target | BitmapOptions.CannotDraw);
var _targ = new Bitmap1(_d2DContext, chain.GetBackBuffer<Surface>(0), properties);
_d2DContext.Target = _targ;
}
Also what version are you using I'm using 3.0.0 and the DirectX11_2-signed-net40
Thanks Again,
Curin