Results 1 to 2 of 2

Thread: WinForms Labels

  1. #1

    Thread Starter
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    WinForms Labels

    I have a project where I need some help with the Winform's label control. I have a label that displays text kinda like a title to something (autosize = false, TextAlignment = MiddleCenter) and whenever the label control isn't wide enough to display the single line of text it tries to auto-wrap it causing half of the text to be chopped off at the top and half of it chopped off at the bottom. I would rather it stay on a single line and cut the text off from the right. Anyway I can do that?

    I also have another label (multiple lines of text, autosize = false) in which case I would like a vertical scrollbar to appear when the label isn't tall enough (I would like the text to wrap in this case, which is does do already) do they can scroll to read it all. How do I do that?
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: WinForms Labels

    Aligning to MiddleTop might suffice for the first half. By using MiddleCenter, it is probably trying to center whatever you have vertically, which isn't what you are after.

    As for the second, I have no useful suggestion. You could make it happen, but I don't see a way to make it happen automatically. It seems like you could do it with a label on a panel where the panel is AutoScroll = True, but the label would have to be re-sized whenever the text changed, which would be a right pain.

    I would expect that somebody has a better answer than that.
    My usual boring signature: Nothing

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