|
楼主 |
发表于 2010-4-14 12:57:26
|
显示全部楼层
回复 9# naojin
我的代码哪里写得不对呢?我看了好久都没看出来呀...
我的问题是这样的:我新建了一个类MyUserControl,用来实现U8中已经定义了的接口UFIDA.U8.Portal.UAPFacade.IUserControl,开发平台是VS.NET 2008。当我在我的类中实现接口中的成员函数时,除了CreateControl函数,其他的函数都可以实现,但就是CreateControl函数实现不了,系统总是会报这样的错误——
“...MyUserControl不实现接口成员UFIDA.U8.Portal.UAPFacade.IUserControl.CreateControl(U8Login.clsLogin, string, string)。...MyUserControl.CreateControl(U8Login.clsLogin, string, string)”无法实现UFIDA.U8.Portal.UAPFacade.IUserControl.CreateControl(U8Login.clsLogin, string, string),因为它没有匹配的返回类型“System.Windows.Forms.Control。”
可是我检查了好久也没发现我的程序的错误在哪里~~求大大的指点。。。
这是我写的相关程序
--------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using U8Login;
using UFIDA.U8.Portal.Proxy.editors;
namespace UFIDA.U8.Portal.NetProductSample
{
class MyUserControl:UFIDA.U8.Portal.UAPFacade.IUserControl
{
public System.Windows.Forms.Control CreateControl(U8Login.clsLogin login, string MenuID, string Paramters)
{
try
{
Control myControl = new Control();
return myControl;
}
catch
{
throw new NotImplementedException();
}
}
......
}
}
这是接口的代码
------------------------------
using System;
using System.Windows.Forms;
using U8Login;
using UFIDA.U8.Portal.Proxy.editors;
namespace UFIDA.U8.Portal.UAPFacade
{
......
Control CreateControl(clsLogin login, string MenuID, string Paramters);
......
}
类型Control属于System.Windows.Forms.Control类,
---------------------------------
namespace System.Windows.Forms
{
// 定义控件的基类,控件是带有可视化表示形式的组件。
public class Control : Component, IBindableComponent, IComponent, IDisposable
{
// 用默认设置初始化 System.Windows.Forms.Control 类的新实例。
public Control();
......
}
请求大家的帮助~~ |
|