<Window x:Class="DualMonitors.Views.WinLeft"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DualMonitors.Views"
mc:Ignorable="d" WindowState="Maximized" WindowStartupLocation="CenterScreen"
Title="WinLeft" Height="300" Width="300">
<Grid Background="Blue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Left" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Grid.Row="2" Command="{Binding LeftCmd}" Content="Click Left" FontSize="50"/>
</Grid> </Grid>
</Window>

<Window x:Class="DualMonitors.Views.WinRight"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DualMonitors.Views"
mc:Ignorable="d" WindowState="Maximized" WindowStartupLocation="CenterScreen"
Title="WinRight">
<Grid Background="Yellow">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Right" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Grid.Row="2" Command="{Binding RightCmd}" Content="Click Right" FontSize="50"/>
</Grid>
</Grid>
</Window>
using DualMonitors.ViewModel;
using System.Windows; namespace DualMonitors.Views
{
/// <summary>
/// Interaction logic for WinRight.xaml
/// </summary>
public partial class WinRight : Window
{
public WinRight()
{
InitializeComponent();
DualVM BDualVM = DualVM.GetDualVM();
this.DataContext = BDualVM;
}
}
}
using Prism.Commands;
using System.Windows; namespace DualMonitors.ViewModel
{
public class DualVM
{
private static DualVM DualVMInstance; public static DualVM GetDualVM()
{
object objLock = new object();
lock(objLock)
{
if(DualVMInstance==null)
{
DualVMInstance = new DualVM();
}
}
return DualVMInstance;
} private DualVM()
{
//MessageBox.Show("Dual Monitor");
} private DelegateCommand leftCmdValue;
public DelegateCommand LeftCmd
{
get
{
if(leftCmdValue==null)
{
leftCmdValue = new DelegateCommand(LeftCmdExecuted);
}
return leftCmdValue;
}
} private void LeftCmdExecuted()
{
MessageBox.Show("Left Monitor");
} private DelegateCommand rightCmdValue;
public DelegateCommand RightCmd
{
get
{
if(rightCmdValue==null)
{
rightCmdValue = new DelegateCommand(RightCmdExecuted);
}
return rightCmdValue;
}
} private void RightCmdExecuted()
{
MessageBox.Show("Right Monitor");
}
}
}
public partial class App : System.Windows.Application
{ protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e); SetupWindows();
} private void SetupWindows()
{
System.Windows.Forms.Screen mainScreen = Screen.AllScreens[]; ;
WinLeft leftWin = new WinLeft()
{
WindowStartupLocation = WindowStartupLocation.Manual,
WindowState = System.Windows.WindowState.Normal,
Left = mainScreen.WorkingArea.Left,
Top = mainScreen.WorkingArea.Top,
Width = mainScreen.WorkingArea.Width,
Height = mainScreen.WorkingArea.Height
}; System.Windows.Forms.Screen secondaryScreen = Screen.AllScreens[];
WinRight rightWin = new WinRight()
{
WindowStartupLocation = WindowStartupLocation.Manual,
WindowState = System.Windows.WindowState.Normal,
Left = secondaryScreen.WorkingArea.Left,
Top = secondaryScreen.WorkingArea.Top,
Width = secondaryScreen.WorkingArea.Width,
Height = secondaryScreen.WorkingArea.Height
}; leftWin.Show();
leftWin.WindowState = WindowState.Maximized;
rightWin.Show();
rightWin.WindowState = WindowState.Maximized;
rightWin.Owner = leftWin;
}
}

