CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    1

    Picture Control - I need scrollbars!

    Hey everyone,
    I am using MFC and have a Picture Control on my dialog. I display picture in it - but the problem is the Picture Control resizes all over my dialog! Of course I want the image only to be within my predefined border and it should have scrollbars to scroll through it.

    I read all links from google's 1st page on "MFC picture control scrollbars" but nonetheless couldn't solve my issue. I found a reference to CScrollView though and someone said I should use that. But I am not sure how I could make a new Picture Control using that? Should I make new class and put it on my form programatically?

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Picture Control - I need scrollbars!

    That's it, a Windows static (picture) control is designed to be very simple and does'n support scroll capabilities.
    However, you can do it yourself: derive from CStatic MFC class, then implement scrolling.

    About CScrollView: a view is designed to sit in a frame, in a SDI/MDI framework. Although it is not impossible to place it in a dialog (as you are doing with a control), this is not a good idea.
    So, if you want an image with scroll in a dialog window, first option is better.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Picture Control - I need scrollbars!

    Maybe this thread can put you on the right track.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

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