Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContainerCollection"/> class.
        /// </summary>
        public ContainerCollection()
        {
            Containers          = new Containers();
            this.SizeChanged   += ContainerCollection_SizeChanged;
            bitmapImage         = new Image();
            bitmapImage.Stretch = Stretch.None;
#if DIRECTX2D
            this.factory           = D2D.D2DFactory.CreateFactory(D2D.D2DFactoryType.Multithreaded);
            this.Directx2DGraphics = new D3D10Image();
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the Direct2DControl class.
        /// </summary>
        public Direct2DControl()
        {
            this.resizeTimer          = new DispatcherTimer();
            this.resizeTimer.Interval = ResizeInterval;
            this.resizeTimer.Tick    += this.ResizeTimerTick;

            this.imageSource = new  D3D10Image();
            this.imageSource.IsFrontBufferAvailableChanged += OnIsFrontBufferAvailableChanged;

            this.image         = new Image();
            this.image.Stretch = Stretch.Fill; // We set this because our resizing isn't immediate
            this.image.Source  = this.imageSource;
            this.AddVisualChild(this.image);

            // To greatly reduce flickering we're only going to AddDirtyRect
            // when WPF is rendering.
            CompositionTarget.Rendering += this.CompositionTargetRendering;
        }