Results 1 to 5 of 5

Thread: [RESOLVED] Displaying text on a picturebox

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [RESOLVED] Displaying text on a picturebox

    I need a control for displaying text (coordinate values) as I move the mouse over a picturebox. I had thought of a label but I want to have more than one line. A multiline textbox won't work because it stays in the background underneath the picturebox so it's not visible. Any ideas?
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  2. #2

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Displaying text on a picturebox

    ...and labels are nice because their backstyle can be set to transparent, otherwise maybe I'd use a picturebox.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3
    New Member
    Join Date
    Jun 2007
    Location
    South Africa
    Posts
    8

    Re: Displaying text on a picturebox

    Not sure exactly what you are trying to achieve, but if you want to use a lable, then set its autosize property to true, the use VBCrLF for multi-line use, eg,

    Lable1.caption = "This is on line one" & vbcrlf & "This is on line two".

    Hope this is what you are wanting.

    John

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Displaying text on a picturebox

    I had thought of a label but I want to have more than one line.
    Labels can have multiple lines.

    Code:
    Private Sub Form_Load()
        With Label1
            .AutoSize=True
            .BackStyle = vbTransparent
        End With
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Label1.Caption = "X: " & X & vbNewLine & "Y: " & Y
    End Sub

  5. #5

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Displaying text on a picturebox

    Thank you jsmcm and brucevde. I thought I'd use vbcrlf for new lines but I must have done something strange for when I tried it didn't work (and I was sober) so I had already given up the idea.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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