【发布时间】:2014-11-21 08:40:34
【问题描述】:
将 Visual Studio 2013 用于 Windows 应用程序,我在我的 MainForm 中有一些代码需要另一段代码才能运行,我正在尝试将这个必需的代码单独移动到另一个类中并导入它(使MainForm 类更易于理解)
当我将代码移到该类时,我似乎无法导入该类,以下是 coed 包含的一些内容:
static void WinEventProc(IntPtr hWinEventHook, uint eventType,
IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
{ .. }
还有一些
delegate void WinEventDelegate(IntPtr hWinEventHook, uint eventType,
IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime);
[DllImport("user32.dll")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
所以那些通常在我的里面
namespace myClass
{
public partial class MainForm : Form
{
但我想将它们放在另一个类中并导入它们
【问题讨论】:
-
你的意思是你想使用Inheritance?
-
可能但是MainForm已经继承了Form,如果可行我会寻找多个继承
-
所以 Mainform : Form,myInterface 也不起作用,嗯
标签: c# class import visual-studio-2013