Ejemplo n.º 1
0
        public static System.Drawing.Size GetNonClientArea(IntPtr hwnd)
        {
            var c = new NativePoint();

            _ = HandlerNativeMethods.ClientToScreen(hwnd, ref c);

            _ = HandlerNativeMethods.GetWindowRect(hwnd, out NativeRect r);

            return(new System.Drawing.Size(c.X - r.Left, c.Y - r.Top));
        }
Ejemplo n.º 2
0
        public static System.Drawing.Size GetNonClientArea(IntPtr hwnd)
        {
            var c = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref c);

            var r = new NativeRect();

            TabbedThumbnailNativeMethods.GetWindowRect(hwnd, ref r);

            return(new System.Drawing.Size(c.X - r.Left, c.Y - r.Top));
        }
Ejemplo n.º 3
0
        internal static System.Drawing.Size GetNonClientArea(IntPtr hwnd)
        {
            var c = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref c);

            var r = new NativeRect();

            TabbedThumbnailNativeMethods.GetWindowRect(hwnd, ref r);

            return new System.Drawing.Size(c.X - r.Left, c.Y - r.Top);
        }
Ejemplo n.º 4
0
        public static System.Drawing.Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent)
        {
            var childScreenCoord = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref childScreenCoord);

            var parentScreenCoord = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwndParent, ref parentScreenCoord);

            System.Drawing.Point offset = new System.Drawing.Point(
                childScreenCoord.X - parentScreenCoord.X,
                childScreenCoord.Y - parentScreenCoord.Y);

            return(offset);
        }
Ejemplo n.º 5
0
        internal static System.Drawing.Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent)
        {
            var childScreenCoord = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref childScreenCoord);

            var parentScreenCoord = new NativePoint();

            TabbedThumbnailNativeMethods.ClientToScreen(hwndParent, ref parentScreenCoord);

            System.Drawing.Point offset = new System.Drawing.Point(
                childScreenCoord.X - parentScreenCoord.X,
                childScreenCoord.Y - parentScreenCoord.Y);

            return offset;
        }
 public static extern int DwmSetIconicLivePreviewBitmap(
     IntPtr hwnd,
     IntPtr hbitmap,
     ref NativePoint ptClient,
     uint flags);
 public static extern bool ClientToScreen(
     IntPtr hwnd,
     ref NativePoint point);
        /// <summary>
        /// Sets the specified peek (live preview) bitmap for the specified
        /// window.  This is typically done in response to a DWM message.
        /// </summary>
        /// <param name="hwnd">The window handle.</param>
        /// <param name="bitmap">The thumbnail bitmap.</param>
        /// <param name="offset">The client area offset at which to display
        /// the specified bitmap.  The rest of the parent window will be
        /// displayed as "remembered" by the DWM.</param>
        /// <param name="displayFrame">Whether to display a standard window
        /// frame around the bitmap.</param>
        public static void SetPeekBitmap(IntPtr hwnd, IntPtr bitmap, System.Drawing.Point offset, bool displayFrame)
        {
            var nativePoint = new NativePoint(offset.X, offset.Y);
            int rc = DwmSetIconicLivePreviewBitmap(
                hwnd,
                bitmap,
                ref nativePoint,
                displayFrame ? DisplayFrame : (uint)0);

            if (rc != 0)
            {
                Exception e = Marshal.GetExceptionForHR(rc);

                if (e is ArgumentException)
                {
                    // Ignore argument exception as it's not really recommended to be throwing
                    // exception when rendering the peek bitmap. If it's some other kind of exception,
                    // then throw it.
                }
                else
                {
                    throw e;
                }
            }
        }
Ejemplo n.º 9
0
        public void SelectItems(ShellObject[] ShellObjectArray)
        {
            IntPtr pIDL = IntPtr.Zero;
            IFolderView ifv = GetFolderView();

            Array PIDLArray = new Array[ShellObjectArray.Length];
            int i = 0;

            

            foreach (ShellObject item in ShellObjectArray)
	        {
                uint iAttribute;
                SHParseDisplayName(item.ParsingName.Replace(@"\\",@"\"), IntPtr.Zero, out pIDL, (uint)0, out iAttribute);

                if (pIDL != IntPtr.Zero)
                {
                    IntPtr pIDLRltv = ILFindLastID(pIDL);
                    if (pIDLRltv != IntPtr.Zero)
                    {
                        PIDLArray.SetValue((int)pIDLRltv,i);
                    }
                }
		        
                i++;
	        }


            NativePoint p = new NativePoint();
            try
            {
                //ifv.SelectAndPositionItems((uint)Marshal.SizeOf(PIDLArray), PIDLArray, ref p, (uint)WindowsAPI.SVSIF.SVSI_SELECT);
            }
            finally
            {
                if (ifv != null)
                    Marshal.ReleaseComObject(ifv);

                if (pIDL != IntPtr.Zero)
                    Marshal.FreeCoTaskMem(pIDL);
            }
        }