控制属性 [英] Control Properties

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

问题描述

大家好,

您可以动态更改VisualStudio属性网格中控件的属性选项吗?


我想要的是能够改变一些依赖他人的财产选择。例如:

如果我的控制方向是水平的,那么我希望文本方向选项为左。或正确的或但是如果方向是垂直的,那么我希望文本方向选项是向上。和向下。它确实比那更深,因为可能至少有三个控件相互依赖...


目前我有一些getter / setter方法在属性中公开我的自定义属性网格,但我看不出如何根据另一个getter / setter方法更改选项。


显然我需要这个在设计时工作,这是当前方法在构建源之后所做的。


可以帮忙吗? br />

谢谢

Hello all,
Can you dynamically change the property options for a control in the property grid of VisualStudio?

What I want is to be able to change some of the property options which are dependent upon others. For example:
If my control orientation was horizontal then I would want the text direction options to be "left" or "right" but if the orientation wsa vertical then I would want the text direction options to be "up" and "down". It does go deeper than that as there likely to be at least three controls dependent upon each other...

Currently I have some getter/setter methods which expose my custom properties in the property grid but I cannot see how you can change the options dependent upon another getter/setter method.

Clearly I need this to work at design time, which the current method does after the source is built.

Can anoyone help?

Thanks

推荐答案

覆盖OnPaint并将一些逻辑放在那里。

这个必须在设计时运行才能对表单进行绘制,以便您可以对其进行操作。
Override the OnPaint and put some of the logic in there.
This has to run even at design time in order for the form to be painted so you can work on it.


只需向控件注册适当的事件处理程序。
Just register appropriate event handlers to your controls.


感谢您的回复,但这是逃避我的逻辑:(


这是我到目前为止所拥有的;对于有脑子的人来说应该是非常明显的我做错了什么!!

Thanks for the reply but it is the logic that is escaping me at the moment :(

This is what I have so far; it should be quite obvious to someone with brains what I am doing wrong!!

展开 | 选择 | Wrap | 行号


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

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