Rapid-Q Documentation by William Yu (c)1999-2000,  appended by D.Glodt (c)2000-2004, John Kelly Appendix A: QIMAGE

QIMAGE Component

QImage is used to display a graphical image (BMP/ICON). It can also be used to draw primitive graphics. Load a BMP file or BMP handle to set the Width and Height of a newly created QIMAGE.
 If you have RAPIDQ2.INC then it supports QIMAGEex that gives you clipboard functions, copy to clipboard is possible if image was loaded with LoadFromFile method. You can load other graphic formats (JPG, GIF, TGA, etc.) if the DLL Nviewlib is present (check the internal variable NViewLibPresent is true). 

QImage Properties
Field Type R/W Default




Align INTEGER RW alNone
Align determines how the control aligns within its parent control.
Autosize INTEGER RW False
AutoSize determines whether the image control resizes to accommodate the image it displays.
BMP STRING RW
Use BMP to assign a new bitmap file, or to store BMP in the image cache.
Examples:
DIM Image AS QIMAGE
Image.BMP = "whatever.bmp"
BMPHandle RESOURCE W
Center INTEGER RW False
Center positions the image so that it is centered in the image control.
CopyMode INTEGER RW cmBlackness
Cursor INTEGER RW crDefault
Enabled INTEGER RW True
Font QFONT W
Handle INTEGER RW
Height INTEGER

Load a BMP file or BMP handle to set the Width and Height of a newly created QIMAGE.
RW
Hint STRING RW
ICOHandle RESOURCE   (you cannot drawon top of icon images with draw. line., etc.) W
Icon STRING W
IncrementalDisplay INTEGER RW False
IncrementalDisplay specifies whether partial renderings of the image are drawn periodically during slow operations or on large compressed images.
Left INTEGER RW 0
Parent QFORM/QPANEL/QTABCONTROL W
Pixel 2D ARRAY of INTEGER RW
PopupMenu QPOPUPMENU W
ShowHint INTEGER RW False
Stretch INTEGER RW False
Stretch resizes the image so that it exactly fits the bounds of the image control.
Tag INTEGER RW
Top INTEGER RW 0
Transparent INTEGER RW False
Width INTEGER

Load a BMP file or BMP handle to set the Width and Height of a newly created QIMAGE.
RW
Visible INTEGER RW True

QImage Methods
Method Type Description Params




Center SUB Centers image 0
Circle SUB (x1%, y1%, x2%, y2%, c%, fill%) Draw & Fill Circle 6
CopyRect SUB (D, Image, S) D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap 3
Draw SUB (x%, y%, BMP) Draw Bitmap at (X,Y) 3
FillRect SUB (x1%, y1%, x2%, y2%, c%) Draws & Fills a rectangle 5
Line SUB (x1%, y1%, x2%, y2%, c%) Draws a line 5
Paint SUB (x%, y%, c%, borderc%) Fill Region 4
Pset SUB (x%, y%, c%) Pixel plot 3
Rectangle SUB (x1%, y1%, x2%, y2%, c%) Draws a rectangle 5
Repaint SUB Force repainting of image 0
Rotate SUB (xOrigin%, yOrigin%, Angle%) Rotates entire image at specified origin 3
RoundRect SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) Draws & Fills a rounded rectangle 7
StretchDraw SUB (Rect AS QRECT, BMP) Draw BMP and stretch to fit inside Rect 2
TextHeight FUNCTION (Text$) AS WORD Returns the height, in pixels, of Text$ string 1
TextWidth FUNCTION (Text$) AS WORD Returns the width, in pixels, of Text$ string 1
TextRect SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) Write text, and clip within region Rect 6
TextOut SUB (x%, y%, S$, fc%, bc%) Writes text to image 5


QImage Events
Event Type Occurs when... Params




OnClick VOID User clicked on image 0
OnDblClick VOID User double clicked on image 0
OnMouseDown SUB (Button%, X%, Y%, Shift%) Mouse button held down 4
OnMouseMove SUB (X%, Y%, Shift%) Mouse moves 3
OnMouseUp SUB (Button%, X%, Y%, Shift%) Mouse button is released 4
*NOTE, none of the EVENTS work in arrays of QImage, use QCanvas instead


QImage Examples
  '-- How to use a resource file

  CONST False = 0
  CONST True = 1

  $RESOURCE RES_BMP1 AS "C:\WINDOWS\CLOUDS.BMP"

  DIM Form AS QForm
  DIM Image AS QImage

  Image.Parent = Form
  Image.Autosize = True
  Image.BMPHandle = RES_BMP1
  Form.ShowModal


Prev Component Contents Next Component