System.Windows.Interop.ActiveXHost.SetExtent C# (CSharp) Méthode

SetExtent() private méthode

private SetExtent ( int width, int height ) : NativeMethods.SIZE
width int
height int
Résultat NativeMethods.SIZE
        private NativeMethods.SIZE SetExtent(int width, int height)
        {
            NativeMethods.SIZE sz = new NativeMethods.SIZE();
            sz.cx = width;
            sz.cy = height;

            bool resetExtents = false;
            try
            {
                _axOleObject.SetExtent(NativeMethods.DVASPECT_CONTENT, sz);
            }
            catch (COMException)
            {
                resetExtents = true;
            }
            if (resetExtents)
            {
                _axOleObject.GetExtent(NativeMethods.DVASPECT_CONTENT, sz);
                try
                {
                    _axOleObject.SetExtent(NativeMethods.DVASPECT_CONTENT, sz);
                }
                catch (COMException e)
                {
                    Debug.Fail(e.ToString());
                }
            }
            return GetExtent();
        }