CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2004
    Posts
    14

    Question user control multiline property

    Currently i want to make some enhancement to my user control.
    in this enhancement i try to create a property where it can accept multiline string input value. you know...just like multiline property in textbox control, or list property in combo box.
    any answer woulb be appreciate


    Happy coding & Thanks

  2. #2
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    If I understood well you can look for the DrawText API.

    Here's an MSDN Example
    (I modified it in italian anyway is not important)

    Code:
    Private Sub Command1_Click()
        Dim lSuccess As Long
        Dim sPrintText As String
        Dim MyRect As RECT
        Form1.Font.Size = 12
        Form1.ScaleMode = vbPixels
        MyRect.Left = 0
        MyRect.Right = Form1.ScaleWidth
        MyRect.Top = 40
        MyRect.bottom = Form1.ScaleHeight
        sPrintText = "Proviamo a vedere in che modo allinea questa stringa, dovrebbe allinearla in qualche modo giusto no?" + vbcrlf + "tipo ciai presente cappuccetto rosso e il lupo cattivo?"
        lSuccess = DrawText( _
            Form1.hDC, sPrintText, Len(sPrintText), MyRect, _
            DT_LEFT Or DT_EXPANDTABS Or DT_NOCLIP Or DT_NOPREFIX Or DT_WORDBREAK Or DT_EXTERNALLEADING _
        )
    End Sub
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  3. #3
    Join Date
    Apr 2004
    Posts
    14
    My problem is how to tell vb how to react to my property type.
    For example...if we define a property like font type, the property window will automatically show the font dialog when we try to manage the font property on property window, or if we define a property as stdpicture, vb will show picture dialog when we try to manage the property, if we define simply as a string, then vb will treat it just like text property in textbox control, but when we set the multiline property = TRUE, then vb will alter the treatment of the text property. am i clearly describe my problem ?

    Thanks for the answer

  4. #4
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    Perform

    Add->User Control -> Interface Wizard

    and select the properties you need.

    Ask if you got trouble.
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  5. #5
    Join Date
    Apr 2004
    Posts
    14
    Before i post the question, i've already search on google, try to find a user control with such property i want but i couldn't find one. i have also tried to use user control wizard and use all the property from the wizard, but still there is no such property i need.

    If you know the answer, please kindly help.

    Really appreciate your help

    Happy coding and Thanks

  6. #6
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    You must manage property value changes inside the Property Let of your Multiline...

    Code:
    Private m_Multiline As Boolean
    
    [...]
    
    Public Property Let Multiline(ByVal vNewValue As Boolean)
        m_Multiline = vNewValue
        PropertyChanged "Multiline"
        ' Now call redrawing routine managing the m_Multiline member
    End Property
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  7. #7
    Join Date
    Apr 2004
    Posts
    14
    One more step...

    Thank you andrea_rossini. One more step...now how to make the text property from single line into multiline like i attach below.

    Thanks in advance
    Attached Images Attached Images  

  8. #8
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    Never tried........ sorry
    I think there's something to do with the interface wizard.....
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

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

Featured