Results 1 to 2 of 2

Thread: right click/image over image

  1. #1

    Thread Starter
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    How would you put an image over another image?
    I tried a picturebox over another but you saw the square of the object over the form, but I would like to be able to see just the image in front. Also, how do you make a right click menu popup, so that when you right click a text box, you would get a menu where your mouse is that has items that you can specify? Thanks
    retired member. Thanks for everything

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Use an image control with no borders and just load different images when you want to.
    Set Image1.Picture = LoadPicture(C:\myfolder\myfile.jpg")

    as for the textbox stuff:
    Code:
    'get rid of popup for text box on right click
    '
    '<<<<<<<<<< put this in a bas module  >>>>>>>>>>>>>>>>>>
    '
    
    Option Explicit
    
    Public Declare Function CallWindowProc Lib "user32" _
    Alias "CallWindowProcA" _
    (ByVal lpPrevWndFunc As Long, _
    ByVal hWnd As Long, _
    ByVal Msg As Long, _
    ByVal wParam As Long, _
    ByVal lParam As Long) As Long
    
    Public Declare Function SetWindowLong Lib "user32" _
    Alias "SetWindowLongA" _
    (ByVal hWnd As Long, _
    ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
    
    Public Const GWL_WNDPROC = -4
    Public Const WM_RBUTTONUP = &H205
    Public lpPrevWndProc As Long
    Public lngHWnd As Long
    
    Public Sub Hook(hWnd As Long)
    lngHWnd = hWnd
    lpPrevWndProc = SetWindowLong(lngHWnd, GWL_WNDPROC, _
    AddressOf WindowProc)
    End Sub
    
    Public Sub UnHook()
    Dim lngReturnValue As Long
    lngReturnValue = SetWindowLong(lngHWnd, GWL_WNDPROC, _
    lpPrevWndProc)
    End Sub
    
    Public Function WindowProc(ByVal hw As Long, _
    ByVal uMsg As Long, _
    ByVal wParam As Long, _
    ByVal lParam As Long) As Long
    
    Select Case uMsg
    Case WM_RBUTTONUP
    'Do nothing
    'Or popup your own menu
    Case Else
    WindowProc = CallWindowProc(lpPrevWndProc, hw, _
    uMsg, wParam, lParam)
    End Select
    End Function
    
    ' <<<<<<<<<<<<<<<<   form code  >>>>>>>>>>>>>>>>>>>>>
    
    'Add the following code to the Form_Load event of the form where the text box is placed:
    
    Call Hook(Text1.hWnd)
    'Where Text1 is the name of the text box you want to Subclass.
    
    'Add the following code to the Form_Unload event:
    
    Call UnHook
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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