找到你要的答案

Q:Keywords tagging in .net - similar to youtube tagging [closed]

Q:关键词标注在.NET类似YouTube标注[关闭]

I tried to generate the keywords as buttons, but how do I get the X in the button so that it can be removed by user?

http://blog.pond5.com/wp-content/uploads/2015/03/Screen-Shot-2015-03-30-at-11.46.46-AM.png

Thanks

我试图生成关键字作为按钮,但如何才能得到X的按钮,以便它可以删除用户?

http://blog.pond5.com/wp-content/uploads/2015/03/screen-shot-2015-03-30-at-11.46.46-am.png

谢谢

answer1: 回答1:

You can't have a button within a button. I would suggest one of two approaches to get a similar effect:

1. Forget about the "X" and make the whole button function as "Delete".

This is the easiest approach. Leave your buttons as they are, create an event handler for their click event to delete the tag (as you seem to have been planning to do with the "X" click), and possibly clarify a little to your user that clicking a tag will delete it.

2. Place an "X" button and a label for the tag name, possibly within a a container (such as a groupbox).

This takes slightly more effort but gets the functionality much closer to what you want. The label shows the tag name, the button is labeled "X", and clicking the button removes both (or the container, if you prefer that look). If you haven't already created a custom class for your tags, it would probably be worth doing so and declaring these controls as properties.

你不能在按钮内有一个按钮。我会建议两种方法之一,以获得类似的效果:

1。忘记“X”,使整个按钮功能为“删除”。

这是最简单的方法。离开你的按钮,因为他们是,创建一个事件处理程序的点击事件删除标签(因为你似乎一直在计划与“X”点击),并可能澄清一点,你的用户点击标签将删除它。

2。一个“X”按钮和标签名称的标签,可能在一一个容器(如一个GROUPBOX)。

这需要更多的努力,但得到的功能更接近你想要什么。标签显示标签名称,按钮被标记为“X”,点击按钮删除两个(或容器,如果你喜欢的外观)。如果您还没有为标签创建一个自定义类,那么这样做可能是值得的,并将这些控件声明为属性。

asp.net  .net  vb.net