Documentation component by D.Glodt (c)2000-2004 Appendix A: QImageEx

QImageEx Component

QImageEx is a component as QImage with clipboard functions.
Image copy to clipboard is possible if image has loading with the  méthod LoadFromFile.
The loading of other graphic formats is possible if the DLL Nviewlib is present in the system window
or the directory of application.


QImageEx Properties
Field Type R/W Default




QImageEx Methods
Method Type Description Params




CopyToClipboard SUB(rect as QRECT) Copy image to clipboard 1
PasteFromClipboard SUB Paste image from clipboard 0
LoadFromFile SUB(FileName$,Width%,Height%,Real%) Load a bitmap file 4
If the parameter Real is at true, the image will load with
his dimensions.
CanPaste FUNCTION Return TRUE if image présent in the clipboard. 0
LoadOtherImage SUB(FileName$,Progress&,Language$) Load image from dll Nviewlib format 3
The parameter progress is use to display a bar of  progression 
during the loading of file.(true or false) 
The Language parameter corresponds to the language supported by
DLL

QImageEx Events
Event Type Occurs when... Params




QImageEx Examples

  $typecheck on
  $INCLUDE "Rapidq.inc" 
  $INCLUDE "Object\QImageEx.inc" 
  
  declare sub OuvrirClick 
  declare sub QuitterClick 
  declare sub Copier 
  declare sub Coller 
  declare sub Present 
  
  const title="Viewer picture" 
  dim source as QRECT 
  
  CREATE Form AS QFORM 
    Caption =title 
    Width = 600 
    Height = 600 
    Center 
    CREATE Menu AS QMAINMENU 
      CREATE item1 AS QMENUITEM 
        Caption="&Fichier" 
        CREATE item2 AS QMENUITEM 
          Caption="&Ouvrir" 
          OnClick=OuvrirClick 
        END CREATE 
        CREATE item5 AS QMENUITEM 
          Caption="-" 
        END CREATE 
        CREATE item6 AS QMENUITEM 
          Caption="&Quitter" 
          OnClick=QuitterClick 
        END CREATE 
      END CREATE 
      CREATE item11 as QMENUITEM 
        Caption="&Edition" 
        OnClick=Present
        CREATE item12 as QMENUITEM 
          Caption="&Copier" 
          OnClick=Copier 
        END CREATE
        CREATE item13 as QMENUITEM 
          Caption="&Coller" 
          OnClick=Coller 
          Enabled=false 
        END CREATE 
      END CREATE
    END CREATE 
    CREATE ScrollBox1 AS QSCROLLBOX 
      AutoScroll = 1 
      Align=5 
      Color = &HFFFFFF 
      CREATE image AS QImageEx 
        Autosize=1 
      END CREATE 
    END CREATE
  END CREATE 
  
  Form.ShowModal 
  
  sub OuvrirClick 
    dim file as QOPENDIALOG 
    
    file.Filter="Fichiers bitmap(*.bmp)|*.bmp" 
    file.InitialDir=CurDir$ 
    if file.Execute then 
      image.loadFromFile(file.fileName,0,0,true) 
      Form.Caption=title+"-"+file.FileName 
    end if 
  end sub 
  
  sub QuitterClick 
    Form.Close 
  end sub 
  
  sub Copier 
    source.left=0 
    source.top=0 
    source.right=image.width 
    source.bottom=image.height 
    image.copyToClipboard(source) 
  end sub 
  
  sub coller 
    image.pasteFromClipboard 
  end sub 
  
  Sub Present
    if image.canpaste then
      item13.enabled=true
    else
      item13.enabled=false
    end if
  End Sub
Hosted by uCoz