![](/img/trans.png)
[英]Which method need to override to round the corner of NotiIcon's ContextMenuStrip?
[英]Need to override method that is in a namspace with another class which constructs it
我正在嘗試覆蓋社區服務器 SDK 中名為“InlineTagsContainerTagEditor”的控件上的方法。
當我找到此控件的源時,它位於另一個 class 的文件中,名為“TaggableContentTagEditableList”。
以下是我認為相關部分的內容:
namespace CommunityServer.Controls
{
public class TaggableContentTagEditableList : WrappedContentBase, ICallbackEventHandler
{
protected virtual InlineTagsContainerTagEditor GetInlineTagEditor(ITagsContainer container)
{
return new InlineTagsContainerTagEditor(container);
}
}
public class InlineTagsContainerTagEditor : TWC.InlineEditor
{
ITagsContainer _container;
public InlineTagsContainerTagEditor(ITagsContainer container)
: base()
{
_container = container;
}
}
}
我只是想創建一個刪除某些“標簽”的 TaggableContentEditableList 版本。 我試圖在下面覆蓋的方法 - 但我很迷茫。 我是否必須重寫 TaggableContentTagEditableList 的構造函數才能讓構造函數使用我的重寫方法查找正確的類型?
public partial class TaggableContentEditableListExclude : TaggableContentTagEditableList
{
protected override InlineTagsContainerTagEditor GetInlineTagEditor(ITagsContainer container)
{
return new TagExcludeOption(container);
}
}
public partial class TagExcludeOption : InlineTagsContainerTagEditor
{
ITagsContainer _container;
public TagExcludeOption(ITagsContainer container) : base(container)
{
_container = container;
}
public override string FormatTags(string[] tagList)
{
// strip special tags
string[] newTagList = stripTags(tagList);
return base.FormatTags(newTagList);
}
private string[] stripTags(string[] tagList)
{
//doing something here
}
}
您的問題似乎出在您的覆蓋 FormatTags
您正在使用剝離的標簽創建一個新字符串,但隨后將舊字符串發送到基礎。
舊字符串尚未更改,因此您的覆蓋沒有做任何事情。
嘗試
public override string FormatTags(string[] tagList)
{
// strip special tags
string[] newTagList = stripTags(tagList);
return base.FormatTags(newTagList);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.