Positioning controls on n Physical Screens [modified]
-
On a multiple monitor workspace,used as a disco ball I have a scrolling display. The scrolling data is complex so I need to show a 'legend' on each physical monitor. The scrolling display (WebBrowser with Marquee) is stretched across the VirtualScreen that is composed of 3 or more physical monitors. Problem How do I dynamically create a picturebox at runtime? Each picture box will contain an image (.png). How do I place a common image on each physical monitor. I can calculate the position to put the image but am having trouble figuring out how to get the Picturebox to instantiate at run time TIA -- modified at 16:23 Tuesday 23rd January, 2007 -- modified at 16:41 Tuesday 23rd January, 2007
Tom Hamilton
-
On a multiple monitor workspace,used as a disco ball I have a scrolling display. The scrolling data is complex so I need to show a 'legend' on each physical monitor. The scrolling display (WebBrowser with Marquee) is stretched across the VirtualScreen that is composed of 3 or more physical monitors. Problem How do I dynamically create a picturebox at runtime? Each picture box will contain an image (.png). How do I place a common image on each physical monitor. I can calculate the position to put the image but am having trouble figuring out how to get the Picturebox to instantiate at run time TIA -- modified at 16:23 Tuesday 23rd January, 2007 -- modified at 16:41 Tuesday 23rd January, 2007
Tom Hamilton
You can add or remove a Control to a Form programmatically whenever you want; it basically requires the same kind of code that the Visual Designer creates when you interactively add a Control. So you could do:
void myButton_Click(object sender, EventArgs e) {
Label label=new Label();
label.Text="my button got clicked";
label.Location=new Point(x, y);
y+=30;
this.Controls.Add(label);
}The main problem with this kind of code is in positioning the new Controls; in the example, you need some initial x,y values, and each new Control will be positioned below the previous one. In the end they are bound to fall of the form... :)
Luc Pattyn
-
You can add or remove a Control to a Form programmatically whenever you want; it basically requires the same kind of code that the Visual Designer creates when you interactively add a Control. So you could do:
void myButton_Click(object sender, EventArgs e) {
Label label=new Label();
label.Text="my button got clicked";
label.Location=new Point(x, y);
y+=30;
this.Controls.Add(label);
}The main problem with this kind of code is in positioning the new Controls; in the example, you need some initial x,y values, and each new Control will be positioned below the previous one. In the end they are bound to fall of the form... :)
Luc Pattyn
Thank you Luc. By setting the Drawing point I can control the location of the control.
Tom Hamilton