积极答复者
自定义控件三角型问题 mvp级别

问题
答案
-
研究了下 textbox 唯一进入行为窗口的 MutilLine 属性
发现 似乎还是属性的特性设置
[SRDescription("TextBoxMultilineDescr"), Localizable(true), RefreshProperties(RefreshProperties.All), SRCategory("CatBehavior"), DefaultValue(false)] public virtual bool Multiline { get { return this.textBoxFlags[multiline]; } set { if (this.textBoxFlags[multiline] != value) { using (LayoutTransaction.CreateTransactionIf(this.AutoSize, this.ParentInternal, this, PropertyNames.Multiline)) { this.textBoxFlags[multiline] = value; if (value) { base.SetStyle(ControlStyles.FixedHeight, false); } else { base.SetStyle(ControlStyles.FixedHeight, this.AutoSize); } base.RecreateHandle(); this.AdjustHeight(false); this.OnMultilineChanged(EventArgs.Empty); } } } } 另一个属性 就没有这么多说明
[SRDescription("TextBoxAcceptsTabDescr"), SRCategory("CatBehavior"), DefaultValue(false)] public bool AcceptsTab { get { return this.textBoxFlags[acceptsTab]; } set { if (this.textBoxFlags[acceptsTab] != value) { this.textBoxFlags[acceptsTab] = value; this.OnAcceptsTabChanged(EventArgs.Empty); } } }
根据进一步研究 以上全是错的
Guitar Hero IV -- Singing Rock & Roll.- 已标记为答案 tssing 2009年2月7日 14:39
- 已编辑 韦恩卑鄙 waywa 2009年2月7日 15:03
-
果然 顺藤摸瓜
找到了
internal class TextBoxActionList : DesignerActionList { // Methods public TextBoxActionList(TextBoxDesigner designer); public override DesignerActionItemCollection GetSortedActionItems(); // Properties public bool Multiline { get; set; } } Expand Methods
Guitar Hero IV -- Singing Rock & Roll.- 已标记为答案 tssing 2009年2月7日 15:10
-
- 已标记为答案 tssing 2009年2月8日 13:13
全部回复
-
研究了下 textbox 唯一进入行为窗口的 MutilLine 属性
发现 似乎还是属性的特性设置
[SRDescription("TextBoxMultilineDescr"), Localizable(true), RefreshProperties(RefreshProperties.All), SRCategory("CatBehavior"), DefaultValue(false)] public virtual bool Multiline { get { return this.textBoxFlags[multiline]; } set { if (this.textBoxFlags[multiline] != value) { using (LayoutTransaction.CreateTransactionIf(this.AutoSize, this.ParentInternal, this, PropertyNames.Multiline)) { this.textBoxFlags[multiline] = value; if (value) { base.SetStyle(ControlStyles.FixedHeight, false); } else { base.SetStyle(ControlStyles.FixedHeight, this.AutoSize); } base.RecreateHandle(); this.AdjustHeight(false); this.OnMultilineChanged(EventArgs.Empty); } } } } 另一个属性 就没有这么多说明
[SRDescription("TextBoxAcceptsTabDescr"), SRCategory("CatBehavior"), DefaultValue(false)] public bool AcceptsTab { get { return this.textBoxFlags[acceptsTab]; } set { if (this.textBoxFlags[acceptsTab] != value) { this.textBoxFlags[acceptsTab] = value; this.OnAcceptsTabChanged(EventArgs.Empty); } } }
根据进一步研究 以上全是错的
Guitar Hero IV -- Singing Rock & Roll.- 已标记为答案 tssing 2009年2月7日 14:39
- 已编辑 韦恩卑鄙 waywa 2009年2月7日 15:03
-
错了错了
根据textbox 的特性声明
[Designer("System.Windows.Forms.Design.TextBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), SRDescription("DescriptionTextBox"), ComVisible(true), ClassInterface(ClassInterfaceType.AutoDispatch)]
在 system.design.dll
里面有个
internal class TextBoxDesigner : TextBoxBaseDesigner { // Fields private DesignerActionListCollection _actionLists; // Methods public TextBoxDesigner(); protected override void PreFilterProperties(IDictionary properties); // Properties public override DesignerActionListCollection ActionLists { get; } private char PasswordChar { get; set; } } Expand Methods 这个是 特性调用的设计器 这个实际器有一个属性 是
public override DesignerActionListCollection ActionLists { get { if (this._actionLists == null) { this._actionLists = new DesignerActionListCollection(); this._actionLists.Add(new TextBoxActionList(this)); } return this._actionLists; } } 你为你的控件实现一个类似的 designer 并且在类特性里面调用 应该就可以做出这个三角
Guitar Hero IV -- Singing Rock & Roll. -
果然 顺藤摸瓜
找到了
internal class TextBoxActionList : DesignerActionList { // Methods public TextBoxActionList(TextBoxDesigner designer); public override DesignerActionItemCollection GetSortedActionItems(); // Properties public bool Multiline { get; set; } } Expand Methods
Guitar Hero IV -- Singing Rock & Roll.- 已标记为答案 tssing 2009年2月7日 15:10
-
- 已标记为答案 tssing 2009年2月8日 13:13