如何在复制usercontrol时复制usercontrol的数据 [英] How can I copy data of a usercontrol when usercontrol is copied

查看:83
本文介绍了如何在复制usercontrol时复制usercontrol的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在撰写VSTO Excel"应用程序级别"使用C#加载项。

I am currently writing a VSTO Excel "Application-Level" Add-In using C#.

我编写了一个非常复杂的UserControl,它有几个属性,可以在运行时更改。

I have written a quite complex UserControl, that has several properties, which can be changed at runtime.

因此我定义了一个UserControlData类,它是我的UserControl专用的。

Therefore I defined a UserControlData class which is private to my UserControl.

我设法将所有这些数据存储在工作簿的CustomXmlParts部分。

I managed to store all this data in the CustomXmlParts section of the workbook.

然而,我无法找到的是,如何在使用ctrl-c / x&cbsp-ctrl-v时将此信息传递给复制控件。

However what I can not find out is, how to pass this information to the duplicated control when using ctrl-c/x ctrl-v.

此任务是否有概念?

问候,Helmut

推荐答案

<< 如何在使用ctrl-c / x  ctrl-v时将此信息传递给重复的控件。

做什么你是说一个重复的控件?根据我的理解,它指向控制你只是复制和粘贴(如果我错了,请纠正我)。

What do you mean a duplicated control? For my understanding, it points to control you just copied and pasted(if I am wrong, please correct me).

当它在运行时,只有一种方法来添加一个控件,以编程方式在工作簿上添加控件。如果你想使用"ctrl + C / X",和"Ctrl + P"要在运行时复制并粘贴一个winform控件,带有位图的容器ActiveX控件
将粘贴到您的工作簿中。原始代码背后的代码不会被复制。位图显示当时winform控件的外观,它是静态的而不是动态的,这意味着你不能在运行时存储不断变化的数据。

When it is at runtime, there is only one way to add a control, programmatically adding a control on a workbook. If you want to use "ctrl+C/X" and "Ctrl+P" to copy and paste a winform control at runtime, an container ActiveX control with a bit map will be pasted into your workbook. The code behind your original code will not be copied.The bitmap shows the appearance of your winform control at at that time , it's static not dynamic, which means you can't store ever changing data at runtime.

希望这会对你有所帮助。

Hope this will help you.

最好的问候

Lan


这篇关于如何在复制usercontrol时复制usercontrol的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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