public static D2D1Factory Create(D2D1FactoryType factoryType, D2D1FactoryOptions factoryOptions)
        {
            ID2D1Factory factory;

            GCHandle handle = GCHandle.Alloc(factoryOptions, GCHandleType.Pinned);

            try
            {
                NativeMethods.D2D1CreateFactory(factoryType, typeof(ID2D1Factory).GUID, handle.AddrOfPinnedObject(), out factory);
            }
            finally
            {
                handle.Free();
            }

            return new D2D1Factory(factory);
        }
 public static D2D1Factory Create(D2D1FactoryType factoryType, D2D1DebugLevel debugLevel)
 {
     D2D1FactoryOptions factoryOptions = new D2D1FactoryOptions();
     factoryOptions.DebugLevel = debugLevel;
     return D2D1Factory.Create(factoryType, factoryOptions);
 }