How to send the API SendMessage with the CHARFORMAT2 structure - wave undereline like word 
Author Message
 How to send the API SendMessage with the CHARFORMAT2 structure - wave undereline like word

How would you do this in C# ( from VB code I wrote to make the wave
underline like word):

Private Type CHARFORMAT2
    cbSize As Integer
    wPad1 As Integer

    dwMask As Long
    dwEffects As Long

    yHeight As Long

    yOffset As Long
    crTextColor As Long
    bCharSet As Byte
    bPitchAndFamily As Byte
    szFaceName(0 To LF_FACESIZE - 1) As Byte
    wPad2 As Integer

    ' Additional stuff supported by RICHEDIT20
    wWeight As Integer            ' /* Font weight (LOGFONT value)      */
    sSpacing As Integer           ' /* Amount to space between letters  */
    crBackColor As Long        ' /* Background color                 */
    lLCID As Long               ' /* Locale ID                        */
    dwReserved As Long         ' /* Reserved. Must be 0              */
    sStyle As Integer            ' /* Style handle                     */
    wKerning As Integer            ' /* Twip size above which to kern char
pair*/
    bUnderlineType As Byte     ' /* Underline type                   */
    bAnimation As Byte         ' /* Animated text like marching ants */
    bRevAuthor As Byte         ' /* Revision author index            */
    bReserved1 As Byte
End Type

Const WM_USER = &H400

Const EM_SETCHARFORMAT = (WM_USER + 68)

Const CFM_UNDERLINETYPE = &H800000

Const CFE_UNDERLINE = &H4&

Const CFM_UNDERLINE = &H4

Private Sub Command1_Click()

Dim CF2 As CHARFORMAT2
   With CF2
      .cbSize = LenB(CF2)
      .dwMask = CFM_UNDERLINETYPE
      .dwEffects = CFM_UNDERLINE
      .bUnderlineType = 88
   End With
   SendMessage rtfbox.hWnd, EM_SETCHARFORMAT, CFE_UNDERLINE, CF2

end sub

Changing the bUnderline to from 81 to 89 provides different underline styles
in red, Experiment with values between 19 to 89 and see the effects.

Patrick Blackman



Mon, 31 May 2004 11:12:19 GMT  
 How to send the API SendMessage with the CHARFORMAT2 structure - wave undereline like word
Patrick,

I have had my share of problems trying to get CHARFORMAT2 to work and use it with C#. What i ended up doing is making my RTF wrapper and writting the RTF codes I needed to the control using richTextBox1.SelectedRTF property. This can be complicated too, but it works.

fadi

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 31 May 2004 23:42:49 GMT  
 How to send the API SendMessage with the CHARFORMAT2 structure - wave undereline like word
Thanks , I will try that route.

Patrick,

I have had my share of problems trying to get CHARFORMAT2 to work and use it
with C#. What i ended up doing is making my RTF wrapper and writting the RTF
codes I needed to the control using richTextBox1.SelectedRTF property. This
can be complicated too, but it works.

fadi

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 01 Jun 2004 06:59:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. using shadow property of CHARFORMAT2 structure

2. Informative web sites about Win API in AUDIO WAVE

3. wave API

4. Wave API

5. Problem with Windows WAVE APIs

6. MFC message maps and wave API

7. About wave API

8. Compressed recording with wave API

9. How to send string with SendMessage?

10. Sending Keystrokes to applications using SendMessage()

11. intercept a message sent with SendMessage() ??

12. SendMessage API

 

 
Powered by phpBB® Forum Software