自定义窗口最小化动画
我正在为秒屏幕开发一个任务栏,但无法让这个东西工作。
当我最小化秒屏幕上的应用程序时,它将在主屏幕上显示最小化动画(vista 和 7 aero)。我想做的是将动画显示在秒屏幕上我自己的任务栏上。我知道这是可能的,因为 Displayfusion 和 Acual Multi Monitor 也有此功能。经过一番研究后,我发现可以使用 SetWindowPlacement API 设置最小化位置。但是,我无法让它发挥作用。窗口仍将在主屏幕上显示最小化动画。
这是我到目前为止所尝试过的:首先使用 ITaskbarList DeleteTab 方法隐藏第二个屏幕上窗口的任务栏按钮。然后我使用这个函数来设置最小化位置并最小化窗口:
public void ShowHideAnimated(IntPtr Handle, Boolean show)
{
WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
GetWindowPlacement(Handle, out wp);
wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
wp.flags = WPF_SETMINPOSITION;
wp.ptMinPosition.X = -500; //(-500,200) is a point on the second screen
wp.ptMinPosition.Y = 200;
if (!SetWindowPlacement(Handle, ref wp))
{
Debug.WriteLine( Marshal.GetLastWin32Error() );
}
if(!show)
{
ShowWindowAsync(Handle, SW_MINIMIZE);
}
else
{
ShowWindowAsync(Handle, SW_RESTORE);
}
}
I am developing a taskbar for the seconds screen and can't get this thing to work..
When I minimize an application on the seconds screen it will show the minimize animation to the main screen (vista & 7 aero). What I am trying to do is show the animation to my own taskbar on the seconds screen. I know it is possible because Displayfusion and Acual Multi Monitor also have this feature. So after a bit of research I discovered that you can set the minimize position with the SetWindowPlacement API. However, I can't get this to work. The window will still show the minimize animation the the main screen.
This is what I have tried so far: First hide the taskbarbutton of the window that is on the second screen with ITaskbarList DeleteTab method. Then I use this function to set the minimize position and minimize the window:
public void ShowHideAnimated(IntPtr Handle, Boolean show)
{
WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
GetWindowPlacement(Handle, out wp);
wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
wp.flags = WPF_SETMINPOSITION;
wp.ptMinPosition.X = -500; //(-500,200) is a point on the second screen
wp.ptMinPosition.Y = 200;
if (!SetWindowPlacement(Handle, ref wp))
{
Debug.WriteLine( Marshal.GetLastWin32Error() );
}
if(!show)
{
ShowWindowAsync(Handle, SW_MINIMIZE);
}
else
{
ShowWindowAsync(Handle, SW_RESTORE);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论