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. :)