DockableFloatingWindow 上的最大化和 Aero 捕捉
我有以下代码可以使未停靠的浮动 AvalonDock 窗口最大化:
class MaximizableDockableContent : AvalonDock.DockableContent
{
public MaximizableDockableContent()
: base()
{
base.StateChanged += MaximizableDockableContent_StateChanged;
}
private void MaximizableDockableContent_StateChanged(
object sender, RoutedEventArgs e)
{
MaximizableDockableContent mdc = (MaximizableDockableContent)sender;
if (mdc.State == DockableContentState.DockableWindow)
{
base.FloatingWindowSizeToContent = SizeToContent.WidthAndHeight;
FloatingDockablePane fdp = (FloatingDockablePane)base.Parent;
DockableFloatingWindow dfw = (DockableFloatingWindow)fdp.Parent;
//dfw.WindowState = WindowState.Maximized;
dfw.WindowStyle = WindowStyle.ThreeDBorderWindow;
dfw.ResizeMode = ResizeMode.CanResize;
//disable minimize button
ControlBox.SetHasMinimizeButton(dfw, false);
}
}
}
我如何添加 Aero Snap 功能吗?
I have the following code to give a undocked floating AvalonDock window the ability to maximize:
class MaximizableDockableContent : AvalonDock.DockableContent
{
public MaximizableDockableContent()
: base()
{
base.StateChanged += MaximizableDockableContent_StateChanged;
}
private void MaximizableDockableContent_StateChanged(
object sender, RoutedEventArgs e)
{
MaximizableDockableContent mdc = (MaximizableDockableContent)sender;
if (mdc.State == DockableContentState.DockableWindow)
{
base.FloatingWindowSizeToContent = SizeToContent.WidthAndHeight;
FloatingDockablePane fdp = (FloatingDockablePane)base.Parent;
DockableFloatingWindow dfw = (DockableFloatingWindow)fdp.Parent;
//dfw.WindowState = WindowState.Maximized;
dfw.WindowStyle = WindowStyle.ThreeDBorderWindow;
dfw.ResizeMode = ResizeMode.CanResize;
//disable minimize button
ControlBox.SetHasMinimizeButton(dfw, false);
}
}
}
How do I go about adding Aero Snap functionality to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于感兴趣的人,最新版本的 AvalonDock(版本 2)本身支持浮动窗口 aero snap 功能。
AvalonDock 2.0 仍处于测试阶段,更多信息:
http://avalondock.codeplex.com/
新功能:
http://avalondock.codeplex.com/wikipage?title=Version2Concept
For who is interested latest version of AvalonDock (version 2) natively supports floating window aero snap feature.
AvalonDock 2.0 is still in beta, more info:
http://avalondock.codeplex.com/
New features:
http://avalondock.codeplex.com/wikipage?title=Version2Concept
您可以使用运行时运行外部进程:
从以下位置下载nircmd.exe: http://www.nirsoft .net/utils/nircmd.html
并确保它与 .class 文件位于同一目录中或在 Windows PATH 环境变量中
,然后使用 Runtime.exec() 运行它多次:
请注意,这可能会引发 IOException,因此可能会出现 try/catch 块必要的。
注意:这假设该窗口是活动窗口。
you could run an external process, using runtime:
download nircmd.exe from: http://www.nirsoft.net/utils/nircmd.html
and make sure it is in the same directory as the .class file or in the windows PATH environment variable
then use Runtime.exec() to run it several times:
note that this can throw an IOException, so a try/catch block might be necessary.
note:this assumes that the window is the active one.
匿名说:“不幸的是,Windows + 向上或向下箭头也被禁用。活动窗口。”
vIBIUS 说:“这也会禁用 Windows 键 + Shift 和左/右选项!”
Kermonk 说“不幸的是,这也禁用了“摇动窗口以关闭所有其他窗口”功能……”
尝试一下:
它禁用鼠标操作以最大化窗口并将窗口对齐到侧面,但不能禁用键盘快捷键。它不会影响 AeroPeak 或 AeroShake。它也不会影响“仅在垂直方向上最大化窗口”。
anon said “Unfortunately is also disables, Windows + Up or Down arrow for Max./Min. the active Window.”
vIBIUS said “This also disables the Windows Key + Shift and Left/Right option!”
Kermonk said “unfortunately that also disables the “shake window to close all other windows” feature…”
Try this:
It disables the mouse action to maximise windows and snap windows to the side but not the keyboard shortcuts. It does not affect AeroPeak or AeroShake. It also does not affect ‘maximising a window in a verticle direction only’.