如何动态反序列化和创建表单 [英] How to deserialize and create a form on the fly

查看:78
本文介绍了如何动态反序列化和创建表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里玩得开心。我已经读了一个XML文件并将其解除了。基于XML文件的内容,我已经动态生成了一个页面(并且它可以工作)。


但是,XML文件包含多个页面的数据要生成。想法是你单击前进按钮,触发事件并生成新窗口。


deserialiser方法直接将XML数据传递给winform生成器,然后传递给按钮单击。


问题是这个。我不能让它移动到下一组数据!


当前代码看起来像这样

展开 | 选择 | Wrap | 行号

解决方案

@nodoid


嗨Paul,

例如,某些代码示例不完整。你还没有展示 forwardlink 反向链接的实现。虽然我可以猜测他们做了什么,但完整的例子会有所帮助。


您是否能够附加示例XML文件和源代码?如果是这样我会为你调查。





向前和向后调用处理窗口的委托然后使用新页码调用makeform方法...


完整源代码(从按钮单击调用loaddesign方法)

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


一个解决方案可能只是读取pagenumber == page的数据,但这会有点凌乱


类似


XmlDocument doc = new Xml Document();

doc.Load(path_env +" designer-test.xml");

f = doc.XmlSingleNode(" pagenumber");


虽然这可能不会真正起作用,因为它只会读取一组数据而不是多套......


嗯......

Having a bit of fun here. I''ve read in a file in XML and deseralised it. Based on the contents of the XML file, I''ve generated a page on the fly (and it works).

However, the XML file contains the data for more than one page to be generated. The idea is that you click the forward button, the event is fired and the new window generated.

The deserialiser method passes the XML data to the winform generator directly which is then passed to the button click.

The problem is this. I can''t get it to move to the next set of data!

Current code looks like this

Expand|Select|Wrap|Line Numbers

解决方案

@nodoid
Hi Paul,
Some of your code samples are incomplete, for example. you haven''t shown the implementations of forwardlink and backlink. Although I can probably guess what they do a complete example would help.

Are you able to attach an example XML file plus the source? If so I''ll look into it for you.


Hi,

forward and backward call the delegate which disposes of the window and then calls the makeform method with the new page number...

Full source (the loaddesign method is called from a button click)

Expand|Select|Wrap|Line Numbers


One solution may be just to read in the data where pagenumber == page, but that would be slightly messy

Something like

XmlDocument doc = new XmlDocument();
doc.Load(path_env + "designer-test.xml");
f = doc.XmlSingleNode("pagenumber");

though that would probably not really work as it would only read one set of data not multiple sets....

Hmmm.....


这篇关于如何动态反序列化和创建表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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