Guidance
指路人
g.yi.org
software / rapidq / Examples / QObject / Object / QDrawMenu.html

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Appendix A: QDrawMenu  
Documentation component by D.Glodt (c)2001-2003 Appendix A: QDrawMenu

QDrawMenu Component

QDrawMenu is used to draw bitmap in an item of menu.


QDrawMenu Properties

Field Type R/W Défault





QDrawMenu Methods

Method Type Description Params





AddBitmap SUB(SubMenu as QMenuItem,Item as QMenuItem,Picture as Qbitmap,Button as boolean,Backcolor as long) Add a bitmap to item menu 5
The Button parameter determines if it is necessary to reveal  a button has the selection, the Backcolor parameter determines the  color of transparency of the bitmap 
DelBitmap SUB(SubMenu as QMenuItem,Item as QMenuItem) Delete a bitmap from item menu 2
MenuProc SUB(hwnd&,uMsg&,wParam&,lParam&) Procédure de menu 4
This méthod must be set to event WndProc from QForm component

QDrawMenu Events

Event Type Occurs when... Params





QDrawMenu Examples

$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"
$INCLUDE "Object\QDrawMenu.INC"
$RESOURCE New_bmp as "New.bmp"
$RESOURCE Open_bmp as "Open.bmp"
$RESOURCE Save_bmp as "Save.bmp"
$RESOURCE Exit_bmp as "Exit.bmp"
$RESOURCE Cut_bmp as "Cut.bmp"
$RESOURCE Copy_bmp as "Copy.bmp"
$RESOURCE Paste_bmp as "Paste.bmp"
$RESOURCE Empty_bmp as "Empty.bmp"

declare SUB MenuItemClick (Sender AS QMENUITEM)
declare SUB Show

dim menu as qdrawmenu
dim picture as qbitmap

CREATE Form AS QForm
  Center
  Caption = "Ownerdraw Menus"
  OnShow=show
  WndProc=menu.MenuProc
 CREATE MainMenu AS QMainMenu
    CREATE FileMenu AS QMenuItem
      Caption = "&File"
      CREATE OpenItem AS QMenuItem
       Caption = "&Open"
       OnClick=MenuItemClick
      END CREATE
      CREATE NewItem AS QMenuItem
        Caption = "&New"
        OnClick=MenuItemClick
      END CREATE
      CREATE BreakItem AS QMenuItem
        Caption = "-"
      END CREATE
      CREATE ExitItem AS QMenuItem
        Caption = "E&xit"
        OnClick=MenuItemClick
      END CREATE
    END CREATE
    CREATE EditMenu AS QMenuItem
      Caption = "&Edit"
      CREATE CutItem AS QMenuItem
        Caption = "&Cut           Ctrl+X"
        OnClick=MenuItemClick
        ShortCut="CTRL+X"
      END CREATE
      CREATE CopyItem AS QMenuItem
        Caption = "&Copy        Ctrl+C"
        OnClick=MenuItemClick
        ShortCut="CTRL+C"
      END CREATE
      CREATE PasteItem AS QMenuItem
        Caption = "&Paste       Ctrl+V"
        OnClick=MenuItemClick
        ShortCut="CTRL+V"
      END CREATE
      CREATE SelectItem AS QMenuItem
        Caption = "&Select all  Ctrl+A"
        OnClick=MenuItemClick
        ShortCut="CTRL+A"
      END CREATE
    END CREATE
    CREATE Aff AS QMenuItem
      caption="show"
    END CREATE
  END CREATE
END CREATE
Form.ShowModal

Sub Show
  picture.bmpHandle=Open_bmp
  menu.AddBitmap(FileMenu,OpenItem,picture,true,&hC0C0C0)
  picture.bmpHandle=New_bmp
  menu.AddBitmap(FileMenu,NewItem,picture,true,&hC0C0C0)
  picture.bmpHandle=Exit_bmp
  menu.AddBitmap(FileMenu,ExitItem,picture,true,&hC0C0C0)
  picture.bmpHandle=cut_bmp
  menu.AddBitmap(EditMenu,CutItem,picture,true,&hC0C0C0)
  picture.bmpHandle=copy_bmp
  menu.AddBitmap(EditMenu,copyItem,picture,true,&hC0C0C0)
  picture.bmpHandle=paste_bmp
  menu.AddBitmap(EditMenu,pasteItem,picture,true,&hC0C0C0)
  picture.bmpHandle=empty_bmp
  menu.AddBitmap(EditMenu,SelectItem,picture,false,&hFFFFFF)
End Sub

SUB MenuItemClick (Sender AS QMENUITEM)
  ShowMessage("Thanks for clicking " + Sender.Caption)
END SUB
 
 
 

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-10-8  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-02-09 18:46:44