两个PropertyGrids控制同步 [英] Two PropertyGrids Controls Synchronization

查看:67
本文介绍了两个PropertyGrids控制同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的WinForm应用程序中有2个PropertyGrid控件。它们是为了并排比较两个对象,所以我想要
做的是在用户与UI交互时同步它们。例如,如果用户在PropertyGridControl旁边调整PropertyGrid或GridSplitter的大小,我希望第二个PropertyGridControl也调整大小。如果用户在其中一个
PropertyGridControls中选择一行(选择一个路径),则另一个PropertyGridControl也会被选中。此外,如果滚动条在一个PropertyGridControl内移动,另一个将自动滚动到相同的位置。如果一个PropertyGrid的类别扩展/折叠
,其他也应该展开/折叠。




你对如何处理这个问题有什么建议吗?

任何例子都很受欢迎。

解方案

您好,


可以是任何唯一关注的事件PropertyTabChanged和PropertyValueChanged。没有用于调整实际网格大小的事件。通过PropertyGrid的Refresh方法完成同步。 


自动滚动是创建Custo PropertyGrid以跟踪此操作所需的内容。我从来没有需要,所以我没有代码示例。


Hi,

I have 2 PropertyGrid controls in my WinForm app. They are meant to compare two objects side by side, so what I want to do is to sync these as the user interacts with the UI. For example, if the user resizes the PropertyGrid or the GridSplitter next to the PropertyGridControl, I'd like the second PropertyGridControl to also resize. If the users selects a row in one of the PropertyGridControls (selects a path), the other PropertyGridControl gets selected too. Also if the scroll bar is moved inside one PropertyGridControl, the other will auto scroll to the same position. And if the one PropertyGrid's category expands/collapses other should also expand/collapse.

Do you have a suggestion on how to approach this?
Any examples are appreciated.

解决方案

Hello,

The only events available that are of any interest are PropertyTabChanged and PropertyValueChanged. There are no events for resizing the actual grid. Sync'ing is done via the Refresh method of the PropertyGrid. 

Auto-scrolling is something you would need to create a custo PropertyGrid to track this. I've never had a need so I don't have a code sample.


这篇关于两个PropertyGrids控制同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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