我在向表格添加UserControl时遇到了麻烦。
UserControl代码:
using System;
using System.Windows.Forms;
namespace Most.Mobile.AFV.UI.Controls
{
public partial class ListActionBar : UserControl
{
public ListActionBar()
{
InitializeComponent();
}
public bool ShowKeyboardButton
{
get { return mtbKeyboard.Visible; }
set { mtbKeyboard.Visible = value; }
}
public bool ShowOpenButton
{
get { return mtbMenu.Visible; }
set { mtbMenu.Visible = value; }
}
public bool ShowDeleteButton
{
get { return mtbDelete.Visible; }
set { mtbDelete.Visible = value; }
}
public bool ShowBackButton
{
get { return mtbBack.Visible; }
set { mtbBack.Visible = value; }
}
public bool ShowEditButton
{
get { return mtbEdit.Visible; }
set { mtbEdit.Visible = value; }
}
public bool ShowNewButton
{
get { return mtbNew.Visible; }
set { mtbNew.Visible = value; }
}
public event EventHandler NewClick;
public event EventHandler DeleteClick;
public event EventHandler EditClick;
public event EventHandler OpenClick;
private void mtbBack_Click(object sender, EventArgs e)
{
if (Parent == null)
return;
if (Parent is Form)
(Parent as Form).DialogResult = DialogResult.Cancel;
}
private void mtbKeyboard_Click(object sender, EventArgs e)
{
inp.Enabled = !inp.Enabled;
}
private void mtbNew_Click(object sender, EventArgs e)
{
if (NewClick != null)
NewClick(sender, e);
}
private void mtbEdit_Click(object sender, EventArgs e)
{
if (EditClick != null)
EditClick(sender, e);
}
private void mtbDelete_Click(object sender, EventArgs e)
{
if (DeleteClick != null)
DeleteClick(sender, e);
}
private void mtbMenu_Click(object sender, EventArgs e)
{
if (OpenClick != null)
OpenClick(sender, e);
}
}
}
错误图片下方
错误说明:
无法创建组件'' ' System.IO.FileLoadException:无法加载文件或程序集' Microsoft.WindowsCE.Forms,Version = 3.5.0.0,CUlture = neutral,PublicKeyToken = 969db8053d3322ac'或其中一个依赖。
答案 0 :(得分:-1)
visual studio designer在设计器视图中显示控件时实例化控件。当你收到这样的错误时,通常意味着你有一个运行时错误。如果它编译,尝试运行代码(不在设计器中打开它),看看它在哪里崩溃。