Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27508

How to Convert RichText to RTF, I dont know exactly What the method is called?

$
0
0
Hello! Today by help of a good friend I managed to send text to another Chat Window using the method below:
Code:

Result = SendMessageByString(ControlHandle, WM_SETTEXT, str.Length, str)
I simply sent a colored text: "This is Just a Test"

After sending the text, the next thing happened was that the text appears with the following code:
Code:

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma
{\colortbl ;\red255\green0\blue0;\red174\green0\blue81;\red107\green0\blue148;\red40\green0\blue215;}
\viewkind4\uc1\pard\cf1\lang1030\b\f0\fs24 This\cf2  is J\cf3 ust a\cf4  Test\cf0\par
}

A good friend of mine helped me to solve half of it by showing me how to send the Text in just Plane and dark text.
And this is the code that I am using the Convert the text in normal text and convert it befor sending it:

Code:

Private Sub SendTxt(ByVal ControlHandle As IntPtr, ByVal str As String)
        Dim Result As Integer
        Dim RTB As New RichTextBox
        RTB.Rtf = str
        Dim sText As String = RTB.Text
        Result = SendMessageByString(ControlHandle, WM_SETTEXT, sText.Length, sText)
    End Sub


So the code above works sending just a plane normal text, with no colors or bold. But I want to know how I can send it in colors, just like using the RichTextBox Coloring and Text.. I am really new to this, and after searching and searching I couldnt find a direct Convertation of this!

Is there anyway to Convert the text befor sending it out in simple RichText. Or is there any Class or Modules out there that can do the job by Converting RichText to what the method is called, RTF or what ever...

Thank you very much in advance

Viewing all articles
Browse latest Browse all 27508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>