共享组件 [英] Shared Component
问题描述
HI,
我只想将一个表单中的组件共享给其他表单...
I just want to share a component from one Form to others...
我有一个管理动作列表的组件.我想在一堂课中实施动作,并以多种形式影响他们.
I have a component which manage an action List. I would like to implement action in one class and affect them on multiple forms.
简单的方法是这样做:
公共类Form1:表单
public class Form1 : Form
=>包含组件
公共类Form2:Form1
public class Form2 : Form1
公共类Form3:Form1
public class Form3 : Form1
这可能有效,但我同时拥有经典的Form和devexpress RibbonForm
that could work, but i've both classic Form , and devexpress RibbonForm
RibbonForm继承XtraForm继承Form.
RibbonForm inherits XtraForm inherits Form.
做到这一点的最佳方法是什么? (操作列表组件包含Designer编辑器)
Whats the best way to do that ? (the action list component contains Designer Editor)
推荐答案
嗨.实现此目的的一种方法是创建一个基类.在基类中实现功能.然后,您可以简单地从基类派生表单.
Hi. One way you can achieve this is by creating a base class & implement the functionality in the base class. Then, you can simply derive your forms from the base class.
示例:
class BaseClass:Form
{
//Implement your functionality here
}
Class Form1 : BaseClass
{
}
Class Form2 : BaseClass
{
}
Class Form3 : BaseClass
{
}
这篇关于共享组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!