当前位置: 首页>>代码示例>>C#>>正文


C# TaskbarWindow.Dispose方法代码示例

本文整理汇总了C#中Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindow.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# TaskbarWindow.Dispose方法的具体用法?C# TaskbarWindow.Dispose怎么用?C# TaskbarWindow.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindow的用法示例。


在下文中一共展示了TaskbarWindow.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddThumbnailButtons

 internal static void AddThumbnailButtons(System.Windows.UIElement control, params ThumbnailToolBarButton[] buttons)
 {
     // Try to get an existing taskbar window for this user uielement            
     TaskbarWindow taskbarWindow = GetTaskbarWindow(control, TaskbarProxyWindowType.ThumbnailToolbar);
     TaskbarWindow temp = null;
     try
     {
         AddThumbnailButtons(
             taskbarWindow ?? (temp = new TaskbarWindow(control, buttons)),
             taskbarWindow == null,
             buttons);
     }
     catch
     {
         if (temp != null) { temp.Dispose(); }
         throw;
     }
 }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:18,代码来源:TaskbarWindowManager.cs

示例2: DispatchMessage


//.........这里部分代码省略.........
                        bmp = bmp.Clone(clippingRectangle, bmp.PixelFormat);

                        // Make sure we dispose the bitmap before assigning, otherwise we'll have a memory leak
                        if (hBitmap != IntPtr.Zero && taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
                        {
                            ShellNativeMethods.DeleteObject(hBitmap);
                        }
                        hBitmap = bmp.GetHbitmap();
                    }
                    else
                    {
                        // Else, user didn't want any clipping, if they haven't provided us a bitmap,
                        // use the screencapture utility and capture it.

                        hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap;

                        // If no bitmap, capture one using the utility
                        if (hBitmap == IntPtr.Zero)
                            hBitmap = GrabBitmap(taskbarWindow, realWindowSize);
                    }

                    // Only set the thumbnail if it's not null. 
                    // If it's null (either we didn't get the bitmap or size was 0),
                    // let DWM handle it
                    if (hBitmap != IntPtr.Zero)
                    {
                        Bitmap temp = TabbedThumbnailScreenCapture.ResizeImageWithAspect(hBitmap, requestedSize.Width, requestedSize.Height, true);

                        if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
                            ShellNativeMethods.DeleteObject(hBitmap);
                        
                        hBitmap = temp.GetHbitmap();
                        TabbedThumbnailNativeMethods.SetIconicThumbnail(taskbarWindow.WindowToTellTaskbarAbout, hBitmap);
                        temp.Dispose();
                    }

                    // If the bitmap we have is not coming from the user (i.e. we created it here),
                    // then make sure we delete it as we don't need it now.
                    if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
                        ShellNativeMethods.DeleteObject(hBitmap);

                    return true;
                }
                else if (m.Msg == (int)TaskbarNativeMethods.WM_DWMSENDICONICLIVEPREVIEWBITMAP)
                {
                    // Try to get the width/height
                    int width = (int)(((long)m.LParam) >> 16);
                    int height = (int)(((long)m.LParam) & (0xFFFF));

                    // Default size for the thumbnail
                    Size realWindowSize = new Size(200, 200);

                    if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero)
                        TabbedThumbnailNativeMethods.GetClientSize(taskbarWindow.TabbedThumbnail.WindowHandle, out realWindowSize);
                    else if (taskbarWindow.TabbedThumbnail.WindowsControl != null)
                        realWindowSize = new Size(
                            Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Width),
                            Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Height));

                    // If we don't have a valid height/width, use the original window's size
                    if (width <= 0)
                        width = realWindowSize.Width;
                    if (height <= 0)
                        height = realWindowSize.Height;

                    // Fire an event to let the user update their bitmap
开发者ID:TanyaTPG,项目名称:Log2Console,代码行数:67,代码来源:TaskbarWindowManager.cs

示例3: DispatchSystemCommandMessage

        private static bool DispatchSystemCommandMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
        {
            if (m.Msg == (int)WindowMessage.SystemCommand)
            {
                if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose)
                {
                    // Raise the event
                    if (taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed())
                    {
                        // Remove the taskbar window from our internal list
                        if (_taskbarWindowList.Contains(taskbarWindow))
                        {
                            _taskbarWindowList.Remove(taskbarWindow);
                        }

                        taskbarWindow.Dispose();
                        taskbarWindow = null;
                    }
                }
                else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMaximize)
                {
                    // Raise the event
                    taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMaximized();
                }
                else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMinimize)
                {
                    // Raise the event
                    taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMinimized();
                }

                return true;
            }
            return false;
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:34,代码来源:TaskbarWindowManager.cs

示例4: DispatchNCDestroyMessage

        private static bool DispatchNCDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
        {
            if (m.Msg == (int)WindowMessage.NCDestroy)
            {
                // Raise the event
                taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed();
                
                // Remove the taskbar window from our internal list
                if (_taskbarWindowList.Contains(taskbarWindow))
                {
                    _taskbarWindowList.Remove(taskbarWindow);
                }

                taskbarWindow.Dispose();

                return true;
            }
            return false;
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:19,代码来源:TaskbarWindowManager.cs


注:本文中的Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindow.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。