C#做的FORM,上面的工具条和菜单图标是通过直接选用本地资源中的文件的。但是也在项目中生成了.resx文件。但是在运行时,发生错误,错误提示如下:
未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“RSBaseDate.frmMain.resources”正确嵌入或链接到程序集“RSBaseDate”,或者确保所有需要的附属程序集都可加载并已进行了完全签名。
打开资源文件,可以看到图标都在资源文件中,但就是运行时发生错误。下面是发生错误的程序。
namespace RSBaseDate
{
partial class frmMain
{
/// <summary>
/// 必需的设计器变量。 /// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。 /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
....
//省略一部分代码
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sjlrMenuItem,
this.sjtbMenuItem,
this.m_Query,
this.m_SysManage,
this.m_Exit});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(873, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// sjlrMenuItem
//
this.sjlrMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.jczlMenuItem,
this.bxskMenuItem,
this.cxjgMenuItem,
this.kbalMenuItem,
this.zcdjMenuItem});
this.sjlrMenuItem.Name = "sjlrMenuItem";
this.sjlrMenuItem.Size = new System.Drawing.Size(65, 20);
this.sjlrMenuItem.Tag = "00000001";
this.sjlrMenuItem.Text = "数据管理";
//
// jczlMenuItem
//
this.jczlMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("jczlMenuItem.Image"))); 从这里起开始报错
this.jczlMenuItem.Name = "jczlMenuItem";
this.jczlMenuItem.Size = new System.Drawing.Size(152, 22);
this.jczlMenuItem.Tag = "00000002";
this.jczlMenuItem.Text = "基础资料";
this.jczlMenuItem.Click += new System.EventHandler(this.jbzlMenuItem_Click);
//
// bxskMenuItem
//
this.bxskMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bxskMenuItem.Image")));
this.bxskMenuItem.Name = "bxskMenuItem";
this.bxskMenuItem.Size = new System.Drawing.Size(152, 22);
this.bxskMenuItem.Tag = "00000003";
this.bxskMenuItem.Text = "病险水库";
this.bxskMenuItem.Click += new System.EventHandler(this.bxskMenuItem_Click);
//
// cxjgMenuItem
//
this.cxjgMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cxjgMenuItem.Image")));
this.cxjgMenuItem.Name = "cxjgMenuItem";
this.cxjgMenuItem.Size = new System.Drawing.Size(152, 22);
this.cxjgMenuItem.Tag = "00000004";
this.cxjgMenuItem.Text = "除险加固";
this.cxjgMenuItem.Click += new System.EventHandler(this.cxjgMenuItem_Click);
//
// kbalMenuItem
//
....
//省略一部分代码 } #endregion }
}请各位高手指点指点,为什么会这样?怎么样改正这个错误?
未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“RSBaseDate.frmMain.resources”正确嵌入或链接到程序集“RSBaseDate”,或者确保所有需要的附属程序集都可加载并已进行了完全签名。
打开资源文件,可以看到图标都在资源文件中,但就是运行时发生错误。下面是发生错误的程序。
namespace RSBaseDate
{
partial class frmMain
{
/// <summary>
/// 必需的设计器变量。 /// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。 /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
....
//省略一部分代码
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sjlrMenuItem,
this.sjtbMenuItem,
this.m_Query,
this.m_SysManage,
this.m_Exit});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(873, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// sjlrMenuItem
//
this.sjlrMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.jczlMenuItem,
this.bxskMenuItem,
this.cxjgMenuItem,
this.kbalMenuItem,
this.zcdjMenuItem});
this.sjlrMenuItem.Name = "sjlrMenuItem";
this.sjlrMenuItem.Size = new System.Drawing.Size(65, 20);
this.sjlrMenuItem.Tag = "00000001";
this.sjlrMenuItem.Text = "数据管理";
//
// jczlMenuItem
//
this.jczlMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("jczlMenuItem.Image"))); 从这里起开始报错
this.jczlMenuItem.Name = "jczlMenuItem";
this.jczlMenuItem.Size = new System.Drawing.Size(152, 22);
this.jczlMenuItem.Tag = "00000002";
this.jczlMenuItem.Text = "基础资料";
this.jczlMenuItem.Click += new System.EventHandler(this.jbzlMenuItem_Click);
//
// bxskMenuItem
//
this.bxskMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bxskMenuItem.Image")));
this.bxskMenuItem.Name = "bxskMenuItem";
this.bxskMenuItem.Size = new System.Drawing.Size(152, 22);
this.bxskMenuItem.Tag = "00000003";
this.bxskMenuItem.Text = "病险水库";
this.bxskMenuItem.Click += new System.EventHandler(this.bxskMenuItem_Click);
//
// cxjgMenuItem
//
this.cxjgMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cxjgMenuItem.Image")));
this.cxjgMenuItem.Name = "cxjgMenuItem";
this.cxjgMenuItem.Size = new System.Drawing.Size(152, 22);
this.cxjgMenuItem.Tag = "00000004";
this.cxjgMenuItem.Text = "除险加固";
this.cxjgMenuItem.Click += new System.EventHandler(this.cxjgMenuItem_Click);
//
// kbalMenuItem
//
....
//省略一部分代码 } #endregion }
}请各位高手指点指点,为什么会这样?怎么样改正这个错误?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货