Sunday, May 29, 2005

Cool Control - LinkBox

LinkBox - Fun with Panels, LinkLabels and AutoScroll

"... The solution: A user control completely filled with a panel (to get the sunken borders), link labels are added dynamically (with auto-sizing enabled) and are docked to the top, so I don’t have to take care of positioning. Scrolling is taken care of by the panel (AutoScroll), the AutoScrollMinSize is easy to determine as the labels are auto-sized (so width = largest width and height = y-coordinate of the last label’s bottom border).

The code can be downloaded here, complete with a demo project:

linkBox1.AddText("This is some fixed text");
linkBox1.AddLink("The quick brown {0}", "fox");
linkBox1.AddLink("jumps over the lazy {0}", "dog");
linkBox1.AddLink("This is a {0} with a tag object", "test", "Some tag object");

..."




This looks like a pretty cool control (modeled on the Outlook Rule feature) that I might be able to use someday.

Source (with business friendly license) and sample project are included.

No comments: