RichTextBox with Zoom and alignment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gplana
    New Member
    • Oct 2006
    • 1

    #1

    RichTextBox with Zoom and alignment

    Hi all.

    I'm trying to create an application with a RichTextBox control in order to let user introduce a formatted text, and then I generate a word2007 .docx document with that text.

    I added the functionality to zoom in/out in this RichTextBox, sending the EM_SETZOOM message to it.

    The problem is that if I just send the message, the .SelAlignment = rtfRight goes out of the control.

    To solve that, I tried to set the .width property smaller proportionally to zoom (for example, if zoom is set to 50%, write .width = .width/2. Then alignment functionality works well, but text is wrapped into more lines, without filling all width of the control (if 50% zoom, letting the first left half of the control empty).

    Last try I test is to change richtextbox width via the EM_SETRECT message, but it seems not to have any effect (if I ask the rectangle dimensions after sending this EM_SETRECT message, by using EM_GETRECT message, I get exactly the same values they were before the EM_SETRECT message).

    So anyone knows how I can zoom in/out with alignment functionality and wrapping text working fine?

    Thank you very much in advance and excuse my english.

    Gabriel.
Working...