我仍在尝试找出此错误的情况:
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;
}
最佳答案
实现PreFilterMessage方法的类需要从IMessageFilter接口派生。你可能错过了
public class Foo: IMessageFilter
{
bool IMessageFilter.PreFilterMessage(ref Message m)
{
// your code
}
}
关于c# - 包含类型未实现接口(interface)IMessageFilter,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15473650/