2012-05-21 60 views
2

我有一个WPF窗口,我应用了窗口标题的样式,并添加了一些代码,以最大化窗口与覆盖任务栏,当我点击最大化按钮和它的工作正常。但问题是,当我通过隐藏任务栏完全最大化窗口拖动窗口,所以任何人都可以帮助我摆脱困境。WPF如何免除任务栏时,最大化窗口

谢谢, @nagaraju。对于dragmove

代码:

void OnTitleBarLeftButtonDown(object sender, MouseEventArgs e) 
     {       
       Window window = this.TemplatedParent as Window; 
       if (window != null) 
       { 
        window.DragMove(); 
       }    
     } 

最大化代码:

void MaxButton_Click(object sender, RoutedEventArgs e) 
     { 
      Window window = this.TemplatedParent as Window; 
      if (window != null) 
      { 
       if (state=="MAX") 
       { 
        window.Width = 1181; 
        window.Height = 670; 
        window.WindowState = WindowState.Normal; 
        CenterWindowOnScreen(); 
        state = "MIN";      
       } 
       else 
       { 
        //maxButton.ImageDown = "/images/normalpress.png"; 
        //maxButton.ImageNormal = "/images/normal.png"; 
        //maxButton.ImageOver = "/images/normalhot.png"; 
        state = "MAX"; 
        window.Width = SystemParameters.WorkArea.Width; 
        window.Height = SystemParameters.WorkArea.Height; 
        window.Top = SystemParameters.WorkArea.Top; 
        window.Left = SystemParameters.WorkArea.Left; 
       } 
      } 
     } 

回答

1

避免很多的麻烦和不这样做你自己 - 使用shell integration library

+0

鉴于好像根本没有文档,一个例子会很好。在那个页面上,我看不到任何关于全屏的东西;它似乎更多地是关于Windows 7的功能和全屏窗口比这更老。 – Joey

+0

@kent感谢您的回复,您能否告诉我或提供任何示例,如何在我的视图中使用此shell库。 – nag

+0

@nag:尝试阅读链接页面:“使用库功能的示例项目作为此发行版的源下载的参考提供” –

相关问题