Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / imageclick.bas

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

  
'Bmp has a size (55 x 50). Inside this bmp is one hexagon. I need to use the
'area inside this hexagon, not the full area of bmp. For example I need to
'use methods like OnClick or OnMouseMove only if mouse pointer is inside this
'hexagon.

'From:   "dakodamc"  Wed Oct 8, 2003  10:00 pm

'Oh one other thing you could do, if you make the hexagon a different
'color than the background you could always just check the pixel color
'under the cursor to see if you were over the hex.


     $INCLUDE "RAPIDQ.INC"
     $RESOURCE RES_BMP1 AS "hex.bmp"
     DECLARE SUB imageclick (Button%, X%, Y%, Shift%)

     CREATE Form1 AS QFORM
      COLOR = QBColor(2)
      WindowState = 2
     END CREATE

     CREATE Image1 AS QIMAGE
      Width = 142
      Height = 146
      Top = 100
      Left = 100
      BMPHandle = RES_BMP1
      PARENT = Form1
      onmousedown = imageclick
     END CREATE

     Form1.SHOWMODAL

     SUB imageclick (Button%,X%, Y% , Shift%)
      IF Image1.pixel(X%, Y%) = image1.pixel(image1.width/2, _
       image1.height/2) THEN
'point clicked is same color as middle of bmp
       form1.CAPTION = "hex clicked"
      ELSE
       form1.CAPTION = "not hex clicked"
      END IF
     END SUB
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-10-10 07:26:53