Reflection .NET API
Walkthrough / Customize the User Interface / Set Workspace Size and Position
In This Topic
    Set Workspace Size and Position
    In This Topic


    This sample resizes the workspace and moves the top left corner of the workspace to a point on the screen.

    To set the workspace size and position

    1. In Visual Studio, create a new Console Application project and add references for the following Reflection assemblies. (Depending on your version of Visual Studio, these can be found either on the .NET tab or under Assemblies | Extensions.)
      System.Drawing
      Attachmate.Reflection
      Attachmate.Reflection.Framework
    2. Replace all the code in the Program.cs file with the following code for the terminal you are using.
      Set Workspace Size and Position
      Copy Code
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Drawing;
      using Attachmate.Reflection.Framework;
      using Attachmate.Reflection.UserInterface;
      namespace ScreenScrape
      {
          class Program
          {
              static void Main(string[] args)
              {
                  //Start a visible instance of Reflection or get the instance running at the given channel name
                  Application app = MyReflection.CreateApplication("myWorkspace", true);
                  IFrame frame = (IFrame)app.GetObject("Frame");
      
                  //Resize the workspace width and height to 640 x 480 pixels
                  System.Drawing.Size s = frame.WindowSize;
                  s.Width = 640;
                  s.Height = 480;
                  frame.WindowSize = s;
      
                  //Change the workspace window location by assigning the location of the left corner of the workspace to a point
                  System.Drawing.Point p = new Point(30, 30);
                  frame.WindowLocation = p;
              }
          }
      }
                             
      

    To test this project

    1. Press F5 to run the project.
    2. Verify that the workspace is resized and repositioned.