如何使用VS代码对象获取对象的正确性值 [英] How can you obtain properity values of objects using the VS code objects

查看:79
本文介绍了如何使用VS代码对象获取对象的正确性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建VS的扩展,在其中可以浏览每种形式,识别控件,然后找到属性值,例如高度,宽度,颜色等.我可以深入到CodeVariable2对象,获取CodeTypeRef,然后 随后通过获取基类的列表并遍历该列表以建立控件类型(列表框,编辑等)来确定控件类型(是否有更好的方法?),但是如何获取每个控件的属性值对象,以便我可以使用

I am trying to create an extension to VS in which I can go through each form, identify the controls, and then find the property values such as height, width, color etc.  I can get down to the CodeVariable2 object, get the CodeTypeRef, and subsequently establish the control type OK by getting a list of the base classes and working through the list to establish the control type (Listbox, edit etc), (is there a better way?), but how can I get the property values of each object, so that I can use this information to generate new versions of the code using the information gained.

推荐答案

对于Windows窗体,请参阅我的文章以使用PropertyDescriptor.GetValue:

For Windows Forms see my article to use PropertyDescriptor.GetValue:

方法:从Visual Studio .NET加载项操纵Windows窗体的控件.

HOWTO: Manipulating controls of Windows forms from Visual Studio .NET add-ins.

http://www.visualstudioextensibility.com/articles/add-ins/


这篇关于如何使用VS代码对象获取对象的正确性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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