本文介绍了添加一个DataGridView在IronPython的工作室的WinForms得到一个"“DataGridView的'对象有没有属性'BeginInit在'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要加上一个DataGridView在IronPython的工作室将触发DataGridView的'对象有没有属性'BeginInit在'。对此有一个修复?

By just adding a datagridview in IronPython Studio it triggers a"DataGridView' object has no attribute 'BeginInit'". Is there a fix for this?

都不见了的错误,如果行self._DataGridView1.BeginInit()和self._DataGridView1.EndInit()被删除,但是这不是什么应该怎样做才能解决这个问题。

The errors are gone if the lines self._DataGridView1.BeginInit() and self._DataGridView1.EndInit() are deleted, but that's not what it should be done to fix that

推荐答案

有这个没有修复,并有可能是因为IronPython的工作室不再支持并不是一个。 DataGridView.BeginInit明确实施和IronPython工作室基于IronPython的1.1。您可能能够解决它通过更改为ISupportInitialize.BeginInit(self._DataGridView1)进口ISupportInitialize接口后,但我怀疑这会活下去轮经过设计师跳闸。

There's no fix for this and there's likely not to be one because IronPython Studio isn't supported anymore. DataGridView.BeginInit is implemented explicitly and IronPython Studio is based upon IronPython 1.1. You might be able to work around with it by changing that to "ISupportInitialize.BeginInit(self._DataGridView1)" after importing ISupportInitialize but I doubt it'll survive round tripping through the designer.

如果你想解决这个自己的源IronPython的工作室是可用的,你可以尝试修改的WinForms设计师code注意到的显式接口实现呼叫,发出此code来代替。这可能只是固定的IronPython的codeDOM产生。

If you wanted to fix this yourself the source for IronPython Studio is available and you could try modifying the winforms designer code to notice the explicit interface implementation call and emit this code instead. That's likely just fixing IronPython's CodeDom generator.

不过说真的我建议你移动到IronPython的工具和WPF。生成code为的WinForms设计师并没有真正的工作,很好地与IronPython和WPF是更合适的。另一种方案是将产生的WinForm瓦特/设计师在C#和Python的子类了。

But really I'd advise you to move to IronPython Tools and WPF. Generating code for the WinForms designer doesn't really work that well with IronPython and WPF is much more suitable. An alternate plan would be to generate the WinForm w/ the designer in C# and subclass it from Python.

这篇关于添加一个DataGridView在IronPython的工作室的WinForms得到一个"“DataGridView的'对象有没有属性'BeginInit在'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 16:53