User Tools

Site Tools


resizeimage_resize_an_image_to_fit_a_control_.htm
Navigation:  Advanced Topics > Clarion Language Utilities >====== ResizeImage (Resize an image to fit a control) ====== Previous pageReturn to chapter overviewNext page

RESIZEIMAGE( Control, XPos, YPos, Width, Height, <;Report>)

blk2blue.jpg

RESIZEIMAGE Resize a valid graphic file to fit inside a target IMAGE control
Control The Field Equate Label of the target IMAGE control.
Xpos A SHORT constant or variable identifying the horizontal position of the top left corner of the target IMAGE control in dialog units.
Ypos A SHORT constant or variable identifying the vertical position of the top left corner of the target IMAGE control in dialog units.
Width A SHORT constant or variable identifying the width of the target IMAGE control in dialog units.
Height A SHORT constant or variable identifying the height of the target IMAGE control in dialog units.
Report A valid label of a REPORT structure. Indicates that the control to store the resized image is contained in a REPORT target instead of a WINDOW

RESIZEIMAGE is used to resize the image to fit the original control size. If an image is larger than the target control, the image will be reduced to fit the target control's position parameters. If an image is smaller than the target control, the image will be expanded to fit the target control's position parameters.

To add support for this utility to your existing applications, you need only include the CWUTIL.INC file in the Global Map section of your program:

INCLUDE('CWUTIL.INC'),ONCE

Example:

  CASE ACCEPTED()

   OF ?LookupFile

     ThisWindow.Update

     LOC:Filename = FileLookup9.Ask(0)

     DISPLAY

     IF LOC:Filename

        ?Image1{PROP:TEXT} = LOC:Filename      !Move filename to image field

        ResizeImage(?Image1,114,132,90,64)     !Resize it

     END

   OF ?OK

     ThisWindow.Update

     IF SELF.Request = ViewRecord AND NOT SELF.BatchProcessing THEN

        POST(EVENT:CloseWindow)

     END

  END

resizeimage_resize_an_image_to_fit_a_control_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1