コード例 #1
0
ファイル: DWMManager.cs プロジェクト: thinkingmedia/gems
        /// <summary>Registers a thumbnail to be drawn on a window.</summary>
        /// <remarks>The thumbnail will not be drawn until you update the thumbnail's properties calling Update().</remarks>
        /// <param name="destination">The handle (HWND) of the window on which the thumbnail will be drawn.</param>
        /// <param name="source">The handle (HWND) of the window that has to be drawn.</param>
        /// <returns>A Thumbnail instance, needed to unregister and to update properties.</returns>
        public static Thumbnail Register(IntPtr destination, IntPtr source) {
            if (!OsSupport.IsVistaOrBetter)
                throw new DwmCompositionException(Resources.ExceptionMessages.DWMOsNotSupported);

            if (!OsSupport.IsCompositionEnabled)
                throw new DwmCompositionException(Resources.ExceptionMessages.DWMNotEnabled);

            if (destination == source)
                throw new DwmCompositionException(Resources.ExceptionMessages.DWMWindowMatch);

            Thumbnail ret = new Thumbnail();
            if (NativeMethods.DwmRegisterThumbnail(destination, source, out ret) == 0) {
                return ret;
            }
            else {
                throw new DwmCompositionException(String.Format(Resources.ExceptionMessages.NativeCallFailure, "DwmRegisterThumbnail"));
            }
        }
コード例 #2
0
ファイル: NativeMethods.cs プロジェクト: polytronicgr/netrix
 public static extern int DwmQueryThumbnailSourceSize(Thumbnail hThumbnail, out DwmSize pSize);
コード例 #3
0
ファイル: NativeMethods.cs プロジェクト: polytronicgr/netrix
 public static extern int DwmUpdateThumbnailProperties(Thumbnail hThumbnailId, ref DwmThumbnailProperties ptnProperties);
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: polytronicgr/netrix
 public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out Thumbnail phThumbnailId);
コード例 #5
0
ファイル: ThumbnailViewer.cs プロジェクト: thinkingmedia/gems
        private void RecomputeParentForm()
        {
            //Get the owning form
            Form nextParent = this.TopLevelControl as Form;

            if (nextParent == null) {
                //No owning form found (!)
                _topLevelForm = null;
                if (_thumbnail != null) {
                    _thumbnail.Dispose();
                    _thumbnail = null;
                }
                return;
            }

            if (_thumbnail != null && _topLevelForm != nextParent) {
                //Parent changed from last time
                _thumbnail.Dispose();
                _thumbnail = null;
            }

            _topLevelForm = nextParent;
        }
コード例 #6
0
ファイル: ThumbnailViewer.cs プロジェクト: thinkingmedia/gems
 void originForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (_thumbnail != null) {
         _thumbnail.Dispose();
         _thumbnail = null;
     }
 }
コード例 #7
0
ファイル: ThumbnailViewer.cs プロジェクト: thinkingmedia/gems
        public void SetThumbnail(IntPtr originHandle)
        {
            RecomputeParentForm();

            if (_topLevelForm != null) {
                _thumbnail = DwmManager.Register(_topLevelForm, originHandle);
                UpdateThumbnail(Visible);
            }
            else
                throw new Exception("Control must have an owner.");
        }
コード例 #8
0
ファイル: DWMManager.cs プロジェクト: thinkingmedia/gems
 public static void Unregister(Thumbnail handle) {
     if (handle != null) {
         handle.Close();
     }
 }
コード例 #9
0
ファイル: NativeMethods.cs プロジェクト: thinkingmedia/gems
 public static extern int DwmUpdateThumbnailProperties(Thumbnail hThumbnailId, ref DwmThumbnailProperties ptnProperties);
コード例 #10
0
ファイル: NativeMethods.cs プロジェクト: thinkingmedia/gems
 public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out Thumbnail phThumbnailId);
コード例 #11
0
ファイル: NativeMethods.cs プロジェクト: thinkingmedia/gems
 public static extern int DwmQueryThumbnailSourceSize(Thumbnail hThumbnail, out DwmSize pSize);