Actually the thing is i am devoloping a windows application, which will be
displayed in multiple monitors.

i have one single exe, which will be displayed in 2 monitors for example. In
cloning mode (windows display setting) both the screen will display the same
content. (eg. form1 will be displayed in screen1 and screen 2, since both
are same, check box click on screen 1 will show check box click on screen2).

Now in my case i want to show 2 different forms of same exe in screen1 and
screen 2. (eg. form1 in screen1 and form4 in screen2).

(1) first how do i do that? or is there any alternative ways?

(2) If i click a check box on form1(screen1), although the screen2 display
form4 , the check box on form1 in screen 2 should be checked.

how do i achieve this functionality.

There are actually 2 touch panels connected to the system. And both the
touch panels are interactive and shows the same(one main part of the
application). In the application for example there are 2 forms in which
through one form it controls temperature of the room and through other form
it controls room light.

But since this is one exe at a time only one operation will happen.(for eg.
if an operation in form1 hangs the system(screen1), system will be hanged in
screen2 too even it doent show form1)

In extended display, can we show same application, interactive in both the
screens? in which the screen can show same form or different form?

right now i am thinking to create 2 objects on form1 at runtime and attach
to the screen boundaries. but how we communicate an event in one object to
another object?

Re: Same application in dual monitor by Morten

Morten
Thu Jul 19 06:35:26 CDT 2007

On Thu, 19 Jul 2007 12:16:02 +0200, Amb k <Amb <k@discussions.microsoft.com>> wrote:

> Actually the thing is i am devoloping a windows application, which will be
> displayed in multiple monitors.
>
> i have one single exe, which will be displayed in 2 monitors for example. In
> cloning mode (windows display setting) both the screen will display the same
> content. (eg. form1 will be displayed in screen1 and screen 2, since both
> are same, check box click on screen 1 will show check box click on screen2).
>
> Now in my case i want to show 2 different forms of same exe in screen1 and
> screen 2. (eg. form1 in screen1 and form4 in screen2).
>
> (1) first how do i do that? or is there any alternative ways?
>
> (2) If i click a check box on form1(screen1), although the screen2 display
> form4 , the check box on form1 in screen 2 should be checked.
>
> how do i achieve this functionality.
>
> There are actually 2 touch panels connected to the system. And both the
> touch panels are interactive and shows the same(one main part of the
> application). In the application for example there are 2 forms in which
> through one form it controls temperature of the room and through other form
> it controls room light.
>But since this is one exe at a time only one operation will happen.(for eg.
> if an operation in form1 hangs the system(screen1), system will be hanged in
> screen2 too even it doent show form1)
>In extended display, can we show same application, interactive in both the
> screens? in which the screen can show same form or different form?
>right now i am thinking to create 2 objects on form1 at runtime and attach
> to the screen boundaries. but how we communicate an event in one object to
> another object?
>
>

Hi Amb,

This is possible using DataBinding. If you are familiar with DataBinding simply have a common object holding all the values displayed in the screen and bind all the controls to their own properties on this object. Updating the underlying property will cause an update to all the controls bound to this property (you may need the holding class implement INotifyPropertyChanged and have the properties trigger the NotifyChanged event)


