如何为 VS2005 工具箱创建自定义控件?
好吧,这个问题可能更多的是关于设计理论。我已经成功创建了显示在我的工具箱中的控件,所以我很确定我的流程是正确的。另外,我的“AutoToolboxPopulate”设置为 true,所以当我创建它们时,事情就会显示出来。我的问题是这样的:我正在对本机控件进行子类化以供专门使用。当我从公开的具体类(例如 BulletedList)派生我的类时,我的自定义控件出现在我的工具箱中。但是,当我将其放回父级(例如 ListControl)时,我的 Control 未列出(实际上,当我“列出全部”时它呈灰色)。我缺少什么?
Ok, this question might more about design theory. I have successfully created controls that show up in my toolbox, so I'm pretty sure I have the process right. Also, my "AutoToolboxPopulate" is set to true, so things are showing up as I create them. My question is this: I'm sub-classing a native Control for specialized use. When I derive my class from an exposed concrete class, such as BulletedList, my custom Control appears in my Toolbox. However, when I drop it back to the parent, such as ListControl, my Control is not listed (actually it's grayed out when I "List All"). What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为答案是我的代码一定有问题。我最终确实让这些出现了,这可能是某个地方的错误。
然而,这里有一个重要的提示:为了让自定义服务器控件显示在您的工具箱中,您必须将页面加载到“设计”模式。这将更新工具箱列表。 (显然,这对于文档大纲也是必要的)
I think the answer is that there must have been a problem with my code. I did eventually get these to show up, and it may have been an error somewhere.
However, here's an important tip: In order to get custom server controls to show up in your toolbox, you have to load your page into "design" mode. This will update the toolbox list. (apparently, it's necessary for the document outline, too)