Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Related Posts
Laziness .NET -- the Professional Edition
Some new MSDN links of note
Visual Basic Resource Kit
Visual Basic Resource Kit Download Avail...
URLScan and the VB Resource Kit

Follow up on that label/line control...

Posted on April 15th

It seems a few people had questions about the control I posted previously, so here are answers to two of the questions that people might be running into:

  1. What about word wrapping? Good point, turns out I hadn't quite finished my code before I got distracted by food or coffee... and then I ended up leaving out word wrapping! You just need to modify 1 line to make wrapping work, though:
    Change
    g.DrawString(Me.Text, f, b, 0, 0, sf)
    to
    g.DrawString(Me.Text, f, b, labelBounds, sf)

    and you should be set.
  2. I put the control on the form and I get nothing... no line, just text... what's up? The control draws a line between the end of your text (.Spacing past the end actually) and the right-most edge of the control. So... to make it work, you need to turn AutoSize off (AutoSize = False) and stretch the right edge of the control out to where you want the line to end. That should do it!

Hope these little "tips" help anyone who wants to try out this control!



Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

I changed the code in (1) and checked AutoSize in (2). It was already set to False and I had the control stretched out well past the text, but I'm still not seeing the line...I must be missing something obvious.

Thanks for the offer to look at my code, but I finally figured it out. The code was fine. But the FlatStyle on my DividerLabel control was set to System, and I discovered changing the FlatStyle to Standard made the line appear.