--
Happy coding!
Morten Wennevik [C# MVP]

Re: Same application in dual monitor by Ambk

Ambk
Thu Jul 19 07:56:02 CDT 2007

Hi Morten,
Can you please elaborate on this. Actually i do not have any idea regarding
databinding and it's implementation. Also can you please share some articles
related to this. Thanks

Re: Same application in dual monitor by Morten

Morten
Thu Jul 19 08:23:41 CDT 2007

On Thu, 19 Jul 2007 14:56:02 +0200, Amb k <Ambk@discussions.microsoft.co=
m> wrote:

> Hi Morten,
> Can you please elaborate on this. Actually i do not have any idea rega=
rding
> databinding and it's implementation. Also can you please share some ar=
ticles
> related to this. Thanks
>

What DataBinding does is bind a property on a Control to a property on a=
n object. Whenever you change the value of the control, the value of th=
e property on the object will automatically change as well. Likewise ca=
n you programmatically change the value of the property on the object an=
d have it "magically" displayed.

The code below has a MainForm the launches two Form1 on two different sc=
reens. MainForm also passes a MyObject object to the constructor of For=
m1. MyObject will hold the data value of the checkbox (true or false) s=
o MyObject has a property for this, called Checked (the name of the prop=
erty can be anything, but the data type must be identical to the propert=
y of the control).

Form1 specifies that checkBox1 should have a DataBinding and adds a new =
Binding object that mirrors the Checked property of the CheckBox to the =
Checked property of MyObject. DataSourceUpdateMode.OnPropertyChanged te=
lls the DataBinding to update the underlying object immediatly if the co=
ntrol value changes. For TextBoxes this means, whenever a character is =
entered, as opposed to DataSourceUpdateMode.OnValidation, which will cha=
nge the underlying object once you leave the control. DataSourceUpdateM=
ode.Never does just that, any changes in the control will not be sent to=
the object.

I have added code on MyObject that will call any controls bound to a spe=
cific property when the property is changed. Although the code will wor=
k without calling notifyPropertyChanged, if you change the Checked prope=
rty programmatically you will have to use it to have the display update =
itself.

Search for 'C# DataBinding Tutorial' on the web to get you started.

In addition to the code below you need to add a CheckBox called checkBox=
1 to Form1. MainForm and Form1 are Windows forms and MyObject is a clas=
s.

PS! MainForm is set to auto hide and will open if you click on the tray =
icon called "ScreenTest"

// MainForm
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ScreenTest
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();

TopMost =3D true;

NotifyIcon icon =3D new NotifyIcon();
icon.Icon =3D this.Icon;
icon.Text =3D "ScreenTest";
icon.Visible =3D true;
icon.MouseDown +=3D new MouseEventHandler(icon_MouseDown);
}

void icon_MouseDown(object sender, MouseEventArgs e)
{
if (WindowState !=3D FormWindowState.Minimized)
{
WindowState =3D FormWindowState.Minimized;
Hide();
}
else
{
WindowState =3D FormWindowState.Normal;
Show();
}
}

private void MainForm_Load(object sender, EventArgs e)
{
MyObject myObj =3D new MyObject();
new Form1(myObj, Screen.AllScreens[0].Bounds).Show();
new Form1(myObj, Screen.AllScreens[1].Bounds).Show();
WindowState =3D FormWindowState.Minimized;
Hide();
}

protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
if (WindowState =3D=3D FormWindowState.Minimized)
ShowInTaskbar =3D false;
else
ShowInTaskbar =3D true;
}

}
}

//Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ScreenTest
{
public partial class Form1 : Form
{
MyObject myObj =3D null;
public Form1(MyObject myObj, Rectangle bounds)
{
InitializeComponent();
this.StartPosition =3D FormStartPosition.Manual;
this.myObj =3D myObj;
this.Bounds =3D bounds;
}

protected override void OnLoad(EventArgs e)
{
checkBox1.DataBindings.Add("Checked", myObj, "Checked", fal=
se, DataSourceUpdateMode.OnPropertyChanged);
}
}
}

//MyObject
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ScreenTest
{
public partial class Form1 : Form
{
MyObject myObj =3D null;
public Form1(MyObject myObj, Rectangle bounds)
{
InitializeComponent();
this.StartPosition =3D FormStartPosition.Manual;
this.myObj =3D myObj;
this.Bounds =3D bounds;
}

protected override void OnLoad(EventArgs e)
{
checkBox1.DataBindings.Add("Checked", myObj, "Checked", fal=
se, DataSourceUpdateMode.OnPropertyChanged);
}
}
}

-- =

Happy coding!
Morten Wennevik [C# MVP]

Re: Same application in dual monitor by Ambk

Ambk
Fri Jul 20 00:02:02 CDT 2007

Hi Morten,
Thank you very much for making me understand the concept. I have checked the
code successfully. I am now trying to implement INotifyPropertyChanged
interface,hope that will also works.

Re: Same application in dual monitor by Ambk

Ambk
Wed Oct 17 00:35:00 PDT 2007

Hi morten
I want to know one more thing. I have defined a picturebox control defined
in the common class and i am loading the picturebox to a panel defined in
form1. Now when i load two form1 screens at the same time only the last
displayed form shows picturebox. How can i show the same picturebox on both
the screens of form1. Any idea?

"Amb k" wrote:

> Hi Morten,
> Thank you very much for making me understand the concept. I have checked the
> code successfully. I am now trying to implement INotifyPropertyChanged
> interface,hope that will also works.