The AutoLisp Tutorial - DCL

Dialog Control Language - Image


Image


Image

  An Image is used to display a vector graphic picture inside a rectangle.  To create the image you can use three different methods. 

For this tutorial we will concentrate on the Slide_Image function.  Everyone knows how to create a slide right?  The MSLIDE command.  Okay.  We will assume our image is ready.

  Let's look at the DCL Image definition and the AutoLisp functions required to display the image.


  DCL - You must supply either the width and height or one of these plus an aspect_ratio.

: image {
  key = "sld";
  height = 30;
  width = 30; 

     color = 0;
  is_enabled = false;

  is_tab_stop = false;
}

AutoLisp

;;;--- First we need a slide name
(setq mySlideName "c:/acad/myslide.sld")

;;;--- Second we need the key to the image control
(setq myKey "sld")

;;;--- Next we send the slide name and the key to the update function
(upDateImage mySlideName myKey)

; NOTE: Notice mySlideName becomes sldName and myKey becomes key when passed
;       as parameters to the upDateImage function.

;;;--- Function to update the slide

(defun upDateImage(sldName key)         

  ;;;--- Get the width of the slide
  (setq width (dimx_tile key))

  ;;;--- Get the height of the slide
  (setq height (dimy_tile key))

  ;;;--- Start the slide definition
  (start_image key)

  ;;;--- Wipe out the background
  (fill_image 0 0 width height 0)

  ;;;--- Put the slide in the image area
  (slide_image 0 0 width height sldName)

  ;;;--- Finish the slide definition
  (end_image)

)

  This function can be used over and over to display any slide image in an image control.  Use the upDateImage  function after the new_dialog call and before the action_tile statements.  You can also use this function while the dialog box is displayed in one of your action calls.  We will use this later on in the tutorial so you can see it in action.


Back


AutoLisp Tutorial Home