添加任何项目都会破坏GUI [英] Adding any item ruins GUI

查看:79
本文介绍了添加任何项目都会破坏GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我对GUI进行任何更改时,都会收到以下错误: http://puu.sh/173Iq [ ^ ]
很久我的工具栏上的所有项目(只影响工具栏)在我运行程序时都消失了,与更改GUI的位置无关.

我正在使用以下文章中的C#代码:创建自定义设置提供程序 [ ^ ]

这是C#代码: http://pastebin.com/EYBKceib [解决方案

位图是一种提供错误信息的奇怪方法.无论如何,这就是事实:您可能不会引用有问题的程序集.找出它是什么以及它的来源.

我建议您向您所用文章的作者致辞.加载文章文本,找到最后的评论和讨论"部分,然后单击添加评论或问题"以添加您的问题.作者会收到您的帖子通知,并有机会回复.

祝你好运,
—SA


对于任何有兴趣的人,我发现问题似乎出在工具栏和提供者的问题上,删除其中一个问题就可以了,添加一个,问题就在那里.我不知道为什么.

但是,我找到了解决该问题的方法.您可以通过执行以下操作来解决它.

  var  PortableSettingsProvider =  PortableSettingsProvider();
Properties.Settings.Default.Providers.Add(portableSettingsProvider);
 foreach (SettingsProperty属性 in  Properties.Settings.Default.Properties中的属性)
{
    property.Provider = PortableSettingsProvider;
} 

在运行应用程序之前在Main()中.

如果有人知道为什么这两个彼此之间有问题,我很想知道.


Any time I make any changes to the GUI I get the following error: http://puu.sh/173Iq[^]
A long with that all the items on my toolbar (only the toolbar is affected) disappear when I run the program, it doesn''t matter where I change the GUI.

I am using the C# code from the following article: Creating a Custom Settings Provider[^]

Here is the C# code: http://pastebin.com/EYBKceib[^]

I followed the instructions in the article, but now with any change to the GUI I get the error listed at the beginning. If I remove PortableSettingsProvider as the provider the error goes away, but I would like to figure out why it is causing this problem and how I can fix while retaining the portable settings.

EDIT

CodeProject doesn''t seem to be letting me reply to any answers or comments so I will just have to here.
What happens is, I put PortableSettingsProvider as the Provider for Settings.settings. Once I do that, any changes I make to the GUI wipe the items on my Toolbar and when I save the file I get the error posted at the top. That is the only thing VS2012 gives me, no line of error, no stacktrace, just that small little message.

When I remove PortableSettingsProvider as the Provider I don''t have any problems, but when it is there it causes problems, I honestly have no idea what could be causing it as the message is the only error it gives me.

解决方案

The bitmap is a strange way to provide the error information. Anyway, this is what it is: you might not reference the assembly in question. Find out what is it and where it comes from.

I would suggest you address the author of the article you used. Load the article text, locate the section "Comments and Discussions" at the end and click "Add a Comment or Question" to add your question. The author get the notification of your post and a chance to reply.

Good luck,
—SA


For anyone who is intersted I found out the the problem seems to be with having the toolbar and the the Provider, remove one and the problem is fine, add one and the issue is there. I don''t know why.

However I found a workaround for the issue. You can get around it by doing the following.

var portableSettingsProvider = new PortableSettingsProvider();
Properties.Settings.Default.Providers.Add(portableSettingsProvider);
foreach (SettingsProperty property in Properties.Settings.Default.Properties)
{
    property.Provider = portableSettingsProvider;
}

In your Main() before you application is ran.

If anyone know WHY those two have a problem with each other I would love to know.


这篇关于添加任何项目都会破坏GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