简体   繁体   English

Visual Studio设计器不会显示我的用户控件,但可以正常运行应用程序

[英]Visual studio designer wont display my user controls but runs the application fine

for some reason my user controls display the error 'Cannot locate resource 'resources/backicon.png'. 由于某种原因,我的用户控件显示错误“无法找到资源'resources / backicon.png”。 I am confused as to why this is happening as the program runs fine it just cannot create an instance of the controls in the designer and is displaying a blue warning here: ''. 我对为什么这种情况发生感到困惑,因为程序运行正常,它无法在设计器中创建控件的实例,并且在此处显示蓝色警告:''。 The path in the error is 'resources/backicon.png' however in the actual user control the path is specified as '/Resources/BackIcon.png'. 错误中的路径为“ resources / backicon.png”,但是在实际的用户控件中,该路径被指定为“ /Resources/BackIcon.png”。 Also the build action for the images is set to resource. 图像的构建动作也设置为资源。

(I'm running Visual studio 2013 Express for Windows Desktop) (我正在运行用于Windows桌面的Visual Studio 2013 Express)

Right Click->Clean 右键单击->清洁
Once its cleaned 一旦清洗
Now RightClick-> Rebuild 现在右键单击->重建
You will see the blue warning gone. 您将看到蓝色警告消失。
Its because your user control must be added later on which resulted in designer not having any reference as its using previous build as base 这是因为您的用户控件必须稍后添加,这导致设计人员没有任何参考,因为它使用以前的构建作为基础

Explicitly specify the assembly name in the path although it belongs to the same assembly. 尽管路径属于同一程序集,但在路径中明确指定程序集名称。

pack://application:,,,/MyAssemblyName;component/MyResourcesFolder/MyImage.png

Make sure You set the build action of the image to the type 'Resource'. 确保将图像的构建操作设置为“资源”类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin Visual Studio Android Designer不会显示 - Xamarin Visual Studio Android Designer wont Display Visual Studio 2019 XAML 设计器不显示来自外部项目的 x64 用户控件 - Visual Studio 2019 XAML Designer does not display x64 User Controls from external projects Visual Studio 2019 WPF 设计器不会显示自定义控件 - Visual Studio 2019 WPF designer won't display custom controls 如何阻止visual studio在设计器中打开我的winforms控件 - How to stop visual studio from opening my winforms controls in the designer 具有自定义控件的Visual Studio WPF UI设计器 - Visual Studio WPF UI Designer with Custom Controls Visual Studio 2017设计器视图未显示控件 - Visual Studio 2017 Designer View not Showing Controls 显示控件列表的 Visual Studio 窗体设计器 - Visual Studio Form Designer Showing List of Controls 具有Visual Studio Designer中资源的多语言WPF应用程序 - Multilanguage wpf application with resources in Visual Studio Designer 在设计器中移动窗体上的控件时,Visual Studio 2012突然崩溃 - Visual Studio 2012 suddenly crashes when moving controls on form in designer WPF Custom TabItem - 控件未显示在Visual Studio Designer中 - WPF Custom TabItem - Controls not displayed in Visual Studio Designer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM