| **Navigation:**  [[advanced topics 1.htm|Advanced Topics]] > Clarion Language Utilities >====== ResizeImage (Resize an image to fit a control) ====== | [[removedirectory remove a directory .htm|{{btn_prev_n.gif|Previous page}}]][[advanced topics 1.htm|{{btn_home_n.gif|Return to chapter overview}}]][[shorttohex convert an unsigned short to hexadecimal .htm|{{btn_next_n.gif|Next page}}]] | | || **RESIZEIMAGE(**// Control, XPos, YPos, Width, Height, <;Report>)// {{blk2blue.jpg|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**