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

    How to add zoom?

    I am now doing a project that need to provide zoom view with different percentage...
    Can anyone help me in solving this problem?
    I am new to Visual C++ , so don't know those function provide by it.
    Thanks in advance


  2. #2
    Guest

    Re: How to add zoom?

    Before performing any kind out text drawing routine, select in a font that is
    sized according to some zoom factor. You will need to ensure to create the
    fonts before painting, select the fonts into the device context, perform the
    necessary text drawing, restore the previous font into the device context and
    finally delete the font previously created. When you create the font, size it
    to some zoom factor that the user has control over. For any bitmaps, you will
    need to scale them using this zoom factor as well.

    If you have used the MFC Doc/View architecture and all of your painting/drawing
    occurs within some view's OnDraw(), it shouldn't be too difficult.




  3. #3
    Join Date
    May 1999
    Posts
    4

    Re: How to add zoom?

    If you perform all your drawing in the OnDraw() function, all you need to do is set values to SetWindowExt() and SetViewportExt() in your OnPrepareDC().

    For intance, if you set a value of SetWindowExt(100, 100) and SetViewportExt(100, 100) also, you get a 100% zoom. All you need to do then, is to keep SetWindowExt(100, 100) and change SetViewportExt(75, 75) to get a 75% zoom. See? you have to combine values with these functions to scale to whatever value you want.

    This is independent from the values you have assigned to your view with functions like SetScrollSizes() or SetScaleToFitSize() during window construction. The combination of values in SetWindowExt() and SetViewportExt() just make your pixels look bigger or smaller, but doesn't modify the actual size of your window.

    I hope this can help you.

    Xexi
    "Life's a journey, not a destination"

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