ImageGear Professional v18.2 > User Guide > Using ImageGear > Using ImageGear GUI Component > GUI Pan Control (IGGUIPanCtl) |
The IGGUIPanCtl Control is used as an alternative to the traditional scroll-bars for scrolling very large images:
The GUI Pan Control (IGGUIPanCtl Control) allows the visible portion of an image displayed in an IGPageViewCtl Control to be moved by dragging the mouse around in the image. Optionally, a floating window can be used to display the complete image, scaled to fit within the floating window. By dragging the mouse within this floating window, the image in the IGPageViewCtl Control is repositioned. The portion of the image that is visible in the IGPageViewCtl Control is displayed within the floating window in reverse video.
The control will act as if it has a visible presence in the application (when dropped onto a form in the forms designer, it will appear as a white resizeable rectangle with a black border). However, if Visible = False, then at run-time the control will not appear on the form. |
To use the IGGUIPanCtl Control, you must first make an instance of the control available. In Visual Basic, this is done as follows:
You'll then have the IGGUIWin control on your Toolbox. You can then place a copy of the control on your application by double-clicking the control icon in the toolbox. For example, in the GUIWin sample program, the control has been added to the PanFrm and appears as shown in the following image:
The control appears as a white rectangular area within the form. You can resize the control by selecting it on the VB Forms designer, and then dragging the drag-handles. In order for the IGGUIPanCtl Control to function, you must call the SetParentImage() method. This connects the control to the image that it will be magnifying, and causes the initial display of the magnified image to appear.
The application programmer must handle mouse events from the parent image's IGPageViewCtl Control, and call methods of the IGGUIPanCtl Control as follows:
IMPORTANT VB INFORMATION: The x and y coordinate reported in this event handler will be in units of "twips". A twip is 1/20th of a printer's point. A printer's point is 1/70th of an inch; thus a twip is 1/140th of an inch. These coordinates MUST be converted to pixels prior to calling the NewPosition method, by using the ScaleX and ScaleY VB functions as follows: Dim newX As Long newX = ScaleX(X, vbTwips, vbPixels) Dim newY As Long newY = ScaleY(Y, vbTwips, vbPixels) This is only necessary when the control is used in VB applications. |
The SetParentImage method should be called in the FormLoad handler for the form that contains the IGGUIPanCtl Control.