如何将任务添加到UserControls? [英] How to Add Tasks to UserControls?

查看:65
本文介绍了如何将任务添加到UserControls?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

:rose:

如果将ComboBox放在窗体上,我们会看到它的右上角有一个黑色的小箭头,这打开了一个带有CheckBox和linklabel的小面板,并且...
您能告诉我,我该如何为自己的控件执行此操作?
谢谢你.
:rose:

:rose:
Hi.
If you put a ComboBox on your Form we see that there is a small Black Arrow on right top side of it, that open a small panel with CheckBox and a linklabel and...
Can you tell me,How can i do that for my Own Controls??
Thank you.
:rose:

推荐答案

我的猜测是您正在寻找一种实现弹出控件的方法.

这是一篇不错的文章简单弹出控件 [
My guess is that you are looking for a way to implement a popup control.

Here is a nice article Simple Popup Control[^] by Lukasz Swiatkowski.

Regards
Espen Harlinn


问题包含可能的答案之一— UserControl:

创建一个UserControl,将一个文本框和一个带有黑色小箭头的小按钮放在右侧,单击该按钮将显示一个带有其子控件的小面板.要模仿组合框的列表部分,应在桌面顶部立即创建的单独窗口中显示此小面板-这是本机组合框显示下拉列表的方式.您将需要单独的窗口,因为组合框的高度等于其文本框部分的高度,因此列表框部分(或您的小面板)将不适合用户控件.动态增加用户控件的大小也将不起作用,因为这会弄乱父级的布局.

顺便说一下,这一点都不容易.它将需要处理大量事件,注意棘手的布局,暴露复杂的界面,以允许控件的用户填充和访问面板的子控件的多态列表.

一个非常典型的问题的示例:当在表单中显示本机组合框时,在显示其下拉列表时,用户可以停用活动表单.您可能已经注意到:这隐藏了组合框的下拉列表;这样做是为了防止此列表框(在桌面儿童级别)与其他顶级窗口混淆.但是此激活事件属于表单,而不属于控件,因此应在运行时将适当的操作委派给表单...

还是有兴趣尝试吗?
The question contains one of the possible answers — UserControl:

Create a UserControl, put a text box and a small button with a small black arrow on right side, the button click will shows a small panel with its child controls. To mimic a list part of the combo box, this small panel should be shown on a separate window created immediately on top of the desktop -- this is how native combo box shows drop-down list. You will need to have separate window because the height of the combo box is equal to the height of its text box part, so the list box part (or your small panel) will not fit in the user control; dynamic increase of the user control size also will not work, because it would mess up the parent''s layout.

This is not easy at all, by the way. It will require handling good number of events, taking care of tricky layout, expose sophisticated interface to allow the user of your control populating and accessing polymorphous list of the panel''s child controls.

One example of a very characteristic problem: when a native combo box is shown in a form, and when it''s drop-down list is shown, the user can deactivate the active form. You could have noticed: this hides the combo box''s drop-down list; this is done this way to prevent this list box (at the level of desktop children) messing up with other top-level windows. But this activation events belong to the form, not to the control, so the appropriate action should be delegated to the form during run time...

Still interested to try?


相同的外观需要相同的框架.

如果您的小组希望拥有可靠的体系结构,则您的小组必须具有(或制作)自己的框架.

然后,您的用户控件将随您所愿.
Same appearance needs same framework.

If your group want to have a solid architecture your group must have (or make) your own framework.

Then your user controls will be as you want.


这篇关于如何将任务添加到UserControls?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