Results 1 to 13 of 13

Thread: RichTextBox and Zoom Levels

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    RichTextBox and Zoom Levels

    Does anyone know how to adjust the zoom levels on a richtextbox control without having to do a .FontSize to the entire control?

    I need to know how to access the same zoom levels you would get if you were to hold in your ctrl button and scrolled the wheel on your mouse.

  2. #2
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: RichTextBox and Zoom Levels

    There is no easy way to do this. If you want to do this (with more than just text) then you would have to write the code yourself.

    The easiest way is to just change the .fontsize of everything. Why wouldn't this work for you?

    EDIT: But here is a magnification glass if you are interested: http://www.vbforums.com/showthread.php?t=368322
    Last edited by eyeRmonkey; Nov 4th, 2005 at 04:27 PM.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    Re: RichTextBox and Zoom Levels

    If would it stay in relation and work with the ctrl-scroll I would.

    I know that there is a zoom property in RichTextBox - its actually in the coding for RTF, I just can't recall what it is and how to access it.

  4. #4
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: RichTextBox and Zoom Levels

    What do you mean relation? Do you have things other than text in your RTB?

    Getting it to work with Ctrl+Scroll wouldn't be too hard. You would have to set a global flag for KeyPress. Although, I am not sure how you would recognize mouse-wheel scroll event. I'll do some searching and let you know if I come up with anything.


    As far as a zoom property in RTF, I don't know. One way to find out would be to edit a .RTF document in WordPad and do something to change the zoom property then view the .RTF in notepad to see all the RTF formatting characters and see if you can find what RTF tag is used to zoom. After that you could edit the .TextRTF property and insert this zoom porperty.

    In the long run I'm not sure its worth it because you still have to catch the mouse-wheel scroll event and if you have that you might as well change the font size.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    Re: RichTextBox and Zoom Levels

    Good idea about using the word document, I'll look into that.

    The reason I want it to act with the ctrl-scroll, it because the RichTextBox control already responds to it. I need it seperate from a regular Font because I dont want the end user to have the impression he's changing the html font size (once I convert it). I just want the display to increase or decrease.

    With any luck, I'll be able to grab the zoom value of the document and put it into a checkbox in the toolbar. Then the end user change it using one of the two methods. I guess a good example would be like in Internet Explorer, where you can change the text size. (View > Text Size). It changes the display, but doesn't change any of the formatting on the page.

    The richtextbox would only be containing text, so there wouldn't be a need to try and resize anything else.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    Re: RichTextBox and Zoom Levels

    Ok, thanks for the help, I think I have it.

    \viewscaleN Zoom level of the document; the N argument is a value representing a percentage (the default is 100).

    Once I can achive what I'm looking to do, I'll post an example - incase anyone is ever looking to do the same thing.

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: RichTextBox and Zoom Levels

    You might want to look at this

    RichtextBox Supported RTF Codes

  8. #8
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: RichTextBox and Zoom Levels

    Here is an example of a class that recognizes the middle scroll wheel: http://www.vbaccelerator.com/home/VB...er/article.asp (download the code from the link in the nav bar on the left)
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  9. #9
    Lively Member Mahdi Jazini's Avatar
    Join Date
    Feb 2014
    Location
    Iran / Tehran
    Posts
    89

    Re: RichTextBox and Zoom Levels

    I didn't find any \viewscaleN in the textrtf !!!

    But I have found the way right now

    It's so easy...

    Actually, The Classic Richtextbox doesn't support any Zoom property

    But, if you add VBCCR13.OCX to your project, all your problems will be resolved...

    There is an upgraded Richtextbox in it that also supports unicode

    in the Richtextbox there is this property: .ZoomFactor

    The VBCCR13.OCX has been created by @Krool and you can request @Krool to send you OR you can download its open source project from here:

    http://www.vbforums.com/showthread.p...mmon-controls)

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: RichTextBox and Zoom Levels

    How are you finding these?

    This thread is nearly 12 years old, and the original poster hasn't been around for nearly the same length of time, while the other respondents have been inactive for more than four years. I'm pretty sure that they have moved on from the problem in that amount of time, or at least aren't expecting an answer.
    My usual boring signature: Nothing

  11. #11
    Lively Member Mahdi Jazini's Avatar
    Join Date
    Feb 2014
    Location
    Iran / Tehran
    Posts
    89

    Re: RichTextBox and Zoom Levels

    Quote Originally Posted by Shaggy Hiker View Post
    How are you finding these?

    This thread is nearly 12 years old, and the original poster hasn't been around for nearly the same length of time, while the other respondents have been inactive for more than four years. I'm pretty sure that they have moved on from the problem in that amount of time, or at least aren't expecting an answer.
    And I'm sure too, but i think i must do this because a day someone like me searches internet to find a solution and my answer saves his time Time is very important... even 1 second... YOLO

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: RichTextBox and Zoom Levels

    The forum is certainly a resource, and all threads past and present do provide a benefit for anybody who is searching. But it would be much better if you not resurrect threads that are more than a few months old. For one thing, this can end up spamming anybody who was subscribed to the thread and hadn't removed the subscription. They'll get an email for each new post to the thread, including this one, which is at least occasionally unwelcome. It may well be argued that it is their fault for not unsubscribing, but it's something of a common courtesy to let the thread rest in peace once it has faded away.
    My usual boring signature: Nothing

  13. #13
    Lively Member Mahdi Jazini's Avatar
    Join Date
    Feb 2014
    Location
    Iran / Tehran
    Posts
    89

    Re: RichTextBox and Zoom Levels

    Quote Originally Posted by Shaggy Hiker View Post
    The forum is certainly a resource, and all threads past and present do provide a benefit for anybody who is searching. But it would be much better if you not resurrect threads that are more than a few months old. For one thing, this can end up spamming anybody who was subscribed to the thread and hadn't removed the subscription. They'll get an email for each new post to the thread, including this one, which is at least occasionally unwelcome. It may well be argued that it is their fault for not unsubscribing, but it's something of a common courtesy to let the thread rest in peace once it has faded away.
    Please accept my apologies

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