views:

151

answers:

3

I am trying to create a panel which will have a set of "buttons" on it.

These buttons should have the following behaviour:

  1. Appear similar to a tag (with rounded edges)
  2. Contain a red cross to remove the filter/tag from the panel, similar to the way internet explorer tabs have an embedded cross to close the individual tab.
  3. allow the user to click on the tag and respond like a normal button (as long as the click is not in the red cross)

Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!

My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?

Thanks in advance!

A: 

I don't think that infragistics can do something like this. The UltraButton control can't. Implementing a own control wouldn't be that hard.

crauscher
+1  A: 

Is this new development or maintenance of an existing project?

If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).

If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.

Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.

John Rudy
New dev, however, unfortunately we are tied to 2.0 at the moment.
miguel
Looks like you're in option #1, then ...
John Rudy
A: 

your probably going to have to make a costume control for this type of work.

Crash893