wpf dual monitor的更多相关文章

  1. win7 双屏双任务栏

    扩展屏幕下都显示任务栏!!! 第一步:Dual Monitor Taskbar 下载 下载链接:链接: http://pan.baidu.com/s/1pKxYUFL 密码: gu5c 第二步:安装完 ...

  2. win7系统扩展双屏幕时,如何在两个屏幕下都显示任务栏

    扩展屏幕下都显示任务栏!!! win7系统本身无法设置该功能(目前我是不知道) 但可以下载第三方软件来解决该问题. 第一步:Dual Monitor Taskbar 下载软件 下载链接:http:// ...

  3. Fedora 中多显示器环境下的工作区切换

    [Dual monitor workspaces] 默认情况下,fedora中 Gnome 桌面环境在切换工作去的时候,只会在 Primary display 上切换, 其他显示器保持不变.如果要实现 ...

  4. win7系统扩展双屏幕时,怎样在两个屏幕下都显示任务栏

    扩展屏幕下都显示任务栏!!! win7系统本身无法设置该功能(眼下我是不知道) 但能够下载第三方软件来解决该问题. 第一步:Dual Monitor Taskbar 下载软件 下载链接:http:// ...

  5. win7系统扩展双屏幕时,开启两个屏幕下都显示任务栏,第三方插件

    Dual Monitor Taskbar 下载软件 下载地址 https://dual-monitor-taskbar.en.softonic.com/ 安装即可

  6. WPF MVVM UI分离之《交互与数据分离》 基础才是重中之重~delegate里的Invoke和BeginInvoke 将不确定变为确定系列~目录(“机器最能证明一切”) 爱上MVC3系列~全局异常处理与异常日志 基础才是重中之重~lock和monitor的区别 将不确定变成确定~我想监视我的对象,如果是某个值,就叫另一些方法自动运行 将不确定变成确定~LINQ DBML模型可以对

    WPF MVVM UI分离之<交互与数据分离>   在我们使用WPF过程中,不可避免并且超级喜欢使用MVVM框架. 那么,使用MVVM的出发点是视觉与业务逻辑分离,即UI与数据分离 诸如下 ...

  7. 【基于WPF+OneNote+Oracle的中文图片识别系统阶段总结】之篇三:批量处理后的txt文件入库处理

    篇一:WPF常用知识以及本项目设计总结:http://www.cnblogs.com/baiboy/p/wpf.html 篇二:基于OneNote难点突破和批量识别:http://www.cnblog ...

  8. 11g新特性:Health Monitor Checks

    一.什么是Health Monitor ChecksHealth Monitor Checks能够发现文件损坏,物理.逻辑块损坏,undo.redo损坏,数据字典损坏等等.Health Monitor ...

  9. sql monitor生成不了报告& FFS hint不生效两个问题思考

    事情的发生就是这么偶然,一步步的深入才能汲取到更深入的知识~~ -------------------START------------------------------------------- ...

随机推荐

  1. 04-Uwsgi配置启动Nginx虚拟主机配置

    一.虚拟环境的安装 1.安装虚拟环境 sudo pip3 install virtualenv 2.安装virtualenvwrapper sudo pip3 install virtualenvwr ...

  2. Glide缓存流程

    本文首发于 vivo互联网技术 微信公众号 链接:https://mp.weixin.qq.com/s/cPLkefpEb3w12-uoiqzTig作者:连凌能 Android上图片加载的解决方案有多 ...

  3. SpringBoot:CORS处理跨域请求的三种方式

    一.跨域背景 1.1 何为跨域? Url的一般格式: 协议 + 域名(子域名 + 主域名) + 端口号 + 资源地址 示例: https://www.dustyblog.cn:8080/say/Hel ...

  4. javascript基础修炼(12)——手把手教你造一个简易的require.js

    目录 一. 概述 二. require.js 2.1 基本用法 2.2 细说API设计 三. 造轮子 3.1 模块加载执行的步骤 3.2 代码框架 3.3 关键函数的代码实现 示例代码托管在我的代码仓 ...

  5. 一起学Android之Xml与Json解析

    概述 在网络中,数据交互通常是以XML和Json的格式进行,所以对这两种格式的数据进行解析,是Android开发中的必备功能,本文以一个简单的小例子,简述Android开发中Xml和Json解析的常用 ...

  6. Format a Property Value 设置属性值的格式

    In this lesson, you will learn how to set a display format and an edit mask to a business class prop ...

  7. 随意看看AtomicInteger类和CAS

    最近在读jdk源码,怎么说呢?感觉收获还行,比看框架源码舒服多了,一些以前就感觉很模糊的概念和一些类的用法也清楚了好多,举个很简单的例子,我在读Integer类的时候,发现了原来这个类自带缓存,看看如 ...

  8. eclipse git 主干代码合并到分支

    https://blog.csdn.net/wwd0501/article/details/80676807 eclipse git 主干代码合并到分支: 1.项目切换至分支: 2.选中项目右键--& ...

  9. easyui textbox setValue以及setText的使用技巧

    1.先赋值Value,后赋值Text $('#Name').textbox('setValue', "11");$('#Name').textbox('setText', &quo ...

  10. [PHP] 解决php中上传大文件的错误

    修改nginx配置文件,下面这个参数client_max_body_size 110M; 修改php配置文件中下面两个参数在php.ini中找到下面两个配置,配置项给改大,如果找不到php.ini的位 ...