Scaling down a high resolution set of co-ordinates?

Jan 27 2011 6:00 AM

Here is some background to the problem. We are working with an EyeVis wall setup, see this link:http://www.eyevis.co.uk/

The EyeVis wall can have any number of 'windows' displayed on the wall at any time. We query the wall for its size dimensions, and then query it for a list of all the windows currently being displayed on the wall. This comes back as a set of co-ordinates as follows:

Left, Top, Width, Height

So at this stage we have the size of the wall, and the co-ordinates of each window being displayed within that wall. What we need to do is display a representation of the wall's layout on a monitor being viewed by the controller. The controller will then select one of the windows (from the monitor) and this window will be enlarged on the EyeVis wall.

I have tried a few things, in the hope that their might be a simple way to achieve this. One idea I had was this:

  1. Create a panel in code with the dimensions of the wall.
  2. Add each window to this panel using the co-ordinates.
  3. Add the main panel to a form and dock the panel

I thought this would auto scale all the panels within the main panel and we would see the layout, but docking at runtime doesn't seem to behave the way I imagined?

This is the code I had: (Using C#)

Panel mainPanel = new Panel();

mainPanel
.Width = eyeVisWallWidth;
mainPanel
.Height = eyeVisWallHeight;

foreach (Window thisWindow in windowList)
{
   
Panel newWindow = new Panel();

    newWindow
.Top = thisWindow.windowTop;
    newWindow
.Width = thisWindow.windowWidth;
    newWindow
.Height = thisWindow.windowHeight;
    newWindow
.Left = thisWindow.windowLeft;

   
Label newLabel = new Label();
    newLabel
.Text = thisWindow.windowID.ToString() + ":" + newWindow.Height + ":" + newWindow.Width;
    newWindow
.Controls.Add(newLabel);
    newWindow
.BorderStyle = BorderStyle.FixedSingle;

    mainPanel
.Controls.Add(newWindow);
}

this.panel1.Controls.Add(mainPanel);

mainPanel
.Dock = DockStyle.Fill;
mainPanel
.Anchor = AnchorStyles.None;

So now I'm starting to think this might have to be solved with math, which is really not my strong point. Does anyone have any advice or a pointer to something which might help me with this?

Any help appreciated! Regards Adrian


Answers (2)