locked
Messages falling outside the screen. RRS feed

  • Question

  • Hi,

    I have created an application which displays messages on the screen at random screen locations. The application reads those messages from a text file. I created a small form in my application and used a label on the form. This form is made transparent to show only the message on the screen because I dont want the user to see the form. The application reads the messages from the text file and changes the text of the label on the form. I then generate some randome screen location and show the form at that location. Since the form is transparent user can see only the lavel text on the screen appearing at some random locations.

    The problem is that sometimes, if the message is too big, the label starts at some random location on the screen, but some part of the message goes outside the screen and hence is not visible. In this case I would like to make it multiline, if it goes outside the screen.

    How can I check whether the particluar message goes outside the screen and then make it multiline?

     


    Himanshu Saxena
    Wednesday, July 20, 2011 4:03 AM

Answers

  • The Graphics.MeasureString will calculate the size of your string in units. According to the string size make your label box Multiline property.
    vinothkumar.A
    • Proposed as answer by vinothmdu2001 Wednesday, July 20, 2011 5:08 AM
    • Marked as answer by Jie Bao Wednesday, July 27, 2011 4:34 PM
    Wednesday, July 20, 2011 5:07 AM