rtf alignment problem

Posted on 2005-05-13
Last Modified: 2010-05-18
hi Experts
I am trying to add text to an existing rtf file using richtextbox in vb6 The rtf i am trying to add text to has a large font
label center aligned. I want the text following this label to be left aligned. Seems i only have a problem when the enter key is
not pressed after entering the large label.
Here is what i have tried:
myrtf.selstart = len(myrtf.text) +1

myrtf.seltext = vbcrlf & "some text" <-This would inherit the center alignment

myrtf. SelAlignment = rtfLeft <-this moves the large label and added text to the left. This also makes the new text the same size and color of the large centered label

How can i add left aligned text under this centered large font label ? and not inherit it's  font and color?
Question by:isnoend2001
    LVL 19

    Accepted Solution

    myrtf.SelFontName = "Arial Narrow"
    myrtf.SelFontSize = 36
    myrtf.SelBold = True
    myrtf.SelText = "Big Label"
    myrtf.SelAlignment = rtfCenter
    myrtf.SelStart = Len(myrtf.TextRTF) + 1
    myrtf.SelFontName = "Times New Roman"
    myrtf.SelFontSize = 12
    myrtf.SelBold = False
    myrtf.SelText = vbCrLf & "My new text below the big label is the new text below the new label, that is my new text below the big label."
    myrtf.SelAlignment = 0


    Author Comment

    Thanks Shauli
    That works

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now