我仍然试图找出这个错误发生了什么:
OCR.test.IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message):包含类型未实现接口System.Windows.Forms.IMessageFilter
以下是我的代码:
bool IMessageFilter.PreFilterMessage(ref Message m) // Error with this line
{
TwainCommand cmd = tw.PassMessage(ref m);
if (cmd == TwainCommand.Not)
return false;
switch (cmd)
{
case TwainCommand.CloseRequest:
{
EndingScan();
tw.CloseSrc();
break;
}
case TwainCommand.CloseOk:
{
EndingScan();
tw.CloseSrc();
break;
}
case TwainCommand.DeviceEvent:
{
break;
}
case TwainCommand.TransferReady:
{
ArrayList pics = tw.TransferPictures();
EndingScan();
tw.CloseSrc();
picnumber++;
for (int i = 0; i < pics.Count; i++)
{
IntPtr img = (IntPtr)pics[i];
PicForm newpic = new PicForm(img);
newpic.MdiParent = this;
int picnum = i + 1;
//newpic.Text = "ScanPass " + picnumber.ToString() + "_Pic " + picnum.ToString();
newpic.Show();
}
break;
}
}
return true;
}
答案 0 :(得分:2)
实现PreFilterMessage方法的类需要从IMessageFilter接口派生。你可能错过了它
public class Foo: IMessageFilter
{
bool IMessageFilter.PreFilterMessage(ref Message m)
{
// your code
}
}