draw a horizontal line in richtextbox using vb6

Is it possible to draw a horizontal line in a RichTextBox at the cursor position, using VB6.
 The only answers i found was using the " - " or " _ " character.
But i' d like to draw a real line.
 Thanks
isnoend2001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
The best way to do so is by using the Clipboard.
Clipboard.Clear
Clipboard.SetText "Hello", vbCFRTF
Text1.SelText = Clipboard.GetText(vbCFRTF)
Clipboard.Clear

Open in new window

Now you need to decide which method will you use to draw the line. The RTF cookbook here says that there are a few methods to draw the horizontal line. Which one works I do not know, let's assume this one works:
{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}
{\pard\par}

Open in new window

Please note that when creating the clipboard entry with a code you need to add the "{rtf" in the beginning. I assume this code will work:
Clipboard.Clear
Clipboard.SetText "{\rtf1 " & vbCrLf & _
"{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}" & vbCrLf & _
"{\pard\par}"  & vbCrLf & _
"}", vbCFRTF
Text1.SelText = Clipboard.GetText(vbCFRTF)
Clipboard.Clear

Open in new window

I have not tested it, but it should work. I have done a similar thing in the past (I have used the C++)
isnoend2001Author Commented:
Thanks,but that does not work
Private Sub Label_Click()
Clipboard.Clear
Clipboard.SetText "{\rtf1 " & vbCrLf & _
"{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}" & vbCrLf & _
"{\pard\par}" & vbCrLf & _
"}", vbCFRTF
rtfTask.SelText = Clipboard.GetText(vbCFRTF)
Clipboard.Clear


End Sub
chaauCommented:
I assume the vb6's rtf control does not support the horizontal line. Let's test it. Create a new text document using notepad and type this there:
{\rtf1
 {\pard \brdrb \brdrs \brdrw10 \brsp20 \par}
 {\pard\par}
 }
Save the file as doc.rtf. Now, if you open with word it will display the line. If you open with WordPad the line will not be displayed. Open it with word. Select all and copy into your app. Did the line copy across?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

isnoend2001Author Commented:
The line showed in Word. but not the richtextbox in vb
chaauCommented:
So, in this case you need to find a way to draw it using the rtf. Ehen you find it use the co I have provided to paste it there

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
thanks for your attempts
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.