CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2000
    Location
    Germany
    Posts
    645

    picturebox , scrolling image on mouse move

    Hi

    Jumped to C# now from C++


    Any tips on programming how to scroll a picture image in a picture box control ?

    Regards

  2. #2
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: picturebox , scrolling image on mouse move

    Do you simply want to show scroll bars in the control or something more fancy?
    It's not a bug, it's a feature!

  3. #3
    Join Date
    Nov 2000
    Location
    Germany
    Posts
    645

    Re: picturebox , scrolling image on mouse move

    Its a simple application which has a picturebox control

    and the image is loaded OnLoad

    i have added vscroll and hscroll bars and i can scoll with these bar on mouse click

    i just need to make the image scroll on mouse wheel events

    i m getting into grip how to handle mousewheel events

    and one more que. how to add events in Visual C#Express 2008

    i m used to that old MFC styl in VC6 of adding events from classwizard which is somewhat missing in Visual C#Express 2008

    regards

  4. #4
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: picturebox , scrolling image on mouse move

    The scrollbars:

    Add a Panel control to your form.
    Place the Picturebox inside this panel (Do not use the "Dock in Parent container property!).
    Set the Panel's Autoscroll property to True.
    Set the Picturebox's SizeMode property to AutoSize.
    Done.

    To handle events in Visual Studio 2008, access the properties for the control you wish to handle an event, then click the Events tab (lightning icon) and select the event you want to hande from the list.

    I'm used to working in VS2005 so there might be some small changes
    It's not a bug, it's a feature!

  5. #5
    Join Date
    Nov 2000
    Location
    Germany
    Posts
    645

    Re: picturebox , scrolling image on mouse move

    thanx for that

    but what u told is already done

    i wanted to know how to scroll down with mousewheel i.e middle mouse wheel

    in your solution when i set autoscroll to true , the mouse wheel scroll does not work

  6. #6
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: picturebox , scrolling image on mouse move

    Excellent question. I must have misunderstood you...

    I'm sorry to say that I have no knowledge of how to solve this
    It's not a bug, it's a feature!

  7. #7
    Join Date
    May 2006
    Posts
    306

    Re: picturebox , scrolling image on mouse move

    Ah, yes... I would think that you could add a hidden panel on top and on bottom, so when the mouse is on those, it automatically scrolls up or down.

    I wish they had a mousescroll event.

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

Featured