Results 1 to 2 of 2

Thread: how to detect the PictureBox On Click events.

  1. #1

    Thread Starter
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Question How to detect a portion image is being click.

    Does anyone know how can I detect a portion of the image is
    being click? Whereby the image is created through
    the BitBlt API function. My code is show below:

    Code:
    Option Explicit
    Private Type Btn
        xw As Long
        xh As Long
        xhDC As Long
    End Type
    Private xButton(10) As Btn
    Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    
    Private Sub Form_Load()
    picMask.Move 0, 0, frmMain.Width, frmMain.Height
    xButton(0).xw = picButton.Width / 2
    xButton(0).xh = picButton.Height
    xButton(0).xhDC = picButton.hDC
    End Sub
    
    Private Sub CreateScene()
    DoEvents
    BitBlt picMask.hDC, 0, 0, picMask.Width, picMask.Height, picVSideBar.hDC, 0, 0, vbSrcCopy
    BitBlt picMask.hDC, 20, 210, picMask.Width, picMask.Height, picHSideBar.hDC, 0, 0, vbSrcCopy
    
    'Create Exit Button
    BitBlt picMask.hDC, 1, 20, xButton(0).xw, xButton(0).xh, xButton(0).xhDC, xButton(0).xw, 0, vbSrcPaint
    BitBlt picMask.hDC, 1, 20, xButton(0).xw, xButton(0).xh, xButton(0).xhDC, 0, 0, vbSrcAnd
    
    BitBlt frmMain.hDC, 0, 0, frmMain.Width, frmMain.Height, picMask.hDC, 0, 0, vbSrcCopy
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    TmrDrawScene.Enabled = False
    End Sub
    
    Private Sub TmrDrawScene_Timer()
    CreateScene
    End Sub
    I hope you can get what I mean. I want to detect the
    PicButton_Click events. After the picture from the
    PicButton (PictureBox) is being merge with others picture from picVSideBar (PictureBox).

    Again, it is we must always set the ScaleMode to Pixel? can
    we set it to others like Twip or Milimeters.

    Thanks for you feedback.

  2. #2
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    Use a nice picture box with 2
    shapes in the picturebox.. Make
    the shapes seethru and then
    when the shapes are clicked on
    you can do what you want..

    Will that work?
    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width