本文整理汇总了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;
}
}
示例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
示例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;
}
示例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;
}