有没有办法从 Visual Basic 6 中的 UserControl 之外继承自定义控件?
我正在开发一个自定义 VB6 控件 - 实际上是一个带有滚动条的类似 PictureBox 的控件。据我了解,VB6中的所有控件默认都是从UserControl类派生的。我希望我的控件提供带有 Line、PSet、Circle 方法的 PictureBox 接口。如何继承PictureBox类或提供PictureBox控件的接口?
I am developing a custom VB6 control - actually a PictureBox like control with scrollbars. As far as I understand all the controls in VB6 are derived from the UserControl class by default. I would like my control to provide the PictureBox interface with Line, PSet, Circle methods. How can I inherit from the PictureBox class or provide the PictureBox control's interface?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 UserControl 作为基础。
但VB6 IDE针对这种情况提供了一个向导。
穷人的继承:
加载项 ->加载项管理器...
。VB 6 ActiveX Ctrl Interface Wizard
并关闭管理器。加载项 -> ActiveX 控件接口向导...
。下一步>
。下一步>
。下一步>
。PictureBoxName
将该属性映射到图片框的属性。默认情况下,它是同名的属性,但可以更改为任何内容。对每个属性重复此操作。你会讨厌它。
下一步>
。You must use UserControl as the base.
But VB6 IDE provides a wizard for this situation.
Poor man's inheritance:
Add-Ins -> Add-in Manager...
.VB 6 ActiveX Ctrl Interface Wizard
and close the manager.Add-Ins -> ActiveX Control Interface Wizard...
.Next >
.Next >
.Next >
.PictureBoxName
from the dropdown to map that property to a property of the picturebox. By default it's the property with the same name, but can be changed to anything.Repeat that for each property. You will hate it.
Next >
.