Results 1 to 3 of 3

Thread: HiperLink in RichTextBox with Dinamyc Code ???

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    10

    HiperLink in RichTextBox with Dinamyc Code ???

    Hello

    I need your help, how i can embed a Hiperlink or a button like heperlink in a RichTextBox ???

    The RichTextBox must open a PDF File, the Hiperlink or Button must be generated in a exact location of a text in a RichTextBox.

    Other cuestion :

    Can i justify the text in a RichTextBox ???

    Thanks a lot

  2. #2
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: HiperLink in RichTextBox with Dinamyc Code ???

    RichTextBox's can be very fun if you know what you're doing. I've had all sorts of colors and ASCII pictures in one RTB.

    As for the hyperlinks, I'm not completely sure. I'm thinking it'll have to be shelled to launch your PDF, but I couldn't help you on launching it from a text box.

  3. #3
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: HiperLink in RichTextBox with Dinamyc Code ???

    to justify text:
    VB Code:
    1. Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3. Const WM_USER = &H400
    4. Const EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202
    5. Const TO_ADVANCEDTYPOGRAPHY = 1
    6. Const EM_SETPARAFORMAT = WM_USER + 71
    7. Private Const PFA_LEFT = 1
    8. Private Const PFA_RIGHT = 2
    9. Private Const PFA_CENTER = 3
    10. Private Const PFA_JUSTIFY = &H4
    11. Const MAX_TAB_STOPS = 32
    12. Private Type PARAFORMAT2
    13.     cbSize                     As Long
    14.     dwMask                     As Long
    15.     wNumbering                 As Integer
    16.     wEffects                   As Integer
    17.     dxStartIndent              As Long
    18.     dxRightIndent              As Long
    19.     dxOffset                   As Long
    20.     wAlignment                 As Integer
    21.     cTabCount                  As Integer
    22.     rgxTabs(MAX_TAB_STOPS - 1) As Long
    23.     dySpaceBefore              As Long
    24.     dySpaceAfter               As Long
    25.     dyLineSpacing              As Long
    26.     sStyle                     As Integer
    27.     bLineSpacingRule           As Byte
    28.     bOutlineLevel              As Byte
    29.     wShadingWeight             As Integer
    30.     wShadingStyle              As Integer
    31.     wNumberingStart            As Integer
    32.     wNumberingStyle            As Integer
    33.     wNumberingTab              As Integer
    34.     wBorderSpace               As Integer
    35.     wBorderWidth               As Integer
    36.     wBorders                   As Integer
    37. End Type
    38. Public Enum ERECParagraphAlignmentConstants
    39.    ercParaLeft = PFA_LEFT
    40.    ercParaCentre = PFA_CENTER
    41.    ercParaRight = PFA_RIGHT
    42.    ercParaJustify = PFA_JUSTIFY
    43. End Enum
    44. Private Const PFM_ALIGNMENT = &H8&
    45.  
    46. Private Function SetAlignment(lHwnd As Long, ByVal eAlign As ERECParagraphAlignmentConstants)
    47.     Dim tP2 As PARAFORMAT2
    48.     Dim lR As Long
    49.     tP2.dwMask = PFM_ALIGNMENT
    50.     tP2.cbSize = Len(tP2)
    51.     tP2.wAlignment = eAlign
    52.     lR = SendMessageLong(lHwnd, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY)
    53.     lR = SendMessage(lHwnd, EM_SETPARAFORMAT, 0, tP2)
    54. End Function
    55.  
    56. Private Sub Form_Load()
    57.     SetAlignment RichTextBox1.HWND, ercParaJustify
    58. End Sub

    I am not sure if RTB can read PDF files, but if you know how to do it, you have to make RTB detect hyperlinks. Check Moeur's RTB tips and tricks - AutoDetect and Respond to URLs
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width